diff --git a/lib/smith.rb b/lib/smith.rb index cf1239c..cf48972 100644 --- a/lib/smith.rb +++ b/lib/smith.rb @@ -8,8 +8,7 @@ require 'fileutils' require 'multi_json' require 'securerandom' -require 'extlib/string' -require 'extlib/inflection' +require 'inflecto' require 'daemons/pidfile' require 'smith/config' diff --git a/lib/smith/agent_process.rb b/lib/smith/agent_process.rb index 04e6edc..81d85fa 100644 --- a/lib/smith/agent_process.rb +++ b/lib/smith/agent_process.rb @@ -190,7 +190,7 @@ def self.start_process(agent_process) bootstrapper = Pathname.new(__FILE__).dirname.join('bootstrap.rb').expand_path - binary = Smith.config.vm[agent_process.name.snake_case.to_sym] || Smith.config.vm.agent_default + binary = Smith.config.vm[Inflecto.undercore(agent_process.name).to_sym] || Smith.config.vm.agent_default logger.debug { "Launching #{agent_process.name} with: #{binary}" } exec(binary, bootstrapper.to_s, agent_process.name, agent_process.uuid) end diff --git a/lib/smith/command.rb b/lib/smith/command.rb index 09316d3..58ba84d 100644 --- a/lib/smith/command.rb +++ b/lib/smith/command.rb @@ -20,7 +20,7 @@ def self.run(command, args, vars) command = command.gsub(/-/, '_') load_command(command) - clazz = Commands.const_get(Extlib::Inflection.camelize(command)).new + clazz = Commands.const_get(Inflecto.camelize(command)).new begin clazz.parse_options(args) @@ -49,7 +49,7 @@ def self.load_command(command) end def self.instantiate(command) - Commands.const_get(Extlib::Inflection.camelize(command)).new + Commands.const_get(Inflecto.camelize(command)).new end # What type of command is it? diff --git a/lib/smith/commands/smithctl/acl.rb b/lib/smith/commands/smithctl/acl.rb index f3a9537..93248fc 100644 --- a/lib/smith/commands/smithctl/acl.rb +++ b/lib/smith/commands/smithctl/acl.rb @@ -1,7 +1,5 @@ # -*- encoding: utf-8 -*- -require 'extlib/string' - module Smith module Commands class Acl < CommandBase @@ -57,7 +55,7 @@ def _acl def find_acl(directories, acl, ext) [directories].flatten.inject([]) do |a, directory| a.tap do |acc| - acl_file = directory.join("#{acl.snake_case}.#{ext}") + acl_file = directory.join("#{Inflecto.underscore(acl)}.#{ext}") acc << acl_file if acl_file.exist? end end diff --git a/lib/smith/logger.rb b/lib/smith/logger.rb index f54fe13..5f914a3 100644 --- a/lib/smith/logger.rb +++ b/lib/smith/logger.rb @@ -36,7 +36,7 @@ def log_level(level=nil) def log_appender unless @@appender - appender_type = Extlib::Inflection.camelize(Config.get.logging.appender.type) + appender_type = Inflecto.camelize(Config.get.logging.appender.type) pattern_opts = { :pattern => Config.get.logging.default_pattern, :date_pattern => Config.get.logging.default_date_pattern} diff --git a/lib/smith/messaging/acl_type_cache.rb b/lib/smith/messaging/acl_type_cache.rb index 005fa79..e7e1a76 100644 --- a/lib/smith/messaging/acl_type_cache.rb +++ b/lib/smith/messaging/acl_type_cache.rb @@ -1,7 +1,6 @@ # -*- encoding: utf-8 -*- require 'set' -require 'extlib' require 'singleton' require 'murmurhash3' @@ -30,7 +29,8 @@ def add(type) @hashes[format][h] = type end - @legacy_types_by_hash[type.to_s.split(/::/)[-1].snake_case] = type + # TODO: would Inflecto::demodulize work here instead? + @legacy_types_by_hash[Inflecto.underscore(type.to_s.split(/::/)[-1])] = type true end end diff --git a/lib/smith/utils.rb b/lib/smith/utils.rb index 20e8fc1..782eca0 100644 --- a/lib/smith/utils.rb +++ b/lib/smith/utils.rb @@ -20,7 +20,7 @@ def agent_directories(name) # @param clazz [String] the fully qualified class. # @@return [Pathname] the path def path_from_class(root, clazz) - parts = clazz.split(/::/).map(&:snake_case) + parts = clazz.split(/::/).map { |part| Inflecto.underscore(part) } parts[-1] = "#{parts[-1]}.rb" Pathname.new(root).join(*parts) end diff --git a/smith.gemspec b/smith.gemspec index 9a6dc54..cc51280 100644 --- a/smith.gemspec +++ b/smith.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'addressable', '~> 2.0' s.add_runtime_dependency 'daemons', '~> 1.1' s.add_runtime_dependency "eventmachine", "~> 1.0" - s.add_runtime_dependency "extlib", "0.9.16" + s.add_runtime_dependency "inflecto", "~> 0.0.2" s.add_runtime_dependency "logging", "~> 2.0" s.add_runtime_dependency 'protobuf', '~> 3.4' s.add_runtime_dependency "state_machine", "1.1.2"