do_riak 0.10.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/CHANGELOG +2 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +20 -0
  4. data/README.textile +23 -0
  5. data/TODO.txt +4 -0
  6. data/deps.rip +8 -0
  7. data/do_riak.gemspec +40 -0
  8. data/do_riak.pre.gemspec +8 -0
  9. data/gems/cache/bacon-1.1.0.gem +0 -0
  10. data/gems/cache/code-cleaner-0.8.1.gem +0 -0
  11. data/gems/cache/nake-0.0.8.gem +0 -0
  12. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  13. data/gems/environment.rb +107 -0
  14. data/gems/gems/bacon-1.1.0/COPYING +18 -0
  15. data/gems/gems/bacon-1.1.0/ChangeLog +220 -0
  16. data/gems/gems/bacon-1.1.0/RDOX +69 -0
  17. data/gems/gems/bacon-1.1.0/README +290 -0
  18. data/gems/gems/bacon-1.1.0/Rakefile +138 -0
  19. data/gems/gems/bacon-1.1.0/bin/bacon +117 -0
  20. data/gems/gems/bacon-1.1.0/lib/autotest/bacon.rb +36 -0
  21. data/gems/gems/bacon-1.1.0/lib/autotest/bacon_rspec.rb +2 -0
  22. data/gems/gems/bacon-1.1.0/lib/autotest/discover.rb +9 -0
  23. data/gems/gems/bacon-1.1.0/lib/bacon.rb +354 -0
  24. data/gems/gems/bacon-1.1.0/test/spec_bacon.rb +374 -0
  25. data/gems/gems/bacon-1.1.0/test/spec_should.rb +32 -0
  26. data/gems/gems/code-cleaner-0.8.1/LICENSE +20 -0
  27. data/gems/gems/code-cleaner-0.8.1/README.textile +87 -0
  28. data/gems/gems/code-cleaner-0.8.1/TODO.txt +1 -0
  29. data/gems/gems/code-cleaner-0.8.1/bin/code-cleaner +143 -0
  30. data/gems/gems/code-cleaner-0.8.1/code-cleaner-0.8.gem +0 -0
  31. data/gems/gems/code-cleaner-0.8.1/code-cleaner.gemspec +25 -0
  32. data/gems/gems/code-cleaner-0.8.1/support/pre-commit.erb +70 -0
  33. data/gems/gems/code-cleaner-0.8.1/tasks.rb +13 -0
  34. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.nake +49 -0
  35. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.rake +22 -0
  36. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.thor +35 -0
  37. data/gems/gems/nake-0.0.8/CHANGELOG +48 -0
  38. data/gems/gems/nake-0.0.8/LICENSE +20 -0
  39. data/gems/gems/nake-0.0.8/README.textile +39 -0
  40. data/gems/gems/nake-0.0.8/TODO.txt +23 -0
  41. data/gems/gems/nake-0.0.8/bin/nake +66 -0
  42. data/gems/gems/nake-0.0.8/bin/nrake +4 -0
  43. data/gems/gems/nake-0.0.8/bin/rake2nake +1 -0
  44. data/gems/gems/nake-0.0.8/bin/snake +41 -0
  45. data/gems/gems/nake-0.0.8/bm/Rakefile +28 -0
  46. data/gems/gems/nake-0.0.8/bm/bms.rb +56 -0
  47. data/gems/gems/nake-0.0.8/bm/output.txt +5 -0
  48. data/gems/gems/nake-0.0.8/bm/tasks.rb +21 -0
  49. data/gems/gems/nake-0.0.8/bm/tmp/test.c +6 -0
  50. data/gems/gems/nake-0.0.8/bm/tmp/www/index.html +1 -0
  51. data/gems/gems/nake-0.0.8/deps.rb +5 -0
  52. data/gems/gems/nake-0.0.8/deps.rip +5 -0
  53. data/gems/gems/nake-0.0.8/examples/arguments.rb +38 -0
  54. data/gems/gems/nake-0.0.8/examples/basic.rb +5 -0
  55. data/gems/gems/nake-0.0.8/examples/boot.rb +18 -0
  56. data/gems/gems/nake-0.0.8/examples/complex.rb +9 -0
  57. data/gems/gems/nake-0.0.8/examples/configuration.rb +15 -0
  58. data/gems/gems/nake-0.0.8/examples/default.rb +10 -0
  59. data/gems/gems/nake-0.0.8/examples/default_proc.rb +11 -0
  60. data/gems/gems/nake-0.0.8/examples/dependencies.rb +10 -0
  61. data/gems/gems/nake-0.0.8/examples/description.rb +33 -0
  62. data/gems/gems/nake-0.0.8/examples/file.rb +22 -0
  63. data/gems/gems/nake-0.0.8/examples/helpers.rb +3 -0
  64. data/gems/gems/nake-0.0.8/examples/invoking.rb +14 -0
  65. data/gems/gems/nake-0.0.8/examples/rules.rb +0 -0
  66. data/gems/gems/nake-0.0.8/examples/script.rb +20 -0
  67. data/gems/gems/nake-0.0.8/examples/task_arguments.rb +27 -0
  68. data/gems/gems/nake-0.0.8/features/arguments.feature +22 -0
  69. data/gems/gems/nake-0.0.8/features/basic.feature +6 -0
  70. data/gems/gems/nake-0.0.8/features/boot.feature +5 -0
  71. data/gems/gems/nake-0.0.8/features/builtin_arguments.feature +14 -0
  72. data/gems/gems/nake-0.0.8/features/complex.feature +6 -0
  73. data/gems/gems/nake-0.0.8/features/configuration.feature +10 -0
  74. data/gems/gems/nake-0.0.8/features/default.feature +10 -0
  75. data/gems/gems/nake-0.0.8/features/default_proc.feature +6 -0
  76. data/gems/gems/nake-0.0.8/features/dependencies.feature +16 -0
  77. data/gems/gems/nake-0.0.8/features/description.feature +0 -0
  78. data/gems/gems/nake-0.0.8/features/env.rb +11 -0
  79. data/gems/gems/nake-0.0.8/features/executable.feature +29 -0
  80. data/gems/gems/nake-0.0.8/features/file.feature +23 -0
  81. data/gems/gems/nake-0.0.8/features/helpers.feature +6 -0
  82. data/gems/gems/nake-0.0.8/features/invoking.feature +14 -0
  83. data/gems/gems/nake-0.0.8/features/rules.feature +0 -0
  84. data/gems/gems/nake-0.0.8/features/script.feature +10 -0
  85. data/gems/gems/nake-0.0.8/features/steps.rb +39 -0
  86. data/gems/gems/nake-0.0.8/features/task_arguments.feature +10 -0
  87. data/gems/gems/nake-0.0.8/lib/nake.rb +103 -0
  88. data/gems/gems/nake-0.0.8/lib/nake/abstract_task.rb +175 -0
  89. data/gems/gems/nake-0.0.8/lib/nake/args.rb +65 -0
  90. data/gems/gems/nake-0.0.8/lib/nake/argv.rb +47 -0
  91. data/gems/gems/nake-0.0.8/lib/nake/colors.rb +22 -0
  92. data/gems/gems/nake-0.0.8/lib/nake/dsl.rb +70 -0
  93. data/gems/gems/nake-0.0.8/lib/nake/file_task.rb +62 -0
  94. data/gems/gems/nake-0.0.8/lib/nake/helpers.rb +65 -0
  95. data/gems/gems/nake-0.0.8/lib/nake/rake.rb +38 -0
  96. data/gems/gems/nake-0.0.8/lib/nake/rule.rb +35 -0
  97. data/gems/gems/nake-0.0.8/lib/nake/struct_hash.rb +22 -0
  98. data/gems/gems/nake-0.0.8/lib/nake/task.rb +6 -0
  99. data/gems/gems/nake-0.0.8/lib/nake/tasks/bundle.rb +30 -0
  100. data/gems/gems/nake-0.0.8/lib/nake/tasks/clean.rb +12 -0
  101. data/gems/gems/nake-0.0.8/lib/nake/tasks/gem.rb +29 -0
  102. data/gems/gems/nake-0.0.8/lib/nake/tasks/release.rb +43 -0
  103. data/gems/gems/nake-0.0.8/lib/nake/tasks/rip.rb +33 -0
  104. data/gems/gems/nake-0.0.8/lib/nake/tasks/spec.rb +20 -0
  105. data/gems/gems/nake-0.0.8/lib/nake/template.rb +51 -0
  106. data/gems/gems/nake-0.0.8/nake-0.0.8.pre.gem +0 -0
  107. data/gems/gems/nake-0.0.8/nake.gemspec +42 -0
  108. data/gems/gems/nake-0.0.8/nake.pre.gemspec +8 -0
  109. data/gems/gems/nake-0.0.8/spec/nake/abstract_task_spec.rb +0 -0
  110. data/gems/gems/nake-0.0.8/spec/nake/args_spec.rb +0 -0
  111. data/gems/gems/nake-0.0.8/spec/nake/argv_spec.rb +51 -0
  112. data/gems/gems/nake-0.0.8/spec/nake/colors_spec.rb +0 -0
  113. data/gems/gems/nake-0.0.8/spec/nake/dsl_spec.rb +35 -0
  114. data/gems/gems/nake-0.0.8/spec/nake/file_task_spec.rb +0 -0
  115. data/gems/gems/nake-0.0.8/spec/nake/helpers_spec.rb +14 -0
  116. data/gems/gems/nake-0.0.8/spec/nake/rake_spec.rb +0 -0
  117. data/gems/gems/nake-0.0.8/spec/nake/rule_spec.rb +72 -0
  118. data/gems/gems/nake-0.0.8/spec/nake/struct_hash_spec.rb +0 -0
  119. data/gems/gems/nake-0.0.8/spec/nake/task_spec.rb +72 -0
  120. data/gems/gems/nake-0.0.8/spec/nake/tasks/bundle_spec.rb +28 -0
  121. data/gems/gems/nake-0.0.8/spec/nake/tasks/clean_spec.rb +0 -0
  122. data/gems/gems/nake-0.0.8/spec/nake/tasks/gem_spec.rb +0 -0
  123. data/gems/gems/nake-0.0.8/spec/nake/tasks/release_spec.rb +0 -0
  124. data/gems/gems/nake-0.0.8/spec/nake/tasks/rip_spec.rb +0 -0
  125. data/gems/gems/nake-0.0.8/spec/nake/tasks/spec_spec.rb +0 -0
  126. data/gems/gems/nake-0.0.8/spec/nake/tasks_spec.rb +48 -0
  127. data/gems/gems/nake-0.0.8/spec/nake/template_spec.rb +84 -0
  128. data/gems/gems/nake-0.0.8/spec/nake_spec.rb +9 -0
  129. data/gems/gems/nake-0.0.8/spec/spec.opts +5 -0
  130. data/gems/gems/nake-0.0.8/spec/spec_helper.rb +29 -0
  131. data/gems/gems/nake-0.0.8/spec/stubs/database.yml.erb +9 -0
  132. data/gems/gems/nake-0.0.8/spec/stubs/database.yml.tt +9 -0
  133. data/gems/gems/nake-0.0.8/tasks.rb +42 -0
  134. data/gems/gems/term-ansicolor-1.0.4/CHANGES +22 -0
  135. data/gems/gems/term-ansicolor-1.0.4/COPYING +340 -0
  136. data/gems/gems/term-ansicolor-1.0.4/README +31 -0
  137. data/gems/gems/term-ansicolor-1.0.4/Rakefile +86 -0
  138. data/gems/gems/term-ansicolor-1.0.4/VERSION +1 -0
  139. data/gems/gems/term-ansicolor-1.0.4/doc-main.txt +119 -0
  140. data/gems/gems/term-ansicolor-1.0.4/examples/cdiff.rb +19 -0
  141. data/gems/gems/term-ansicolor-1.0.4/examples/example.rb +89 -0
  142. data/gems/gems/term-ansicolor-1.0.4/install.rb +15 -0
  143. data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor.rb +102 -0
  144. data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor/version.rb +10 -0
  145. data/gems/gems/term-ansicolor-1.0.4/term-ansicolor.gemspec +20 -0
  146. data/gems/specifications/bacon-1.1.0.gemspec +30 -0
  147. data/gems/specifications/code-cleaner-0.8.1.gemspec +31 -0
  148. data/gems/specifications/nake-0.0.8.gemspec +35 -0
  149. data/gems/specifications/term-ansicolor-1.0.4.gemspec +30 -0
  150. data/lib/do_riak.rb +10 -0
  151. data/lib/do_riak/errors.rb +11 -0
  152. data/lib/do_riak/transaction.rb +24 -0
  153. data/lib/do_riak/version.rb +7 -0
  154. data/script/bacon +3 -0
  155. data/script/code-cleaner +3 -0
  156. data/script/nake +3 -0
  157. data/spec/command_spec.rb +8 -0
  158. data/spec/connection_spec.rb +17 -0
  159. data/spec/reader_spec.rb +8 -0
  160. data/spec/result_spec.rb +12 -0
  161. data/spec/spec_helper.rb +19 -0
  162. data/spec/typecast/array_spec.rb +8 -0
  163. data/spec/typecast/bigdecimal_spec.rb +8 -0
  164. data/spec/typecast/boolean_spec.rb +8 -0
  165. data/spec/typecast/byte_array_spec.rb +8 -0
  166. data/spec/typecast/class_spec.rb +8 -0
  167. data/spec/typecast/date_spec.rb +8 -0
  168. data/spec/typecast/datetime_spec.rb +8 -0
  169. data/spec/typecast/float_spec.rb +12 -0
  170. data/spec/typecast/integer_spec.rb +8 -0
  171. data/spec/typecast/nil_spec.rb +16 -0
  172. data/spec/typecast/other_spec.rb +8 -0
  173. data/spec/typecast/range_spec.rb +8 -0
  174. data/spec/typecast/string_spec.rb +8 -0
  175. data/spec/typecast/time_spec.rb +8 -0
  176. data/tasks.rb +37 -0
  177. metadata +238 -0
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ./bin/nake
2
+
3
+ # File tasks doesn't have any options or arguments,
4
+ # because if you have some setup which may generate
5
+ # each time different file, than the whole machinery
6
+ # for recognization if given task should run is useless.
7
+ # Of course you may want to use task for generating
8
+ # a file with arguments and options, but then just
9
+ # use a normal task helper or Task.new method.
10
+
11
+ directory "tmp"
12
+ directory "tmp/www"
13
+
14
+ file("tmp/restart.txt", "tmp") do |path|
15
+ touch path
16
+ end
17
+
18
+ file("tmp/www/index.html", "tmp/www") do |path|
19
+ File.open(path, "w") do |file|
20
+ file.puts("<html>Hello World!</html>")
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ./bin/nake
2
+
3
+ task(:greet) { sh "echo Hey from shell!" }.description = "Greeting from shell"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ./bin/nake
2
+
3
+ task(:inspect) do |*args, options|
4
+ puts "Arguments: #{args.inspect}"
5
+ puts "Options: #{options.inspect}"
6
+ end
7
+
8
+ task(:foo) do
9
+ Task[:inspect].call
10
+ end
11
+
12
+ task(:bar) do |*args, options|
13
+ Task[:inspect].call(*args, options)
14
+ end
File without changes
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby --disable-gems
2
+
3
+ # This file shows how to run Nake from API. In most of cases you don't
4
+ # need this and you might want to use just shebang with env, but this
5
+ # might come handy if you need to pass some arguments for Ruby.
6
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
7
+
8
+ require "nake"
9
+
10
+ # task definitions
11
+ task("greet:all") do
12
+ puts "Hey guys!"
13
+ end
14
+
15
+ # run nake
16
+ begin
17
+ Nake.run(ARGV)
18
+ rescue TaskNotFound => exception
19
+ abort "[#{"ERROR".red}] #{exception.message}"
20
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ./bin/nake
2
+
3
+ task(:greet) do |user, options| # FIXME: this doesn't work if you don't specify any args
4
+ puts "Hi #{user}!"
5
+ end
6
+
7
+ task(:greet) do |user = ENV["USER"], options|
8
+ puts "Hi #{user}!"
9
+ end
10
+
11
+ # ./examples/task_arguments.rb greet:options
12
+ # ./examples/task_arguments.rb greet:options --name=botanicus
13
+ # ./examples/task_arguments.rb greet:options foo bar --name=botanicus
14
+ task("greet:options") do |*, options|
15
+ raise ArgumentError, "You have to specify --name=#{ENV["USER"]}" if options.empty?
16
+ puts "Hi #{options[:name]}!"
17
+ end
18
+
19
+ ## ./examples/task_arguments.rb greet:options --name=botanicus
20
+ #task("greet:options") do |user, options|
21
+ # case options[:type]
22
+ # when :friendly
23
+ # puts "Hi mate!"
24
+ # else
25
+ # puts "Hi #{user}!"
26
+ # end
27
+ #end
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Arguments
4
+ Scenario: Simple argument
5
+ When I run "./examples/arguments.rb --report greet"
6
+ Then it should show "Hey mate!"
7
+ And it should succeed with "Running task greet took [\d.]+ seconds"
8
+
9
+ Scenario: Argument taking options
10
+ When I run "./examples/arguments.rb --debug greet"
11
+ Then it should show "Setting debug to true"
12
+ And it should suceed with "Hey mate!"
13
+
14
+ Scenario: Argument taking options
15
+ When I run "./examples/arguments.rb --no-debug greet"
16
+ Then it should show "Setting debug to false"
17
+ And it should suceed with "Hey mate!"
18
+
19
+ Scenario: Arguments should be able to influence task execution
20
+ When I run "./examples/arguments.rb --tasks greet"
21
+ Then it should not show "Hey mate!"
22
+ And it should suceed with "Available tasks: tasks, greet, wait"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task arguments
4
+ Scenario: run the example
5
+ When I run "./examples/basic.rb greet"
6
+ Then it should succeed with "Hi botanicus!"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task initialization process
4
+ Scenario: XXX
5
+ Given this is pending
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task arguments
4
+ Scenario: running -H or --help
5
+ When I run "./examples/basic.rb greet"
6
+ Then it should succeed with "Hi botanicus!"
7
+
8
+ Scenario: running -T or --tasks
9
+ When I run "./examples/basic.rb greet"
10
+ Then it should succeed with "Hi botanicus!"
11
+
12
+ Scenario: running -i or --interactive
13
+ When I run "./examples/basic.rb greet"
14
+ Then it should succeed with "Hi botanicus!"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task arguments
4
+ Scenario: XXX
5
+ Given this is pending
6
+ When I run "./examples/complex.rb"
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task configuration
4
+ Scenario: explicit arguments
5
+ Given this is pending
6
+ When I run "./examples/configuration.rb"
7
+
8
+ Scenario: default arguments
9
+ Given this is pending
10
+ When I run "./examples/configuration.rb"
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Default
4
+ Scenario: explicit arguments
5
+ Given this is pending
6
+ When I run "./examples/default.rb"
7
+
8
+ Scenario: default arguments
9
+ Given this is pending
10
+ When I run "./examples/default.rb"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Default proc
4
+ Scenario: XXX
5
+ Given this is pending
6
+ When I run "./examples/default_proc.rb greet"
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task dependencies
4
+ # it should show dependencies as well
5
+ Scenario: inspecting with -T
6
+ Given this is pending
7
+
8
+ Scenario: Invoking task with dependencies which doesn't run yet
9
+ When I run "./examples/dependencies.rb greet3"
10
+ Then it should show "~ Invoking task greet1"
11
+ And it should show "~ Invoking task greet2"
12
+ And it should show "~ Invoking task greet3"
13
+ And it should succeed
14
+
15
+ Scenario: Invoking task with dependencies which already run
16
+ Given this is pending
File without changes
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require "spec"
4
+ require "fileutils"
5
+
6
+ # just for ensuring the tests will pass on all machines
7
+ ENV["USER"] = "botanicus"
8
+
9
+ After do
10
+ FileUtils.rm_rf "tmp"
11
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ # ./bin/nake -T
4
+ # ./bin/nake --verbose -T
5
+ # ./examples/flags.rb --verbose
6
+ Feature: Running bin/nake
7
+ Scenario: Running bin/nake without any arguments
8
+ When I run "./bin/nake"
9
+ Then it should fail with "You have to specify a task you want to run!"
10
+
11
+ Scenario: Running bin/nake with a file, but without any arguments
12
+ When I run "./bin/nake examples/task_arguments.rb"
13
+ Then it should fail with "You have to specify a task you want to run!"
14
+
15
+ Scenario: Running bin/nake with a task
16
+ When I run "./bin/nake examples/task_arguments.rb greet"
17
+ Then it should succeed with "Hi botanicus"
18
+
19
+ Scenario: Running bin/nake with a task and arguments
20
+ When I run "./bin/nake examples/task_arguments.rb greet Jakub"
21
+ Then it should succeed with "Hi Jakub"
22
+
23
+ Scenario: Running task file with shebang to nake with a task
24
+ When I run "./examples/task_arguments.rb greet Jakub"
25
+ Then it should succeed with "Hi Jakub"
26
+
27
+ Scenario: Scenario: Running task file with shebang to nake with a task and arguments
28
+ When I run "./examples/task_arguments.rb greet Jakub"
29
+ Then it should succeed with "Hi Jakub"
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: File tasks
4
+ Scenario: running -T
5
+ When I run "./examples/file.rb -T"
6
+ Then it should not show "tmp/www"
7
+ And it should show "tmp/restart.txt"
8
+
9
+ Scenario: using directory helper
10
+ When I run "./examples/file.rb tmp/www"
11
+ Then it should create "tmp/www"
12
+ And it should succeed
13
+
14
+ Scenario: using file helper
15
+ When I run "./examples/file.rb tmp/restart.txt"
16
+ Then it should create "tmp/restart.txt"
17
+ And it should succeed
18
+
19
+ Scenario: using file helper when the target file already exist
20
+ Given this is pending
21
+
22
+ Scenario: using file helper when the target file already exist but is older than its dependencies
23
+ Given this is pending
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Helpers
4
+ Scenario: Using sh helper
5
+ When I run "./examples/helpers.rb greet"
6
+ Then it should succeed with "Hey from shell!"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Invoking tasks
4
+ Scenario: without arguments
5
+ When I run "./examples/invoking.rb foo"
6
+ Then it should show "Arguments: []"
7
+ And it should show "Options: {}"
8
+ And it should suceed
9
+
10
+ Scenario: with arguments
11
+ When I run "./examples/invoking.rb foo bar a b --name=botanicus"
12
+ Then it should show "Arguments: ["a", "b"]"
13
+ And it should show "Options: {:name=>botanicus}"
14
+ And it should suceed
File without changes
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Using Nake API for custom scripts
4
+ Scenario: running default tasks
5
+ When I run "./examples/script.rb -T"
6
+ Then it should succeed with "Available tasks"
7
+
8
+ Scenario: running custom tasks
9
+ When I run "./examples/script.rb greet:all"
10
+ Then it should succeed with "Hi guys!"
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+
3
+ require "open3"
4
+
5
+ # http://redmine.ruby-lang.org/issues/show/1287
6
+ When /^I run "([^\"]*)"$/ do |command|
7
+ _, @stdout, @stderr, thread = Open3.popen3(command)
8
+ @status = thread.value.exitstatus
9
+ end
10
+
11
+ Then /^it should show "([^\"]*)"$/ do |pattern|
12
+ @stdout.read.should_not match(pattern)
13
+ end
14
+
15
+ Then /^it should not show "([^\"]*)"$/ do |pattern|
16
+ @stdout.read.should_not match(pattern)
17
+ end
18
+
19
+ Then /^it should succeed$/ do
20
+ @status.should eql(0)
21
+ end
22
+
23
+ Then /^it should suceed with "([^\"]*)"$/ do |pattern|
24
+ @stdout.read.should match(pattern)
25
+ @status.should eql(0)
26
+ end
27
+
28
+ Then /^it should fail with status "(\d+)"$/ do |status = 0|
29
+ @status.should eql(status.to_i)
30
+ end
31
+
32
+ Then /^it should fail with "([^\"]*)"$/ do |pattern|
33
+ @stderr.read.should match(pattern)
34
+ @status.should_not eql(0)
35
+ end
36
+
37
+ Then /^it should create "([^\"]*)"$/ do |path|
38
+ File.exist?(path).should be_true
39
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env cucumber
2
+
3
+ Feature: Task arguments
4
+ Scenario: explicit arguments
5
+ When I run "./examples/task_arguments.rb greet jakub"
6
+ Then it should succeed with "Hi jakub!"
7
+
8
+ Scenario: default arguments
9
+ When I run "./examples/task_arguments.rb greet"
10
+ Then it should succeed with "Hi botanicus!"
@@ -0,0 +1,103 @@
1
+ # encoding: utf-8
2
+
3
+ module Nake
4
+ VERSION ||= "0.0.8"
5
+ def self.verbose
6
+ @@verbose
7
+ rescue NameError
8
+ @@verbose = true
9
+ end
10
+
11
+ def self.verbose=(boolean)
12
+ @@verbose = boolean
13
+ end
14
+
15
+ def self.debug
16
+ @@debug
17
+ rescue NameError
18
+ @@debug = true
19
+ end
20
+
21
+ def self.debug=(boolean)
22
+ @@debug = boolean
23
+ end
24
+
25
+ def self.coloring
26
+ @@coloring
27
+ rescue NameError
28
+ @@coloring = STDIN.tty?
29
+ end
30
+
31
+ def self.coloring=(boolean)
32
+ @@coloring = boolean
33
+ end
34
+
35
+ # I was drunk so you might found this code not very clear. But it's clear for me and it works.
36
+ def self.args
37
+ @@args ||= begin
38
+ Hash.new.tap do |hash|
39
+ hash.define_singleton_method(:[]) do |name|
40
+ names, value = self.find { |names, block| names.include?(name) }
41
+ return value
42
+ end
43
+
44
+ hash.define_singleton_method(:[]=) do |*names, proc|
45
+ super(names, proc)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ def self.parse(args = ARGV)
52
+ default = {nake: Array.new, task: Array.new}
53
+ args.inject(default) do |hash, argument|
54
+ if argument.match(/^-/) && hash[:task].empty?
55
+ hash[:nake].push(argument)
56
+ elsif File.exist?(argument) && hash[:file].nil? # just the first one
57
+ hash[:file] = argument
58
+ else
59
+ hash[:task].push(argument)
60
+ end
61
+ hash
62
+ end
63
+ end
64
+
65
+ def self.run_args
66
+ # TODO: proceed --debug and --verbose first! ... to by slo tak, ze by se iterovalo pres Nake.args a pokud je to pritomno tak proved
67
+ Nake.parse[:nake].each do |argument|
68
+ unless self.args[argument]
69
+ abort "Unrecognized argument: #{argument}"
70
+ end
71
+ name, value = ArgvParser.parse(argument)
72
+ if name
73
+ info "Invoking argument #{argument} with #{name} = #{value}"
74
+ self.args[argument].call(name, value)
75
+ else
76
+ info "Invoking argument #{argument} without any arguments"
77
+ self.args[argument].call
78
+ end
79
+ end
80
+ end
81
+
82
+ # Run first task
83
+ #
84
+ # @raise [TaskNotFound]
85
+ # @example
86
+ # Nake.run(["release"])
87
+ # @since 0.0.1
88
+ # @author Jakub Stastny
89
+ def self.run_task
90
+ Task.boot
91
+ name, *args = Nake.parse[:task]
92
+ task = Task[name]
93
+ if name.nil?
94
+ raise TaskNotFound, "You have to specify a task you want to run!"
95
+ elsif task.nil?
96
+ raise TaskNotFound, "Task with name #{name} doesn't exist"
97
+ else
98
+ task.run(args)
99
+ end
100
+ end
101
+ end
102
+
103
+ require "nake/task"