Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/smith.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion lib/smith/agent_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscore ?

logger.debug { "Launching #{agent_process.name} with: #{binary}" }
exec(binary, bootstrapper.to_s, agent_process.name, agent_process.uuid)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/smith/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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?
Expand Down
4 changes: 1 addition & 3 deletions lib/smith/commands/smithctl/acl.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- encoding: utf-8 -*-

require 'extlib/string'

module Smith
module Commands
class Acl < CommandBase
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/smith/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions lib/smith/messaging/acl_type_cache.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- encoding: utf-8 -*-

require 'set'
require 'extlib'
require 'singleton'
require 'murmurhash3'

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/smith/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smith.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down