Class: Git::Gems::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/git/gems/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



62
63
64
# File 'lib/git/gems/cli.rb', line 62

def method_missing(name, *args)
  self.__send__(:exec, name, *args)
end

Class Method Details

.default_binstubs_pathObject



21
22
23
# File 'lib/git/gems/cli.rb', line 21

def default_binstubs_path()
  return "./.bundle/bin"
end

.default_install_pathObject



14
15
16
17
18
19
# File 'lib/git/gems/cli.rb', line 14

def default_install_path()
  install_path = options[:path]
  install_path = is_rackapp? ?
    "./vendor/bundle" : "./.bundle" if install_path.nil?
  return install_path
end

.is_rackapp?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/git/gems/cli.rb', line 10

def is_rackapp?
  return File.exist?(File.expand_path("./config.ru"))
end

Instance Method Details

#exec(cmd, *args) ⇒ Object



36
37
38
# File 'lib/git/gems/cli.rb', line 36

def exec(cmd, *args)
  exec_cmd "bundle exec #{cmd} #{args.join(%{ })}"
end

#initObject



41
42
43
44
45
46
47
48
# File 'lib/git/gems/cli.rb', line 41

def init()
  %w(Rakefile Gemfile README.md).each do |f|
    exec_cmd "cp -a #{File.expand_path("../../../../fixtures/#{f}.template", __FILE__)} ./#{f}"
  end
  exec_cmd "mkdir -p lib spec"
  exec_cmd "touch lib/.keep spec/.keep"
  exec_cmd "git init"
end

#install(*args) ⇒ Object



30
31
32
# File 'lib/git/gems/cli.rb', line 30

def install(*args)
  exec_cmd "bundle install --path=#{options[:path]} --binstubs=#{options[:binstubs]}"
end

#release_tagObject



52
53
54
# File 'lib/git/gems/cli.rb', line 52

def release_tag
  exec_cmd "git tag -a 'release-#{options[:version]}'"
end