Module: GemSuit::CLI::Base::Utils::InstanceMethods

Defined in:
lib/gem_suit/cli/base/utils.rb

Instance Method Summary collapse

Instance Method Details

#camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/gem_suit/cli/base/utils.rb', line 22

def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
  if first_letter_in_uppercase
    lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
  else
    lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1]
  end
end

#execute(command, force = nil) ⇒ Object



14
15
16
# File 'lib/gem_suit/cli/base/utils.rb', line 14

def execute(command, force = nil)
  options.very_verbose? || options.verbose? || force ? system(command) : `#{command}`
end

#log(string, force = false) ⇒ Object



18
19
20
# File 'lib/gem_suit/cli/base/utils.rb', line 18

def log(string, force = false)
  puts string if options.very_verbose? || options.verbose? || force
end