rake-subproject 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Yjg0MTViNTE2YWNmOThkOGU0NGQ0NDA4MzA4ZmU3M2Q4MTVjOWU5Ng==
5
+ data.tar.gz: !binary |-
6
+ OGQzOThhYjRjNjllZGI4OTNlNDg0Yzk5NzkwNjg1MjQ2ZWU3NzYyNQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTZlMGQ1ZTczMjhiNTNhMWViOTRjYzY1OGZjMWQ3NWQ4ZDcyNzhmMjU1Nzdk
10
+ NTMyMGNkYTlmZTI0YjQ3MTFkMmQ2YzU1OTRjMTg5MzRiNDBiMThjNTU5ZTVk
11
+ YWMwY2EwMzY0OTQyYmQxYTRmNzA4YTIzMGU1ZTBjOWIzYjlkMDg=
12
+ data.tar.gz: !binary |-
13
+ NGMwNTNkOTBhZDg3OGEwYzFiZmUwODU4YWQzODE3MTU1ZWI3YjUwZjRmYzhj
14
+ ODVhZThjYTk1NTM5MzM3YWM3ZDVlMzc5OTAxM2QwNGE0OTRkMTkzYjk5YjMx
15
+ NTYzMDdkMTdjN2VhZGNkZTg1YWIzNTI2ODdjMzlmMDM0MjBiN2U=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rake-subproject.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,27 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rake-subproject (0.0.1)
5
+ rake
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.5)
11
+ rake (10.2.0)
12
+ rspec (2.14.1)
13
+ rspec-core (~> 2.14.0)
14
+ rspec-expectations (~> 2.14.0)
15
+ rspec-mocks (~> 2.14.0)
16
+ rspec-core (2.14.8)
17
+ rspec-expectations (2.14.5)
18
+ diff-lcs (>= 1.1.3, < 2.0)
19
+ rspec-mocks (2.14.6)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.5)
26
+ rake-subproject!
27
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Michael Bishop
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Rake::Subproject
2
+
3
+ If you have a project for which you've built a Rakefile and it includes a subproject
4
+ which has its own Rakefile, you can 'bridge' the subproject into the super project
5
+ with a single line: 'subproject(dir)'. With this in place, all the subproject's
6
+ tasks can be called in the super project.
7
+
8
+ Here's what it looks like:
9
+
10
+ ### Rakefile
11
+
12
+ ```ruby
13
+ require 'rake/subproject'
14
+
15
+ subproject 'foo'
16
+
17
+ task :clean => 'foo:clean'
18
+
19
+ task :default => ['foo/bar', 'foo:bar:baz']
20
+ ```
21
+
22
+ ### foo/Rakefile
23
+
24
+ ```ruby
25
+ require 'rake/clean'
26
+
27
+ file 'bar' do |t|
28
+ touch t.name
29
+ end
30
+
31
+ CLEAN.include 'bar'
32
+
33
+ namespace 'bar' do
34
+ task 'baz' do
35
+ $stdout.puts "SUCCESS"
36
+ end
37
+ end
38
+ ```
39
+
40
+ Now, let's execute the top-level Rakefile **twice**:
41
+
42
+ ```
43
+ $ find .
44
+ .
45
+ ./foo
46
+ ./foo/Rakefile
47
+ ./Rakefile
48
+ $ rake
49
+ touch bar
50
+ SUCCESS
51
+ $ find .
52
+ .
53
+ ./foo
54
+ ./foo/bar
55
+ ./foo/Rakefile
56
+ ./Rakefile
57
+ $ rake
58
+ SUCCESS
59
+ $ rake clean
60
+ $ rake
61
+ touch bar
62
+ SUCCESS
63
+ $ rake foo:bar:baz
64
+ SUCCESS
65
+ ```
66
+
67
+ There are some interesting things to observe:
68
+
69
+ 1. The task `foo/bar` was only executed the first time because:
70
+
71
+ 1. It was a FileTask and
72
+ 2. the first time created it so the second time it was skipped
73
+
74
+ 2. The namespace `foo:` passes through to the subproject and calls the
75
+ task locally there.
76
+
77
+ 3. The file `bar` is created relative to the *subproject* even though we are calling
78
+ it from the *super-project*
79
+
80
+ 4. The `:clean` task is bridged into the subproject's `:clean` task
81
+ 5. We can directly call `foo:bar:baz` from the command-line
82
+
83
+ ## Installation
84
+
85
+ Add this line to your application's Gemfile:
86
+
87
+ gem 'rake-subproject'
88
+
89
+ And then execute:
90
+
91
+ $ bundle
92
+
93
+ Or install it yourself as:
94
+
95
+ $ gem install rake-subproject
96
+
97
+ ## Usage
98
+
99
+ TODO: Write usage instructions here
100
+
101
+ ## Contributing
102
+
103
+ 1. Fork it ( http://github.com/<my-github-username>/rake-subproject/fork )
104
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
105
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
106
+ 4. Push to the branch (`git push origin my-new-feature`)
107
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ require 'rake'
2
+
3
+ require 'rake/subproject/task_manager'
4
+ require 'rake/subproject/ext/application'
5
+ require 'rake/subproject/ext/dsl'
@@ -0,0 +1,5 @@
1
+ module Rake
2
+ class Application
3
+ prepend Subproject::TaskManager
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Rake::DSL
2
+ def subproject(path)
3
+ Rake.application.define_subproject(path)
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require "rake/subproject/version"
2
+
3
+ module Rake::Subproject::TaskManager
4
+ class RakeRunner
5
+ include FileUtils
6
+
7
+ def run(*args)
8
+ ruby '-S', 'rake', *args
9
+ end
10
+ end
11
+
12
+ def define_subproject(path)
13
+ subprojects << path
14
+ subproject_semaphores[path] ||= Mutex.new
15
+ end
16
+
17
+ def subprojects
18
+ @subprojects ||= Set.new
19
+ end
20
+
21
+ def [](task_name, scopes=nil)
22
+ self.lookup(task_name, scopes) or
23
+ subprojects.each do |subproject|
24
+ task_name.match /^#{subproject}[\/\:](.*)/ do |md|
25
+ return Rake::Task.define_task task_name do |t|
26
+ subproject_semaphores[subproject].synchronize do
27
+ RakeRunner.new.run md[1], {chdir: subproject}, {verbose: false}
28
+ end
29
+ end
30
+ end
31
+ end
32
+ super
33
+ end
34
+ private
35
+
36
+ def subproject_semaphores
37
+ @subproject_semaphores ||= {}.extend(MonitorMixin)
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module Rake
2
+ module Subproject
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rake/subproject/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rake-subproject"
8
+ spec.version = Rake::Subproject::VERSION
9
+ spec.authors = ["Michael Bishop"]
10
+ spec.email = ["mbtyke@gmail.com"]
11
+ spec.summary = "Allows bridging of sub-projects into super-projects"
12
+ # spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "rake"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rspec"
25
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ include Rake::DSL
4
+
5
+ describe Rake::Subproject do
6
+ it 'should have a version number' do
7
+ Rake::Subproject::VERSION.should_not be_nil
8
+ end
9
+
10
+ it 'should do something useful' do
11
+ false.should eq(true)
12
+ end
13
+
14
+ it "accepts the #subproject call" do
15
+ subproject('test')
16
+ end
17
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'rake/subproject'
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-subproject
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Bishop
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - mbtyke@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - Gemfile
63
+ - Gemfile.lock
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/rake/subproject.rb
68
+ - lib/rake/subproject/ext/application.rb
69
+ - lib/rake/subproject/ext/dsl.rb
70
+ - lib/rake/subproject/task_manager.rb
71
+ - lib/rake/subproject/version.rb
72
+ - rake-subproject.gemspec
73
+ - spec/rake/subproject_spec.rb
74
+ - spec/spec_helper.rb
75
+ homepage: ''
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.2.2
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Allows bridging of sub-projects into super-projects
99
+ test_files:
100
+ - spec/rake/subproject_spec.rb
101
+ - spec/spec_helper.rb