make-rubygem-debs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/make-rubygem-debs +51 -0
- data/lib/make-rubygem-debs.rb +75 -0
- metadata +48 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
# Copyright (c) 2012, Christopher Mark Gore,
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# 8729 Lower Marine Road, Saint Jacob, Illinois 62281 USA.
|
8
|
+
# Web: http://www.cgore.com
|
9
|
+
# Email: cgore@cgore.com
|
10
|
+
#
|
11
|
+
# Redistribution and use in source and binary forms, with or without
|
12
|
+
# modification, are permitted provided that the following conditions are met:
|
13
|
+
#
|
14
|
+
# * Redistributions of source code must retain the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer.
|
16
|
+
#
|
17
|
+
# * Redistributions in binary form must reproduce the above copyright
|
18
|
+
# notice, this list of conditions and the following disclaimer in the
|
19
|
+
# documentation and/or other materials provided with the distribution.
|
20
|
+
#
|
21
|
+
# * Neither the name of Christopher Mark Gore nor the names of other
|
22
|
+
# contributors may be used to endorse or promote products derived from
|
23
|
+
# this software without specific prior written permission.
|
24
|
+
#
|
25
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
26
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
27
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
28
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
29
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
30
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
31
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
32
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
33
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
34
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
35
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
36
|
+
|
37
|
+
|
38
|
+
if RUBY_VERSION < "1.9"
|
39
|
+
raise RuntimeError, "Your version of Ruby is too old!"
|
40
|
+
end
|
41
|
+
|
42
|
+
require_relative '/home/chris/make-rubygem-debs/lib/make-rubygem-debs'
|
43
|
+
|
44
|
+
if __FILE__ == $PROGRAM_NAME
|
45
|
+
topdir = if not ARGV.empty?
|
46
|
+
ARGV[0]
|
47
|
+
else
|
48
|
+
Dir.pwd
|
49
|
+
end
|
50
|
+
MakeRubygemDebs::make_rubygem_debs topdir
|
51
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Copyright (c) 2012, Christopher Mark Gore,
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# 8729 Lower Marine Road, Saint Jacob, Illinois 62281 USA.
|
5
|
+
# Web: http://www.cgore.com
|
6
|
+
# Email: cgore@cgore.com
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions are met:
|
10
|
+
#
|
11
|
+
# * Redistributions of source code must retain the above copyright
|
12
|
+
# notice, this list of conditions and the following disclaimer.
|
13
|
+
#
|
14
|
+
# * Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
#
|
18
|
+
# * Neither the name of Christopher Mark Gore nor the names of other
|
19
|
+
# contributors may be used to endorse or promote products derived from
|
20
|
+
# this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
|
34
|
+
|
35
|
+
if RUBY_VERSION < "1.9"
|
36
|
+
raise RuntimeError, "Your version of Ruby is too old!"
|
37
|
+
end
|
38
|
+
|
39
|
+
module MakeRubygemDebs
|
40
|
+
def self.gem_executable_presence_check executable, gem = executable
|
41
|
+
result = `which #{executable}`
|
42
|
+
if result.empty?
|
43
|
+
raise RuntimeError, "Please install #{gem}, try `gem install #{gem}`."
|
44
|
+
end
|
45
|
+
return result
|
46
|
+
end
|
47
|
+
|
48
|
+
FPM = gem_executable_presence_check 'fpm'
|
49
|
+
BUNDLE = gem_executable_presence_check 'bundle', 'bundler'
|
50
|
+
|
51
|
+
def self.make_rubygem_debs topdir
|
52
|
+
gems = Dir.chdir topdir do
|
53
|
+
`bundle list`.split("\n")[1..-1].map do |line|
|
54
|
+
name, version = line.split[1..2]
|
55
|
+
[name, version[1..-2]]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
debdir = "#{topdir}/rubygem-debs"
|
59
|
+
`mkdir -p "#{debdir}"`
|
60
|
+
Dir.chdir debdir do
|
61
|
+
gems.each do |name, version|
|
62
|
+
puts "Trying to make a .deb for #{name} #{version} ..."
|
63
|
+
`fpm -s gem -t deb -v #{version} #{name}`
|
64
|
+
deb_name = name.gsub "_", "-"
|
65
|
+
deb_file = "rubygem-#{deb_name}_#{version}"
|
66
|
+
deb = Dir.entries(debdir).select {|file| file.match deb_file}
|
67
|
+
if not deb.empty?
|
68
|
+
puts "Successfully created #{deb[0]}."
|
69
|
+
else
|
70
|
+
raise RuntimeError, "Failed to a .deb for #{name} #{version}."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: make-rubygem-debs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christopher Mark Gore
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A simple script to generate .debs for all of the gems in a Bundler-enabled
|
15
|
+
RoR app, using fpm.
|
16
|
+
email: cgore@cgore.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/make-rubygem-debs.rb
|
22
|
+
- bin/make-rubygem-debs
|
23
|
+
homepage: http://rubygems.org/gems/make-rubygem-debs
|
24
|
+
licenses: []
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 1.8.11
|
44
|
+
signing_key:
|
45
|
+
specification_version: 3
|
46
|
+
summary: A simple script to generate .debs for all of the gems in a Bundler-enabled
|
47
|
+
RoR app, using fpm.
|
48
|
+
test_files: []
|