cwninja-make-gem-now 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -8,4 +8,14 @@ A tool to scan through a whole bunch of checked out repos and build gems for the
8
8
 
9
9
  Simple no?
10
10
 
11
+
12
+ ## Callbacks:
13
+
14
+ Create a `~/.make-gem-now-rc.rb` file and define as many callbacks as you like in it. They can be as simple or as contrived as you like!
15
+
16
+ ### Example
17
+ MakeGemNow::Builder.on_build do |builder|
18
+ puts "I Built #{builder.spec.name} v#{builder.spec.version}"
19
+ end
20
+
11
21
  Now you can run your own github!
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'date'
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = %q{make-gem-now}
10
- s.version = "0.4.1"
10
+ s.version = "0.5.0"
11
11
  s.summary = %q{A tool to build all gems in a given dir, and index them appropriately.}
12
12
  s.description = %q{A tool to build all gems in a given dir, and index them appropriately.}
13
13
 
data/bin/make-gem-now CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.join(File.dirname(__FILE__), *%w[.. lib make_gem_now])
3
3
 
4
- MakeGemNow.make_all(*ARGV)
4
+ require File.expand_path("~/.make-gem-now-rc.rb") if File.exist? File.expand_path("~/.make-gem-now-rc.rb")
5
+ MakeGemNow.make_all(*ARGV)
@@ -37,28 +37,38 @@ module MakeGemNow
37
37
  ! File.exists?(File.join(@output_path, spec.file_name))
38
38
  end
39
39
 
40
+ def self.on_build(&block)
41
+ @on_build_callbacks ||= []
42
+ @on_build_callbacks << Proc.new(&block)
43
+ end
44
+
45
+ def self.do_on_build_callbacks(builder)
46
+ @on_build_callbacks.each do |callback|
47
+ callback.call(builder)
48
+ end
49
+ end
50
+
40
51
  def build!
41
- old_pwd = Dir.pwd
42
- Dir.chdir(File.dirname(@path_to_gemspec))
43
- open File.join(@output_path, spec.file_name), 'wb' do |gem_io|
44
- Gem::Package.open gem_io, 'w', nil do |pkg|
45
- pkg.metadata = spec.to_yaml
46
- spec.files.each do |file|
47
- next if File.directory? file
48
- next if file == spec.file_name # Don't add gem onto itself
52
+ Dir.chdir(File.dirname(@path_to_gemspec)) do
53
+ open File.join(@output_path, spec.file_name), 'wb' do |gem_io|
54
+ Gem::Package.open gem_io, 'w', nil do |pkg|
55
+ pkg.metadata = spec.to_yaml
56
+ spec.files.each do |file|
57
+ next if File.directory? file
58
+ next if file == spec.file_name # Don't add gem onto itself
49
59
 
50
- stat = File.stat file
51
- mode = stat.mode & 0777
52
- size = stat.size
60
+ stat = File.stat file
61
+ mode = stat.mode & 0777
62
+ size = stat.size
53
63
 
54
- pkg.add_file_simple file, mode, size do |tar_io|
55
- tar_io.write open(file, "rb") { |f| f.read }
64
+ pkg.add_file_simple file, mode, size do |tar_io|
65
+ tar_io.write open(file, "rb") { |f| f.read }
66
+ end
56
67
  end
57
68
  end
58
69
  end
59
70
  end
60
- ensure
61
- Dir.chdir(old_pwd)
71
+ self.class.do_on_build_callbacks(self)
62
72
  end
63
73
  end
64
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cwninja-make-gem-now
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Lea
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-08 00:00:00 -07:00
12
+ date: 2009-04-09 00:00:00 -07:00
13
13
  default_executable: make-gem-now
14
14
  dependencies: []
15
15