packager 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/packager/rake_task.rb +26 -5
- data/lib/packager/version.rb +1 -1
- metadata +2 -2
data/lib/packager/rake_task.rb
CHANGED
@@ -27,11 +27,14 @@ module Packager
|
|
27
27
|
|
28
28
|
attr_accessor :bin_files
|
29
29
|
|
30
|
+
attr_accessor :resource_files
|
31
|
+
|
30
32
|
def initialize(name=:pkg)
|
31
33
|
@name = name
|
32
34
|
@group = :packager
|
33
35
|
@domain = 'gemcutter.org'
|
34
36
|
@bin_files = []
|
37
|
+
@resource_files = []
|
35
38
|
@package_name, @short_package_name = nil
|
36
39
|
|
37
40
|
yield self if block_given?
|
@@ -45,7 +48,8 @@ module Packager
|
|
45
48
|
namespace group do
|
46
49
|
bundle_file_task
|
47
50
|
lib_file_task
|
48
|
-
|
51
|
+
bin_files_task
|
52
|
+
resource_files_task
|
49
53
|
make_pkg_task
|
50
54
|
rm_task
|
51
55
|
directory_tasks
|
@@ -179,22 +183,39 @@ module Packager
|
|
179
183
|
end
|
180
184
|
end
|
181
185
|
|
182
|
-
def
|
183
|
-
|
186
|
+
def bin_files_task
|
187
|
+
bin_files.each do |bin_name|
|
184
188
|
file "#{package_name}/bin/#{bin_name}" => "bin/#{bin_name}" do
|
185
|
-
|
189
|
+
data = File.read("bin/#{bin_name}").sub(/\A#.*/, "#!/usr/local/ruby1.9/bin/ruby -I /usr/local/#{short_package_name}/bundle -r bundler/setup")
|
186
190
|
|
187
191
|
sh "mkdir -p #{package_name}/bin"
|
188
|
-
File.open("#{package_name}/bin/#{bin_name}", "w") { |file| file.puts
|
192
|
+
File.open("#{package_name}/bin/#{bin_name}", "w") { |file| file.puts data }
|
189
193
|
File.chmod 0755, "#{package_name}/bin/#{bin_name}"
|
190
194
|
end
|
191
195
|
end
|
192
196
|
end
|
193
197
|
|
198
|
+
def resource_files_task
|
199
|
+
resource_files.each do |resource_name|
|
200
|
+
file "#{package_name}/local/#{short_package_name}/#{resource_name}" => resource_name do
|
201
|
+
destdir = "#{package_name}/local/#{short_package_name}/#{File.dirname(resource_name)}"
|
202
|
+
sh "mkdir -p #{destdir}"
|
203
|
+
sh "cp -R #{resource_name} #{destdir}"
|
204
|
+
target = "#{package_name}/local/#{short_package_name}/#{resource_name}"
|
205
|
+
if File.directory?(target)
|
206
|
+
Dir.glob(target).each{|f| File.chmod 0655 unless File.directory?(f) }
|
207
|
+
else
|
208
|
+
File.chmod 0644, target
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
194
214
|
def make_pkg_task
|
195
215
|
pkg_tasks = ["#{package_name}/local/#{short_package_name}/bundle",
|
196
216
|
"#{package_name}/local/#{short_package_name}/lib"]
|
197
217
|
pkg_tasks += bin_files.map{|b| "#{package_name}/bin/#{b}" }
|
218
|
+
pkg_tasks += resource_files.map{|r| "#{package_name}/local/#{short_package_name}/#{r}" }
|
198
219
|
|
199
220
|
task :make_pkg => pkg_tasks
|
200
221
|
end
|
data/lib/packager/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: packager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Yehuda Katz
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-05-
|
14
|
+
date: 2011-05-08 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|