acquia_toolbelt 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/.gitignore +7 -0
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +7 -0
  4. data/CONTRIBUTING.md +11 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +55 -0
  7. data/Guardfile +5 -0
  8. data/LICENSE +19 -0
  9. data/README.md +149 -0
  10. data/Rakefile +1 -0
  11. data/acquia_toolbelt.gemspec +34 -0
  12. data/bin/acquia +9 -0
  13. data/lib/acquia_toolbelt/cli/api.rb +164 -0
  14. data/lib/acquia_toolbelt/cli/auth.rb +31 -0
  15. data/lib/acquia_toolbelt/cli/database.rb +237 -0
  16. data/lib/acquia_toolbelt/cli/deploy.rb +36 -0
  17. data/lib/acquia_toolbelt/cli/domain.rb +177 -0
  18. data/lib/acquia_toolbelt/cli/environment.rb +71 -0
  19. data/lib/acquia_toolbelt/cli/file.rb +31 -0
  20. data/lib/acquia_toolbelt/cli/server.rb +67 -0
  21. data/lib/acquia_toolbelt/cli/site.rb +28 -0
  22. data/lib/acquia_toolbelt/cli/ssh.rb +78 -0
  23. data/lib/acquia_toolbelt/cli/svn.rb +73 -0
  24. data/lib/acquia_toolbelt/cli/task.rb +74 -0
  25. data/lib/acquia_toolbelt/cli/ui.rb +44 -0
  26. data/lib/acquia_toolbelt/cli.rb +103 -0
  27. data/lib/acquia_toolbelt/error.rb +4 -0
  28. data/lib/acquia_toolbelt/thor.rb +95 -0
  29. data/lib/acquia_toolbelt/version.rb +3 -0
  30. data/lib/acquia_toolbelt.rb +4 -0
  31. data/lib/vendor/thor/CHANGELOG.md +139 -0
  32. data/lib/vendor/thor/Gemfile +20 -0
  33. data/lib/vendor/thor/LICENSE.md +20 -0
  34. data/lib/vendor/thor/README.md +35 -0
  35. data/lib/vendor/thor/lib/thor/actions/create_file.rb +105 -0
  36. data/lib/vendor/thor/lib/thor/actions/create_link.rb +60 -0
  37. data/lib/vendor/thor/lib/thor/actions/directory.rb +119 -0
  38. data/lib/vendor/thor/lib/thor/actions/empty_directory.rb +137 -0
  39. data/lib/vendor/thor/lib/thor/actions/file_manipulation.rb +317 -0
  40. data/lib/vendor/thor/lib/thor/actions/inject_into_file.rb +109 -0
  41. data/lib/vendor/thor/lib/thor/actions.rb +318 -0
  42. data/lib/vendor/thor/lib/thor/base.rb +654 -0
  43. data/lib/vendor/thor/lib/thor/command.rb +136 -0
  44. data/lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +80 -0
  45. data/lib/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
  46. data/lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb +100 -0
  47. data/lib/vendor/thor/lib/thor/error.rb +32 -0
  48. data/lib/vendor/thor/lib/thor/group.rb +282 -0
  49. data/lib/vendor/thor/lib/thor/invocation.rb +172 -0
  50. data/lib/vendor/thor/lib/thor/parser/argument.rb +74 -0
  51. data/lib/vendor/thor/lib/thor/parser/arguments.rb +171 -0
  52. data/lib/vendor/thor/lib/thor/parser/option.rb +121 -0
  53. data/lib/vendor/thor/lib/thor/parser/options.rb +218 -0
  54. data/lib/vendor/thor/lib/thor/parser.rb +4 -0
  55. data/lib/vendor/thor/lib/thor/rake_compat.rb +72 -0
  56. data/lib/vendor/thor/lib/thor/runner.rb +322 -0
  57. data/lib/vendor/thor/lib/thor/shell/basic.rb +422 -0
  58. data/lib/vendor/thor/lib/thor/shell/color.rb +148 -0
  59. data/lib/vendor/thor/lib/thor/shell/html.rb +127 -0
  60. data/lib/vendor/thor/lib/thor/shell.rb +88 -0
  61. data/lib/vendor/thor/lib/thor/util.rb +270 -0
  62. data/lib/vendor/thor/lib/thor/version.rb +3 -0
  63. data/lib/vendor/thor/lib/thor.rb +474 -0
  64. data/lib/vendor/thor/spec/actions/create_file_spec.rb +170 -0
  65. data/lib/vendor/thor/spec/actions/create_link_spec.rb +95 -0
  66. data/lib/vendor/thor/spec/actions/directory_spec.rb +169 -0
  67. data/lib/vendor/thor/spec/actions/empty_directory_spec.rb +129 -0
  68. data/lib/vendor/thor/spec/actions/file_manipulation_spec.rb +382 -0
  69. data/lib/vendor/thor/spec/actions/inject_into_file_spec.rb +135 -0
  70. data/lib/vendor/thor/spec/actions_spec.rb +331 -0
  71. data/lib/vendor/thor/spec/base_spec.rb +291 -0
  72. data/lib/vendor/thor/spec/command_spec.rb +80 -0
  73. data/lib/vendor/thor/spec/core_ext/hash_with_indifferent_access_spec.rb +48 -0
  74. data/lib/vendor/thor/spec/core_ext/ordered_hash_spec.rb +115 -0
  75. data/lib/vendor/thor/spec/exit_condition_spec.rb +19 -0
  76. data/lib/vendor/thor/spec/fixtures/application.rb +2 -0
  77. data/lib/vendor/thor/spec/fixtures/app{1}/README +3 -0
  78. data/lib/vendor/thor/spec/fixtures/bundle/execute.rb +6 -0
  79. data/lib/vendor/thor/spec/fixtures/bundle/main.thor +1 -0
  80. data/lib/vendor/thor/spec/fixtures/command.thor +10 -0
  81. data/lib/vendor/thor/spec/fixtures/doc/%file_name%.rb.tt +1 -0
  82. data/lib/vendor/thor/spec/fixtures/doc/COMMENTER +11 -0
  83. data/lib/vendor/thor/spec/fixtures/doc/README +3 -0
  84. data/lib/vendor/thor/spec/fixtures/doc/block_helper.rb +3 -0
  85. data/lib/vendor/thor/spec/fixtures/doc/components/.empty_directory +0 -0
  86. data/lib/vendor/thor/spec/fixtures/doc/config.rb +1 -0
  87. data/lib/vendor/thor/spec/fixtures/doc/config.yaml.tt +1 -0
  88. data/lib/vendor/thor/spec/fixtures/doc/excluding/%file_name%.rb.tt +1 -0
  89. data/lib/vendor/thor/spec/fixtures/enum.thor +10 -0
  90. data/lib/vendor/thor/spec/fixtures/group.thor +128 -0
  91. data/lib/vendor/thor/spec/fixtures/invoke.thor +118 -0
  92. data/lib/vendor/thor/spec/fixtures/path with spaces +0 -0
  93. data/lib/vendor/thor/spec/fixtures/preserve/script.sh +3 -0
  94. data/lib/vendor/thor/spec/fixtures/script.thor +220 -0
  95. data/lib/vendor/thor/spec/fixtures/subcommand.thor +17 -0
  96. data/lib/vendor/thor/spec/group_spec.rb +222 -0
  97. data/lib/vendor/thor/spec/helper.rb +67 -0
  98. data/lib/vendor/thor/spec/invocation_spec.rb +108 -0
  99. data/lib/vendor/thor/spec/parser/argument_spec.rb +53 -0
  100. data/lib/vendor/thor/spec/parser/arguments_spec.rb +66 -0
  101. data/lib/vendor/thor/spec/parser/option_spec.rb +202 -0
  102. data/lib/vendor/thor/spec/parser/options_spec.rb +400 -0
  103. data/lib/vendor/thor/spec/rake_compat_spec.rb +72 -0
  104. data/lib/vendor/thor/spec/register_spec.rb +197 -0
  105. data/lib/vendor/thor/spec/runner_spec.rb +241 -0
  106. data/lib/vendor/thor/spec/shell/basic_spec.rb +330 -0
  107. data/lib/vendor/thor/spec/shell/color_spec.rb +95 -0
  108. data/lib/vendor/thor/spec/shell/html_spec.rb +31 -0
  109. data/lib/vendor/thor/spec/shell_spec.rb +47 -0
  110. data/lib/vendor/thor/spec/subcommand_spec.rb +30 -0
  111. data/lib/vendor/thor/spec/thor_spec.rb +499 -0
  112. data/lib/vendor/thor/spec/util_spec.rb +196 -0
  113. data/lib/vendor/thor/thor.gemspec +24 -0
  114. data/script/release +50 -0
  115. data/script/setup_build +6 -0
  116. data/script/test +23 -0
  117. data/spec/auth_spec.rb +15 -0
  118. data/spec/cassettes/databases/all_databases.json +1 -0
  119. data/spec/cassettes/databases/copy_database_from_dev_to_stage.json +1 -0
  120. data/spec/cassettes/databases/create_a_database_backup.json +1 -0
  121. data/spec/cassettes/databases/create_a_new_database.json +1 -0
  122. data/spec/cassettes/databases/delete_a_database.json +1 -0
  123. data/spec/cassettes/databases/get_all_existing_databases.json +1 -0
  124. data/spec/cassettes/databases/list_all_database_backups.json +1 -0
  125. data/spec/cassettes/databases/view_database_instance_details.json +1 -0
  126. data/spec/cassettes/deploy/release_vcs_branch.json +1 -0
  127. data/spec/cassettes/domains/create_new_domain.json +1 -0
  128. data/spec/cassettes/domains/delete_a_domain.json +1 -0
  129. data/spec/cassettes/domains/get_all_existing_domains.json +1 -0
  130. data/spec/cassettes/domains/list_all_dev_domains.json +1 -0
  131. data/spec/cassettes/domains/move_from_dev_to_stage.json +1 -0
  132. data/spec/cassettes/domains/purge_varnish_cache.json +1 -0
  133. data/spec/cassettes/environments/all_environments.json +1 -0
  134. data/spec/cassettes/environments/disable_live_development.json +1 -0
  135. data/spec/cassettes/environments/enable_live_development.json +1 -0
  136. data/spec/cassettes/files/copy_from_dev_to_stage.json +1 -0
  137. data/spec/cassettes/servers/all_dev_servers.json +1 -0
  138. data/spec/cassettes/servers/all_prod_servers.json +1 -0
  139. data/spec/cassettes/sites/all_sites.json +1 -0
  140. data/spec/cassettes/ssh/all_sshkeys.json +1 -0
  141. data/spec/cassettes/svn/all_svnusers.json +1 -0
  142. data/spec/cassettes/tasks/all_tasks.json +1 -0
  143. data/spec/databases_spec.rb +78 -0
  144. data/spec/deploy_spec.rb +12 -0
  145. data/spec/domains_spec.rb +59 -0
  146. data/spec/environments_spec.rb +35 -0
  147. data/spec/files_spec.rb +11 -0
  148. data/spec/helper.rb +104 -0
  149. data/spec/servers_spec.rb +59 -0
  150. data/spec/sites_spec.rb +19 -0
  151. data/spec/ssh_spec.rb +19 -0
  152. data/spec/svn_spec.rb +11 -0
  153. data/spec/tasks_spec.rb +11 -0
  154. metadata +158 -4
@@ -0,0 +1,48 @@
1
+ require 'helper'
2
+ require 'thor/core_ext/hash_with_indifferent_access'
3
+
4
+ describe Thor::CoreExt::HashWithIndifferentAccess do
5
+ before do
6
+ @hash = Thor::CoreExt::HashWithIndifferentAccess.new :foo => 'bar', 'baz' => 'bee', :force => true
7
+ end
8
+
9
+ it "has values accessible by either strings or symbols" do
10
+ expect(@hash['foo']).to eq('bar')
11
+ expect(@hash[:foo]).to eq('bar')
12
+
13
+ expect(@hash.values_at(:foo, :baz)).to eq(['bar', 'bee'])
14
+ expect(@hash.delete(:foo)).to eq('bar')
15
+ end
16
+
17
+ it "handles magic boolean predicates" do
18
+ expect(@hash.force?).to be_true
19
+ expect(@hash.foo?).to be_true
20
+ expect(@hash.nothing?).to be_false
21
+ end
22
+
23
+ it "handles magic comparisons" do
24
+ expect(@hash.foo?('bar')).to be_true
25
+ expect(@hash.foo?('bee')).to be_false
26
+ end
27
+
28
+ it "maps methods to keys" do
29
+ expect(@hash.foo).to eq(@hash['foo'])
30
+ end
31
+
32
+ it "merges keys independent if they are symbols or strings" do
33
+ @hash.merge!('force' => false, :baz => "boom")
34
+ expect(@hash[:force]).to eq(false)
35
+ expect(@hash["baz"]).to eq("boom")
36
+ end
37
+
38
+ it "creates a new hash by merging keys independent if they are symbols or strings" do
39
+ other = @hash.merge('force' => false, :baz => "boom")
40
+ expect(other[:force]).to eq(false)
41
+ expect(other["baz"]).to eq("boom")
42
+ end
43
+
44
+ it "converts to a traditional hash" do
45
+ expect(@hash.to_hash.class).to eq(Hash)
46
+ expect(@hash).to eq({ 'foo' => 'bar', 'baz' => 'bee', 'force' => true })
47
+ end
48
+ end
@@ -0,0 +1,115 @@
1
+ require 'helper'
2
+ require 'thor/core_ext/ordered_hash'
3
+
4
+ describe Thor::CoreExt::OrderedHash do
5
+ before do
6
+ @hash = Thor::CoreExt::OrderedHash.new
7
+ end
8
+
9
+ describe "without any items" do
10
+ it "returns nil for an undefined key" do
11
+ expect(@hash["foo"]).to be_nil
12
+ end
13
+
14
+ it "doesn't iterate through any items" do
15
+ @hash.each { fail }
16
+ end
17
+
18
+ it "has an empty key and values list" do
19
+ expect(@hash.keys).to be_empty
20
+ expect(@hash.values).to be_empty
21
+ end
22
+
23
+ it "must be empty" do
24
+ expect(@hash).to be_empty
25
+ end
26
+ end
27
+
28
+ describe "with several items" do
29
+ before do
30
+ @hash[:foo] = "Foo!"
31
+ @hash[:bar] = "Bar!"
32
+ @hash[:baz] = "Baz!"
33
+ @hash[:bop] = "Bop!"
34
+ @hash[:bat] = "Bat!"
35
+ end
36
+
37
+ it "returns nil for an undefined key" do
38
+ expect(@hash[:boom]).to be_nil
39
+ end
40
+
41
+ it "returns the value for each key" do
42
+ expect(@hash[:foo]).to eq("Foo!")
43
+ expect(@hash[:bar]).to eq("Bar!")
44
+ expect(@hash[:baz]).to eq("Baz!")
45
+ expect(@hash[:bop]).to eq("Bop!")
46
+ expect(@hash[:bat]).to eq("Bat!")
47
+ end
48
+
49
+ it "iterates through the keys and values in order of assignment" do
50
+ arr = []
51
+ @hash.each do |key, value|
52
+ arr << [key, value]
53
+ end
54
+ expect(arr).to eq([[:foo, "Foo!"], [:bar, "Bar!"], [:baz, "Baz!"],
55
+ [:bop, "Bop!"], [:bat, "Bat!"]])
56
+ end
57
+
58
+ it "returns the keys in order of insertion" do
59
+ expect(@hash.keys).to eq([:foo, :bar, :baz, :bop, :bat])
60
+ end
61
+
62
+ it "returns the values in order of insertion" do
63
+ expect(@hash.values).to eq(["Foo!", "Bar!", "Baz!", "Bop!", "Bat!"])
64
+ end
65
+
66
+ it "does not move an overwritten node to the end of the ordering" do
67
+ @hash[:baz] = "Bip!"
68
+ expect(@hash.values).to eq(["Foo!", "Bar!", "Bip!", "Bop!", "Bat!"])
69
+
70
+ @hash[:foo] = "Bip!"
71
+ expect(@hash.values).to eq(["Bip!", "Bar!", "Bip!", "Bop!", "Bat!"])
72
+
73
+ @hash[:bat] = "Bip!"
74
+ expect(@hash.values).to eq(["Bip!", "Bar!", "Bip!", "Bop!", "Bip!"])
75
+ end
76
+
77
+ it "appends another ordered hash while preserving ordering" do
78
+ other_hash = Thor::CoreExt::OrderedHash.new
79
+ other_hash[1] = "one"
80
+ other_hash[2] = "two"
81
+ other_hash[3] = "three"
82
+ expect(@hash.merge(other_hash).values).to eq(["Foo!", "Bar!", "Baz!", "Bop!", "Bat!", "one", "two", "three"])
83
+ end
84
+
85
+ it "overwrites hash keys with matching appended keys" do
86
+ other_hash = Thor::CoreExt::OrderedHash.new
87
+ other_hash[:bar] = "bar"
88
+ expect(@hash.merge(other_hash)[:bar]).to eq("bar")
89
+ expect(@hash[:bar]).to eq("Bar!")
90
+ end
91
+
92
+ it "converts to an array" do
93
+ expect(@hash.to_a).to eq([[:foo, "Foo!"], [:bar, "Bar!"], [:baz, "Baz!"], [:bop, "Bop!"], [:bat, "Bat!"]])
94
+ end
95
+
96
+ it "must not be empty" do
97
+ expect(@hash).not_to be_empty
98
+ end
99
+
100
+ it "deletes values from hash" do
101
+ expect(@hash.delete(:baz)).to eq("Baz!")
102
+ expect(@hash.values).to eq(["Foo!", "Bar!", "Bop!", "Bat!"])
103
+
104
+ expect(@hash.delete(:foo)).to eq("Foo!")
105
+ expect(@hash.values).to eq(["Bar!", "Bop!", "Bat!"])
106
+
107
+ expect(@hash.delete(:bat)).to eq("Bat!")
108
+ expect(@hash.values).to eq(["Bar!", "Bop!"])
109
+ end
110
+
111
+ it "returns nil if the value to be deleted can't be found" do
112
+ expect(@hash.delete(:nothing)).to be_nil
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,19 @@
1
+ require 'helper'
2
+ require 'thor/base'
3
+
4
+ describe "Exit conditions" do
5
+ it "exits 0, not bubble up EPIPE, if EPIPE is raised" do
6
+ epiped = false
7
+
8
+ command = Class.new(Thor) do
9
+ desc "my_action", "testing EPIPE"
10
+ define_method :my_action do
11
+ epiped = true
12
+ raise Errno::EPIPE
13
+ end
14
+ end
15
+
16
+ expect{ command.start(["my_action"]) }.to raise_error(SystemExit)
17
+ expect(epiped).to eq(true)
18
+ end
19
+ end
@@ -0,0 +1,2 @@
1
+ class Application < Base
2
+ end
@@ -0,0 +1,3 @@
1
+ __start__
2
+ README
3
+ __end__
@@ -0,0 +1,6 @@
1
+ class Execute < Thor
2
+ desc "ls", "Execute ls"
3
+ def ls
4
+ system "ls"
5
+ end
6
+ end
@@ -0,0 +1 @@
1
+ require File.join(File.dirname(__FILE__), 'execute')
@@ -0,0 +1,10 @@
1
+ # module: random
2
+
3
+ class Amazing < Thor
4
+ desc "describe NAME", "say that someone is amazing"
5
+ method_options :forcefully => :boolean
6
+ def describe(name, opts)
7
+ ret = "#{name} is amazing"
8
+ puts opts["forcefully"] ? ret.upcase : ret
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ FOO = <%= "FOO" %>
@@ -0,0 +1,11 @@
1
+ __start__
2
+ # greenblue
3
+ #
4
+ # yellowblue
5
+ #yellowred
6
+ #greenred
7
+ orange
8
+ purple
9
+ ind#igo
10
+ # ind#igo
11
+ __end__
@@ -0,0 +1,3 @@
1
+ __start__
2
+ README
3
+ __end__
@@ -0,0 +1,3 @@
1
+ <% world do -%>
2
+ Hello
3
+ <% end -%>
@@ -0,0 +1 @@
1
+ class <%= @klass %>; end
@@ -0,0 +1 @@
1
+ --- Hi from yaml
@@ -0,0 +1 @@
1
+ BAR = <%= "BAR" %>
@@ -0,0 +1,10 @@
1
+ class Enum < Thor::Group
2
+ include Thor::Actions
3
+
4
+ desc "snack"
5
+ class_option "fruit", :aliases => "-f", :type => :string, :enum => %w(apple banana)
6
+ def snack
7
+ puts options['fruit']
8
+ end
9
+
10
+ end
@@ -0,0 +1,128 @@
1
+ class MyCounter < Thor::Group
2
+ include Thor::Actions
3
+ add_runtime_options!
4
+
5
+ def self.get_from_super
6
+ from_superclass(:get_from_super, 13)
7
+ end
8
+
9
+ source_root File.expand_path(File.dirname(__FILE__))
10
+ source_paths << File.expand_path("broken", File.dirname(__FILE__))
11
+
12
+ argument :first, :type => :numeric
13
+ argument :second, :type => :numeric, :default => 2
14
+
15
+ class_option :third, :type => :numeric, :desc => "The third argument", :default => 3,
16
+ :banner => "THREE", :aliases => "-t"
17
+ class_option :fourth, :type => :numeric, :desc => "The fourth argument"
18
+ class_option :simple, :type => :numeric, :aliases => 'z'
19
+ class_option :symbolic, :type => :numeric, :aliases => [:y, :r]
20
+
21
+ desc <<-FOO
22
+ Description:
23
+ This generator runs three commands: one, two and three.
24
+ FOO
25
+
26
+ def one
27
+ first
28
+ end
29
+
30
+ def two
31
+ second
32
+ end
33
+
34
+ def three
35
+ options[:third]
36
+ end
37
+
38
+ def four
39
+ options[:fourth]
40
+ end
41
+
42
+ def five
43
+ options[:simple]
44
+ end
45
+
46
+ def six
47
+ options[:symbolic]
48
+ end
49
+
50
+ def self.inherited(base)
51
+ super
52
+ base.source_paths.unshift(File.expand_path(File.join(File.dirname(__FILE__), "doc")))
53
+ end
54
+
55
+ no_commands do
56
+ def world(&block)
57
+ result = capture(&block)
58
+ concat(result.strip + " world!")
59
+ end
60
+ end
61
+ end
62
+
63
+ class ClearCounter < MyCounter
64
+ remove_argument :first, :second, :undefine => true
65
+ remove_class_option :third
66
+
67
+ def self.source_root
68
+ File.expand_path(File.join(File.dirname(__FILE__), "bundle"))
69
+ end
70
+ end
71
+
72
+ class BrokenCounter < MyCounter
73
+ namespace "app:broken:counter"
74
+ class_option :fail, :type => :boolean, :default => false
75
+
76
+ class << self
77
+ undef_method :source_root
78
+ end
79
+
80
+ def one
81
+ options[:first]
82
+ end
83
+
84
+ def four
85
+ respond_to?(:fail)
86
+ end
87
+
88
+ def five
89
+ options[:fail] ? this_method_does_not_exist : 5
90
+ end
91
+ end
92
+
93
+ class WhinyGenerator < Thor::Group
94
+ include Thor::Actions
95
+
96
+ def self.source_root
97
+ File.expand_path(File.dirname(__FILE__))
98
+ end
99
+
100
+ def wrong_arity(required)
101
+ end
102
+ end
103
+
104
+ class CommandConflict < Thor::Group
105
+ desc "A group with the same name as a default command"
106
+ def group
107
+ puts "group"
108
+ end
109
+ end
110
+
111
+ class ParentGroup < Thor::Group
112
+ private
113
+ def foo
114
+ "foo"
115
+ end
116
+
117
+ def baz(name = 'baz')
118
+ name
119
+ end
120
+ end
121
+
122
+ class ChildGroup < ParentGroup
123
+ def bar
124
+ "bar"
125
+ end
126
+
127
+ public_command :foo, :baz
128
+ end
@@ -0,0 +1,118 @@
1
+ class A < Thor
2
+ include Thor::Actions
3
+
4
+ desc "one", "invoke one"
5
+ def one
6
+ p 1
7
+ invoke :two
8
+ invoke :three
9
+ end
10
+
11
+ desc "two", "invoke two"
12
+ def two
13
+ p 2
14
+ invoke :three
15
+ end
16
+
17
+ desc "three", "invoke three"
18
+ def three
19
+ p 3
20
+ end
21
+
22
+ desc "four", "invoke four"
23
+ def four
24
+ p 4
25
+ invoke "defined:five"
26
+ end
27
+
28
+ desc "five N", "check if number is equal 5"
29
+ def five(number)
30
+ number == 5
31
+ end
32
+
33
+ desc "invoker", "invoke a b command"
34
+ def invoker(*args)
35
+ invoke :b, :one, ["Jose"]
36
+ end
37
+ end
38
+
39
+ class B < Thor
40
+ class_option :last_name, :type => :string
41
+
42
+ desc "one FIRST_NAME", "invoke one"
43
+ def one(first_name)
44
+ "#{options.last_name}, #{first_name}"
45
+ end
46
+
47
+ desc "two", "invoke two"
48
+ def two
49
+ options
50
+ end
51
+
52
+ desc "three", "invoke three"
53
+ def three
54
+ self
55
+ end
56
+
57
+ desc "four", "invoke four"
58
+ option :defaulted_value, :type => :string, :default => 'default'
59
+ def four
60
+ options.defaulted_value
61
+ end
62
+ end
63
+
64
+ class C < Thor::Group
65
+ include Thor::Actions
66
+
67
+ def one
68
+ p 1
69
+ end
70
+
71
+ def two
72
+ p 2
73
+ end
74
+
75
+ def three
76
+ p 3
77
+ end
78
+ end
79
+
80
+ class Defined < Thor::Group
81
+ class_option :unused, :type => :boolean, :desc => "This option has no use"
82
+
83
+ def one
84
+ p 1
85
+ invoke "a:two"
86
+ invoke "a:three"
87
+ invoke "a:four"
88
+ invoke "defined:five"
89
+ end
90
+
91
+ def five
92
+ p 5
93
+ end
94
+
95
+ def print_status
96
+ say_status :finished, :counting
97
+ end
98
+ end
99
+
100
+ class E < Thor::Group
101
+ invoke Defined
102
+ end
103
+
104
+ class F < Thor::Group
105
+ invoke "b:one" do |instance, klass, command|
106
+ instance.invoke klass, command, [ "Jose" ], :last_name => "Valim"
107
+ end
108
+ end
109
+
110
+ class G < Thor::Group
111
+ class_option :invoked, :type => :string, :default => "defined"
112
+ invoke_from_option :invoked
113
+ end
114
+
115
+ class H < Thor::Group
116
+ class_option :defined, :type => :boolean, :default => true
117
+ invoke_from_option :defined
118
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ exit 0