rake-namespace_group 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79aba341e59bbcf655d1a368237412972347098b
4
- data.tar.gz: 50ddecb6530fbe868d75e3d621083264d389084b
3
+ metadata.gz: d5098de7128ec747341dec77351798c1ae2fa429
4
+ data.tar.gz: 240b0679488b1e461234dc79a1e5050a88bca314
5
5
  SHA512:
6
- metadata.gz: 83e685abec24b02b412558811579a5930b8530e61975266b16240c89915a621db9383fb62de9e38c55fee08324b3a2433a6df90a77d2d431715ee8a6b83cad54
7
- data.tar.gz: faa0c025cad5fe5d55ebcaac51917dc42a1e61326f61e18723cf987043a0a25ad10c78e2a0bc405bc2c7e3fff7c16590a873e0a5383fb1510acd74f0c94575bc
6
+ metadata.gz: 7ed63946d343ce3a96a6e65b15226229f3159ab486b382596a85ff21a29247632d1038e7455b36c3592e7ea60a68b34df06ef843054109b131eda0df487a3590
7
+ data.tar.gz: e5b0b5939b667089f13d2f5868ab2dcefb3e1c249cbe2e44a802d38996013a8773962e35bab1ab2c1b576f9e4ecf74839d7dbdcd7d9b910630fbd8e8fafa1e1c
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/Rakefile CHANGED
@@ -38,3 +38,10 @@ namespace_group :original do
38
38
  puts "Namespace 'original' task 'bar'"
39
39
  end
40
40
  end
41
+
42
+ namespace_group :arguments, :arguments => :bar do
43
+ desc "Namespace 'arguments' task 'foo'"
44
+ task :foo, :bar, :ext do |task, args|
45
+ puts "Namespace 'arguments' task 'foo' argument: '#{args[:bar]}'"
46
+ end
47
+ end
@@ -22,6 +22,10 @@ module Rake
22
22
  #
23
23
  #
24
24
  def namespace_group(name=nil, options={}, &block)
25
+ if options.is_a?(Symbol) or options.is_a?(Array)
26
+ options = { :arguments => options }
27
+ end
28
+
25
29
  ns_name = options[:namespace] || name
26
30
  ns = namespace(ns_name) do
27
31
  if block_given?
@@ -37,7 +41,7 @@ module Rake
37
41
  tasklist = Rake.application.tasks_in_scope(scope)
38
42
  tasklist.each do |task|
39
43
  if options[:all] or task.is_a?(Rake::GroupTask)
40
- task.invoke(args)
44
+ task.invoke(*args)
41
45
  end
42
46
  end
43
47
  end
@@ -1,5 +1,5 @@
1
1
  module Rake
2
2
  module NamespaceGroup
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -26,4 +26,16 @@ describe 'Rakefile' do
26
26
  Rake::Task[:original].invoke()
27
27
  end
28
28
  end
29
+
30
+ context "namespace arguments" do
31
+ it 'should detect the arguments' do
32
+ expect(Rake::Task[:arguments].arg_names).to eq([:bar])
33
+ expect(Rake::Task['arguments:foo'].arg_names).to eq([:bar, :ext])
34
+ end
35
+
36
+ it 'should pass the arguments' do
37
+ expect($stdout).to receive(:puts).with("Namespace 'arguments' task 'foo' argument: 'xxfoobarxx'")
38
+ Rake::Task[:arguments].invoke('xxfoobarxx')
39
+ end
40
+ end
29
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-namespace_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Vansteenkiste
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - .gitignore
62
63
  - Gemfile
63
64
  - LICENSE.txt
64
65
  - README.md