rake_subdir 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in subrakr.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rake_subdir (0.1.0)
5
+ colorize
6
+ em_pessimistic
7
+ eventmachine
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ colorize (0.6.0)
13
+ em_pessimistic (0.2.0)
14
+ eventmachine (~> 1.0)
15
+ eventmachine (1.0.3)
16
+ rake (10.1.0)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ bundler (~> 1.3)
23
+ rake
24
+ rake_subdir!
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 AkaiBureido
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,55 @@
1
+ # rake_subdir
2
+
3
+ Rucursive gem invocation, so that chained execution of Rakefiles is possible. Much like with "make -C".
4
+
5
+
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'rake_subdir'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rake_subdir
20
+
21
+ ## Usage
22
+
23
+ The usage is fairly straightforward in your Rakefile you can now call function
24
+ ```ruby
25
+ rake_subdir "dir_path" => "tasks"
26
+ ```
27
+
28
+ It will automatically pick up the Rakefile in that directory and will execute given tasks on it.
29
+
30
+ Example:
31
+ ```ruby
32
+ require 'rake_subdir'
33
+
34
+ task :default => [:build]
35
+ task :build do
36
+ rake_subdir 'somedir'
37
+ end
38
+
39
+ task :clean do
40
+ rake_subdir 'somedir' => 'clean'
41
+ end
42
+ ```
43
+
44
+ Output Example:
45
+
46
+ ![Output Example](http://i.imgur.com/UJAwb6t.png)
47
+
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,57 @@
1
+ require 'rake_subdir/version'
2
+ require 'em_pessimistic'
3
+ require 'eventmachine'
4
+ require 'colorize'
5
+
6
+ $exit_status = 0
7
+ $stderr.sync = true
8
+ $stdout.sync = true
9
+
10
+ module Rake
11
+ module DSL
12
+ module StdErrSync
13
+ def receive_data data
14
+ puts data.gsub(/^/,' ') unless data.empty?
15
+ end
16
+ def receive_stderr data
17
+ puts data.gsub(/^/,' ') unless data.empty?
18
+ end
19
+ def unbind
20
+ $exit_status = get_status.exitstatus
21
+ EventMachine.stop
22
+ end
23
+ end
24
+
25
+ def rake_subdir(dirs)
26
+ o = Rake.application.options
27
+ options = []
28
+ options.push "--trace" if o.trace
29
+ options.push "--silent" if o.silent
30
+ options.push "--ignore-deprecate" if o.ignore_deprecate
31
+
32
+ option_string = options.join(" ")
33
+
34
+ dirs = { dirs => '' } if dirs.class == String
35
+ dirs.each_pair do |dir, tasks|
36
+ subrakefile = (Pathname.new(dir) + 'Rakefile').to_s
37
+ raise "Error #{subrakefile} does not exist" unless File.exists?(subrakefile)
38
+ Dir.chdir(dir) do
39
+ puts "*> Execute [#{subrakefile}] (#{tasks}) {#{option_string}}".green
40
+ # out = %x{rake #{tasks} 2>&1}
41
+ # puts out.gsub(/^/,' ') unless out.empty?
42
+ # raise "Error while executing (#{tasks}) in [#{subrakefile}]" if $?.exitstatus != 0
43
+ EventMachine.run do
44
+ EventMachine.add_shutdown_hook {
45
+ raise "Error while executing [#{subrakefile}] (#{tasks})" if $exit_status != 0
46
+ }
47
+
48
+ EMPessimistic.popen3("rake #{tasks} #{option_string}" , StdErrSync)
49
+ end
50
+ end
51
+ end
52
+ rescue StandardError => e
53
+ puts e
54
+ exit(1)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module RakeSubdir
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rake_subdir/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rake_subdir"
8
+ spec.version = RakeSubdir::VERSION
9
+ spec.authors = ["Oleg Utkin"]
10
+ spec.email = ["utkin.oleg@me.com"]
11
+ spec.description = %q{Rucursive gem invocation}
12
+ spec.summary = %q{Rucursive gem invocation, so that chained execution of Rakefiles is possible. Much like with "make -C".}
13
+ spec.homepage = "http://github.com/AkaiBureido/rake_subdir"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "eventmachine"
25
+ spec.add_runtime_dependency "em_pessimistic"
26
+ spec.add_runtime_dependency "colorize"
27
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake_subdir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Oleg Utkin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: eventmachine
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: em_pessimistic
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: colorize
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Rucursive gem invocation
95
+ email:
96
+ - utkin.oleg@me.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - .gitignore
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - LICENSE.txt
105
+ - README.md
106
+ - Rakefile
107
+ - lib/rake_subdir.rb
108
+ - lib/rake_subdir/version.rb
109
+ - rake_subdir.gemspec
110
+ homepage: http://github.com/AkaiBureido/rake_subdir
111
+ licenses:
112
+ - MIT
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ segments:
124
+ - 0
125
+ hash: -3995966025457519631
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ segments:
133
+ - 0
134
+ hash: -3995966025457519631
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 1.8.24
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Rucursive gem invocation, so that chained execution of Rakefiles is possible.
141
+ Much like with "make -C".
142
+ test_files: []