do_riak 0.10.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Gemfile +9 -0
- data/LICENSE +20 -0
- data/README.textile +23 -0
- data/TODO.txt +4 -0
- data/deps.rip +8 -0
- data/do_riak.gemspec +40 -0
- data/do_riak.pre.gemspec +8 -0
- data/gems/cache/bacon-1.1.0.gem +0 -0
- data/gems/cache/code-cleaner-0.8.1.gem +0 -0
- data/gems/cache/nake-0.0.8.gem +0 -0
- data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/gems/environment.rb +107 -0
- data/gems/gems/bacon-1.1.0/COPYING +18 -0
- data/gems/gems/bacon-1.1.0/ChangeLog +220 -0
- data/gems/gems/bacon-1.1.0/RDOX +69 -0
- data/gems/gems/bacon-1.1.0/README +290 -0
- data/gems/gems/bacon-1.1.0/Rakefile +138 -0
- data/gems/gems/bacon-1.1.0/bin/bacon +117 -0
- data/gems/gems/bacon-1.1.0/lib/autotest/bacon.rb +36 -0
- data/gems/gems/bacon-1.1.0/lib/autotest/bacon_rspec.rb +2 -0
- data/gems/gems/bacon-1.1.0/lib/autotest/discover.rb +9 -0
- data/gems/gems/bacon-1.1.0/lib/bacon.rb +354 -0
- data/gems/gems/bacon-1.1.0/test/spec_bacon.rb +374 -0
- data/gems/gems/bacon-1.1.0/test/spec_should.rb +32 -0
- data/gems/gems/code-cleaner-0.8.1/LICENSE +20 -0
- data/gems/gems/code-cleaner-0.8.1/README.textile +87 -0
- data/gems/gems/code-cleaner-0.8.1/TODO.txt +1 -0
- data/gems/gems/code-cleaner-0.8.1/bin/code-cleaner +143 -0
- data/gems/gems/code-cleaner-0.8.1/code-cleaner-0.8.gem +0 -0
- data/gems/gems/code-cleaner-0.8.1/code-cleaner.gemspec +25 -0
- data/gems/gems/code-cleaner-0.8.1/support/pre-commit.erb +70 -0
- data/gems/gems/code-cleaner-0.8.1/tasks.rb +13 -0
- data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.nake +49 -0
- data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.rake +22 -0
- data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.thor +35 -0
- data/gems/gems/nake-0.0.8/CHANGELOG +48 -0
- data/gems/gems/nake-0.0.8/LICENSE +20 -0
- data/gems/gems/nake-0.0.8/README.textile +39 -0
- data/gems/gems/nake-0.0.8/TODO.txt +23 -0
- data/gems/gems/nake-0.0.8/bin/nake +66 -0
- data/gems/gems/nake-0.0.8/bin/nrake +4 -0
- data/gems/gems/nake-0.0.8/bin/rake2nake +1 -0
- data/gems/gems/nake-0.0.8/bin/snake +41 -0
- data/gems/gems/nake-0.0.8/bm/Rakefile +28 -0
- data/gems/gems/nake-0.0.8/bm/bms.rb +56 -0
- data/gems/gems/nake-0.0.8/bm/output.txt +5 -0
- data/gems/gems/nake-0.0.8/bm/tasks.rb +21 -0
- data/gems/gems/nake-0.0.8/bm/tmp/test.c +6 -0
- data/gems/gems/nake-0.0.8/bm/tmp/www/index.html +1 -0
- data/gems/gems/nake-0.0.8/deps.rb +5 -0
- data/gems/gems/nake-0.0.8/deps.rip +5 -0
- data/gems/gems/nake-0.0.8/examples/arguments.rb +38 -0
- data/gems/gems/nake-0.0.8/examples/basic.rb +5 -0
- data/gems/gems/nake-0.0.8/examples/boot.rb +18 -0
- data/gems/gems/nake-0.0.8/examples/complex.rb +9 -0
- data/gems/gems/nake-0.0.8/examples/configuration.rb +15 -0
- data/gems/gems/nake-0.0.8/examples/default.rb +10 -0
- data/gems/gems/nake-0.0.8/examples/default_proc.rb +11 -0
- data/gems/gems/nake-0.0.8/examples/dependencies.rb +10 -0
- data/gems/gems/nake-0.0.8/examples/description.rb +33 -0
- data/gems/gems/nake-0.0.8/examples/file.rb +22 -0
- data/gems/gems/nake-0.0.8/examples/helpers.rb +3 -0
- data/gems/gems/nake-0.0.8/examples/invoking.rb +14 -0
- data/gems/gems/nake-0.0.8/examples/rules.rb +0 -0
- data/gems/gems/nake-0.0.8/examples/script.rb +20 -0
- data/gems/gems/nake-0.0.8/examples/task_arguments.rb +27 -0
- data/gems/gems/nake-0.0.8/features/arguments.feature +22 -0
- data/gems/gems/nake-0.0.8/features/basic.feature +6 -0
- data/gems/gems/nake-0.0.8/features/boot.feature +5 -0
- data/gems/gems/nake-0.0.8/features/builtin_arguments.feature +14 -0
- data/gems/gems/nake-0.0.8/features/complex.feature +6 -0
- data/gems/gems/nake-0.0.8/features/configuration.feature +10 -0
- data/gems/gems/nake-0.0.8/features/default.feature +10 -0
- data/gems/gems/nake-0.0.8/features/default_proc.feature +6 -0
- data/gems/gems/nake-0.0.8/features/dependencies.feature +16 -0
- data/gems/gems/nake-0.0.8/features/description.feature +0 -0
- data/gems/gems/nake-0.0.8/features/env.rb +11 -0
- data/gems/gems/nake-0.0.8/features/executable.feature +29 -0
- data/gems/gems/nake-0.0.8/features/file.feature +23 -0
- data/gems/gems/nake-0.0.8/features/helpers.feature +6 -0
- data/gems/gems/nake-0.0.8/features/invoking.feature +14 -0
- data/gems/gems/nake-0.0.8/features/rules.feature +0 -0
- data/gems/gems/nake-0.0.8/features/script.feature +10 -0
- data/gems/gems/nake-0.0.8/features/steps.rb +39 -0
- data/gems/gems/nake-0.0.8/features/task_arguments.feature +10 -0
- data/gems/gems/nake-0.0.8/lib/nake.rb +103 -0
- data/gems/gems/nake-0.0.8/lib/nake/abstract_task.rb +175 -0
- data/gems/gems/nake-0.0.8/lib/nake/args.rb +65 -0
- data/gems/gems/nake-0.0.8/lib/nake/argv.rb +47 -0
- data/gems/gems/nake-0.0.8/lib/nake/colors.rb +22 -0
- data/gems/gems/nake-0.0.8/lib/nake/dsl.rb +70 -0
- data/gems/gems/nake-0.0.8/lib/nake/file_task.rb +62 -0
- data/gems/gems/nake-0.0.8/lib/nake/helpers.rb +65 -0
- data/gems/gems/nake-0.0.8/lib/nake/rake.rb +38 -0
- data/gems/gems/nake-0.0.8/lib/nake/rule.rb +35 -0
- data/gems/gems/nake-0.0.8/lib/nake/struct_hash.rb +22 -0
- data/gems/gems/nake-0.0.8/lib/nake/task.rb +6 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/bundle.rb +30 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/clean.rb +12 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/gem.rb +29 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/release.rb +43 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/rip.rb +33 -0
- data/gems/gems/nake-0.0.8/lib/nake/tasks/spec.rb +20 -0
- data/gems/gems/nake-0.0.8/lib/nake/template.rb +51 -0
- data/gems/gems/nake-0.0.8/nake-0.0.8.pre.gem +0 -0
- data/gems/gems/nake-0.0.8/nake.gemspec +42 -0
- data/gems/gems/nake-0.0.8/nake.pre.gemspec +8 -0
- data/gems/gems/nake-0.0.8/spec/nake/abstract_task_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/args_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/argv_spec.rb +51 -0
- data/gems/gems/nake-0.0.8/spec/nake/colors_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/dsl_spec.rb +35 -0
- data/gems/gems/nake-0.0.8/spec/nake/file_task_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/helpers_spec.rb +14 -0
- data/gems/gems/nake-0.0.8/spec/nake/rake_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/rule_spec.rb +72 -0
- data/gems/gems/nake-0.0.8/spec/nake/struct_hash_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/task_spec.rb +72 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/bundle_spec.rb +28 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/clean_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/gem_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/release_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/rip_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks/spec_spec.rb +0 -0
- data/gems/gems/nake-0.0.8/spec/nake/tasks_spec.rb +48 -0
- data/gems/gems/nake-0.0.8/spec/nake/template_spec.rb +84 -0
- data/gems/gems/nake-0.0.8/spec/nake_spec.rb +9 -0
- data/gems/gems/nake-0.0.8/spec/spec.opts +5 -0
- data/gems/gems/nake-0.0.8/spec/spec_helper.rb +29 -0
- data/gems/gems/nake-0.0.8/spec/stubs/database.yml.erb +9 -0
- data/gems/gems/nake-0.0.8/spec/stubs/database.yml.tt +9 -0
- data/gems/gems/nake-0.0.8/tasks.rb +42 -0
- data/gems/gems/term-ansicolor-1.0.4/CHANGES +22 -0
- data/gems/gems/term-ansicolor-1.0.4/COPYING +340 -0
- data/gems/gems/term-ansicolor-1.0.4/README +31 -0
- data/gems/gems/term-ansicolor-1.0.4/Rakefile +86 -0
- data/gems/gems/term-ansicolor-1.0.4/VERSION +1 -0
- data/gems/gems/term-ansicolor-1.0.4/doc-main.txt +119 -0
- data/gems/gems/term-ansicolor-1.0.4/examples/cdiff.rb +19 -0
- data/gems/gems/term-ansicolor-1.0.4/examples/example.rb +89 -0
- data/gems/gems/term-ansicolor-1.0.4/install.rb +15 -0
- data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor.rb +102 -0
- data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor/version.rb +10 -0
- data/gems/gems/term-ansicolor-1.0.4/term-ansicolor.gemspec +20 -0
- data/gems/specifications/bacon-1.1.0.gemspec +30 -0
- data/gems/specifications/code-cleaner-0.8.1.gemspec +31 -0
- data/gems/specifications/nake-0.0.8.gemspec +35 -0
- data/gems/specifications/term-ansicolor-1.0.4.gemspec +30 -0
- data/lib/do_riak.rb +10 -0
- data/lib/do_riak/errors.rb +11 -0
- data/lib/do_riak/transaction.rb +24 -0
- data/lib/do_riak/version.rb +7 -0
- data/script/bacon +3 -0
- data/script/code-cleaner +3 -0
- data/script/nake +3 -0
- data/spec/command_spec.rb +8 -0
- data/spec/connection_spec.rb +17 -0
- data/spec/reader_spec.rb +8 -0
- data/spec/result_spec.rb +12 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/typecast/array_spec.rb +8 -0
- data/spec/typecast/bigdecimal_spec.rb +8 -0
- data/spec/typecast/boolean_spec.rb +8 -0
- data/spec/typecast/byte_array_spec.rb +8 -0
- data/spec/typecast/class_spec.rb +8 -0
- data/spec/typecast/date_spec.rb +8 -0
- data/spec/typecast/datetime_spec.rb +8 -0
- data/spec/typecast/float_spec.rb +12 -0
- data/spec/typecast/integer_spec.rb +8 -0
- data/spec/typecast/nil_spec.rb +16 -0
- data/spec/typecast/other_spec.rb +8 -0
- data/spec/typecast/range_spec.rb +8 -0
- data/spec/typecast/string_spec.rb +8 -0
- data/spec/typecast/time_spec.rb +8 -0
- data/tasks.rb +37 -0
- 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,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,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,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,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,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"
|