arake 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/arake.gemspec +18 -0
  2. data/bin/arake +81 -0
  3. metadata +90 -0
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'arake'
3
+ s.version = `git describe --always --tags --dirty`
4
+ s.summary = 'Run rake automatically whenever any dependent is updated.'
5
+
6
+ s.authors = ['Kana Natsuno']
7
+ s.email = ['kana@whileimautomaton.n3t']
8
+ s.homepage = 'http://github.com/kana/ruby-arake'
9
+
10
+ s.required_ruby_version = '>= 1.9.2'
11
+ s.required_rubygems_version = '>= 1.6.2'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.executables = s.files.select{|f| f =~ /^bin/}.map{|f| f.sub /^bin/, ''}
15
+ s.add_runtime_dependency 'rake', '>= 0.8.7'
16
+ s.add_runtime_dependency 'watchr', '>= 0.7'
17
+ s.add_development_dependency 'rspec', '>= 2.5.1'
18
+ end
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rake'
4
+ require 'watchr'
5
+
6
+
7
+
8
+
9
+ class ARake
10
+ attr_accessor :accumulated_args
11
+
12
+ def initialize(top_level_self)
13
+ @top_level_self = top_level_self
14
+ @accumulated_args = []
15
+
16
+ hook_task_definition
17
+ end
18
+
19
+ def hook_task_definition
20
+ a = self
21
+ (class << @top_level_self; self; end).class_eval do
22
+ include Rake::TaskManager
23
+
24
+ # FIXME: How about other rake tasks?
25
+ define_method :file do |*args, &block|
26
+ super *args, &block
27
+ a.accumulate_args *resolve_args(args), &block
28
+ end
29
+ end
30
+ end
31
+
32
+ def accumulate_args(*args, &block)
33
+ @accumulated_args.push [*args, block]
34
+ end
35
+
36
+ def create_custom_watchr
37
+ a = self
38
+ s = Watchr::Script.new
39
+ (class << s; self; end).class_eval do
40
+ define_method :parse! do
41
+ @ec.instance_eval do
42
+ a.accumulated_args.each do |pattern, arg_names, deps, block|
43
+ p deps
44
+ deps.each do |d|
45
+ watch "^#{Regexp.escape d}$", &block
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ Watchr::Controller.new(s, Watchr.handler.new)
52
+ end
53
+
54
+ def load_rakefiles
55
+ RakeApplicationWrapper.new.run
56
+ end
57
+
58
+ def run
59
+ load_rakefiles
60
+ watchr = create_custom_watchr
61
+ watchr.run
62
+ end
63
+ end
64
+
65
+ class RakeApplicationWrapper < Rake::Application
66
+ def run
67
+ standard_exception_handling do
68
+ init
69
+ load_rakefile
70
+ # Don't run top_level at first. Because all tasks are automatically run
71
+ # whenever dependents are updated.
72
+ end
73
+ end
74
+ end
75
+
76
+
77
+
78
+
79
+ ARake.new(self).run
80
+
81
+ __END__
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arake
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Kana Natsuno
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-04 00:00:00 +09:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.8.7
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: watchr
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0.7"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.5.1
47
+ type: :development
48
+ version_requirements: *id003
49
+ description:
50
+ email:
51
+ - kana@whileimautomaton.n3t
52
+ executables:
53
+ - /arake
54
+ extensions: []
55
+
56
+ extra_rdoc_files: []
57
+
58
+ files:
59
+ - arake.gemspec
60
+ - bin/arake
61
+ has_rdoc: true
62
+ homepage: http://github.com/kana/ruby-arake
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.9.2
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.6.2
82
+ requirements: []
83
+
84
+ rubyforge_project:
85
+ rubygems_version: 1.6.2
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Run rake automatically whenever any dependent is updated.
89
+ test_files: []
90
+