packager 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ require 'rake/tasklib'
3
3
  require 'erb'
4
4
  require 'rbconfig'
5
5
  require 'packager'
6
+ require 'packager/version'
6
7
 
7
8
  module Packager
8
9
  module Rake
@@ -77,17 +78,44 @@ module Packager
77
78
  rm_rf "#{short_package_name}-pkg"
78
79
  rm_rf package_name
79
80
  rm "#{package_name}.pkg", :force => true
80
- rm_rf ".bundle"
81
81
 
82
- unless ENV['PREBUNDLED']
82
+ begin
83
+ # :force => true doesn't seem to work
84
+ mv ".bundle", ".bundle.bak" rescue nil
83
85
  rm_rf "bundle"
84
86
  Bundler.with_clean_env do
85
- sh 'bundle --standalone --without development'
87
+ # MEGAHAX!!!!
88
+ # When bundler is run from within a shell out, it calls Bundler.setup
89
+ # too early. This means that the GEM_HOME gets set incorrectly and the
90
+ # standalone bundle is not built properly
91
+ original_rubyopt = ENV['RUBYOPT']
92
+ begin
93
+ ENV['RUBYOPT'] = original_rubyopt.sub("-rbundler/setup", '')
94
+ sh 'bundle --standalone --without development'
95
+ ensure
96
+ ENV['RUBYOPT'] = original_rubyopt
97
+ end
86
98
  end
99
+ rescue Exception => e
100
+ puts e.class
101
+ raise e
102
+ ensure
103
+ rm_rf ".bundle"
104
+ # :force => true doesn't seem to work
105
+ mv ".bundle.bak", ".bundle" rescue nil
87
106
  end
88
107
 
89
108
  mkdir_p "#{package_name}/local/#{short_package_name}"
90
- cp_r "bundle", "#{package_name}/local/#{short_package_name}/"
109
+ mv "bundle", "#{package_name}/local/#{short_package_name}/"
110
+
111
+ # Inject packager enviroment information
112
+ setup_path = "#{package_name}/local/#{short_package_name}/bundle/bundler/setup.rb"
113
+ setup_data = File.read(setup_path)
114
+ File.open(setup_path, 'w') do |file|
115
+ # Programs can use this env var to know if they are running in the package or not
116
+ file.puts "ENV['RUBY_PACKAGER'] = '#{Packager::VERSION}'"
117
+ file.puts setup_data
118
+ end
91
119
 
92
120
  verbose(false) do
93
121
  Dir.chdir("#{package_name}/local/#{short_package_name}/bundle/ruby/1.9.1") do
@@ -1,4 +1,4 @@
1
1
  module Packager
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-20 00:00:00.000000000Z
13
+ date: 2011-08-24 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
- requirement: &70243012290200 !ruby/object:Gem::Requirement
17
+ requirement: &70243143033800 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 1.1.pre.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70243012290200
25
+ version_requirements: *70243143033800
26
26
  description: A tool for creating a standalone Mac OS X .pkg of your gem.
27
27
  email:
28
28
  - wycats@gmail.com
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: 1.3.6
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.6
65
+ rubygems_version: 1.8.8
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: Packager your gem for Mac OS X