airake 0.2.7 → 0.2.8

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.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.2.8 2007-11-6
2
+
3
+ * Fixing activesupport dependency
4
+ * Using IO.popen for command runner
5
+ * Fixed runner on windows (using cmd.exe /c)
6
+
1
7
  == 0.2.7 2007-10-24
2
8
 
3
9
  * survived revolutionhealth layoffs
data/Rakefile CHANGED
@@ -5,3 +5,10 @@ Dir['tasks/**/*.rake'].each { |rake| load rake }
5
5
 
6
6
  # Load airake (why not?)
7
7
  require 'lib/airake'
8
+
9
+ task :test_runner do
10
+
11
+ runner = Airake::Runner.new("rake --tasks")
12
+ runner.run
13
+
14
+ end
data/config/hoe.rb CHANGED
@@ -61,7 +61,8 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
61
61
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
62
62
  #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
63
  p.extra_deps = [
64
- ['rubigen','>=1.0.4']
64
+ ['rubigen','>=1.0.4'],
65
+ ['activesupport', '>=1.4.2']
65
66
  ]
66
67
 
67
68
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
data/lib/airake/runner.rb CHANGED
@@ -3,20 +3,59 @@ module Airake #:nodoc:
3
3
  # Runs commands
4
4
  class Runner
5
5
 
6
- class << self
6
+ # Lifted from http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/a274d5d47feae95
7
+ attr_reader :output, :cmd, :took, :process
7
8
 
8
- def fail(cmd, process_status)
9
- raise "[exited=#{process_status.exitstatus}, pid=#{process_status.pid}] Failed to run command: #{cmd}"
10
- end
9
+ def initialize(cmd)
10
+ @cmd = RUBY_PLATFORM =~ /win32/ ? "cmd.exe /c #{cmd}" : cmd
11
+ end
12
+
13
+ def run(verbose = true)
14
+ puts "Running: #{cmd}" if verbose
11
15
 
12
- # Run the command
13
- def run(command, method, *args)
14
- cmd = command.send(method, *args)
15
-
16
- puts "Running: #{cmd}"
17
- system cmd or fail(cmd, $?)
16
+ t1 = Time.now
17
+ IO.popen(@cmd) do |f|
18
+ @output = f.read
19
+ @process = Process.waitpid2(f.pid)[1]
18
20
  end
21
+ @took = Time.now - t1
19
22
 
23
+ if verbose
24
+ puts output
25
+ success? or fail
26
+ puts "Took %.2fs" % [ took ]
27
+ end
28
+ end
29
+
30
+ def fail
31
+ raise <<-EOS
32
+ [exited=#{exit_code}, pid=#{pid}] failed:
33
+
34
+ #{cmd}
35
+
36
+ EOS
37
+ end
38
+
39
+ def run?
40
+ !@process.nil?
41
+ end
42
+
43
+ def exit_code
44
+ @process ? @process.exitstatus : nil
45
+ end
46
+
47
+ def pid
48
+ @process ? @process.pid : nil
49
+ end
50
+
51
+ def success?
52
+ return run? && @process.success?
53
+ end
54
+
55
+ # Run airake command
56
+ def self.run(command, method, *args)
57
+ runner = self.new(command.send(method, *args))
58
+ runner.run
20
59
  end
21
60
 
22
61
  end
@@ -2,7 +2,7 @@ module Airake #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: airake
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.7
7
- date: 2007-11-04 00:00:00 -04:00
6
+ version: 0.2.8
7
+ date: 2007-11-07 00:00:00 -05:00
8
8
  summary: Tasks and generators for Adobe AIR apps
9
9
  require_paths:
10
10
  - lib
@@ -120,3 +120,12 @@ dependencies:
120
120
  - !ruby/object:Gem::Version
121
121
  version: 1.0.4
122
122
  version:
123
+ - !ruby/object:Gem::Dependency
124
+ name: activesupport
125
+ version_requirement:
126
+ version_requirements: !ruby/object:Gem::Version::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 1.4.2
131
+ version: