Class: Git::Gems::CLI
- Inherits:
-
Thor
- Object
- Thor
- Git::Gems::CLI
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
71
72
73
|
# File 'lib/git/gems/cli.rb', line 71
def method_missing(name, *args)
self.__send__(:exec, name, *args)
end
|
Class Method Details
.default_binstubs_path ⇒ Object
22
23
24
|
# File 'lib/git/gems/cli.rb', line 22
def default_binstubs_path()
return "./.bundle/bin"
end
|
.default_install_path ⇒ Object
15
16
17
18
19
20
|
# File 'lib/git/gems/cli.rb', line 15
def default_install_path()
install_path = options[:path]
install_path = has_vendor_dir? ?
"./vendor/bundle" : "./.bundle" if install_path.nil?
return install_path
end
|
.has_vendor_dir? ⇒ Boolean
11
12
13
|
# File 'lib/git/gems/cli.rb', line 11
def has_vendor_dir?
return File.exist?(File.expand_path("./config.ru")) || Dir.exist?(File.expand_path("./vendor"))
end
|
Instance Method Details
#bundler(*args) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/git/gems/cli.rb', line 35
def bundler(*args)
options[:"no-path"], options[:"no-binstubs"] = true if options[:global]
group_opt = options[:production] ? "--without development test" : %{}
path_opt = options[:"no-path"] ? %{} : "--path=#{options[:path]}"
binstubs_opt = options[:"no-binstubs"] ? %{} : "--binstubs=#{options[:binstubs]}"
exec_cmd "bundle install #{path_opt} #{binstubs_opt} #{group_opt} #{args.join(%{ })}"
end
|
#exec(cmd, *args) ⇒ Object
46
47
48
|
# File 'lib/git/gems/cli.rb', line 46
def exec(cmd, *args)
exec_cmd "bundle exec #{cmd} #{args.join(%{ })}"
end
|
#init ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/git/gems/cli.rb', line 51
def init()
%w(Rakefile Gemfile README.md).each do |f|
exec_cmd "cp -a #{File.expand_path("../../../fixtures/#{f}.template", File.dirname(__FILE__))} ./#{f}"
end
exec_cmd "mkdir -p lib spec"
exec_cmd "touch lib/.keep spec/.keep"
exec_cmd "git init"
end
|
#update(*args) ⇒ Object
61
62
63
|
# File 'lib/git/gems/cli.rb', line 61
def update(*args)
exec_cmd "bundle update #{args.join(%{ })}"
end
|