fpm 0.2.25 → 0.2.26
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/bin/fpm +7 -0
- data/lib/fpm/builder.rb +2 -1
- data/lib/fpm/flags.rb +20 -0
- data/lib/fpm/source/gem.rb +19 -3
- metadata +6 -5
data/bin/fpm
CHANGED
@@ -8,11 +8,15 @@ require "erb"
|
|
8
8
|
|
9
9
|
$: << "#{File.dirname(__FILE__)}/../lib"
|
10
10
|
require "fpm"
|
11
|
+
require "fpm/flags"
|
11
12
|
|
12
13
|
def main(args)
|
13
14
|
settings = OpenStruct.new
|
14
15
|
settings.exclude = []
|
15
16
|
|
17
|
+
# Source-specific settings/flags go here.
|
18
|
+
settings.source = {}
|
19
|
+
|
16
20
|
# Maintainer scripts - https://github.com/jordansissel/fpm/issues/18
|
17
21
|
settings.scripts ||= {}
|
18
22
|
|
@@ -125,6 +129,9 @@ def main(args)
|
|
125
129
|
end # --url
|
126
130
|
end # OptionParser
|
127
131
|
|
132
|
+
# Add extra flags.
|
133
|
+
FPM::Source::Gem.flags(FPM::Flags.new(opts, "gem", "gem source only"), settings)
|
134
|
+
|
128
135
|
opts.parse!(args)
|
129
136
|
|
130
137
|
ok = true
|
data/lib/fpm/builder.rb
CHANGED
data/lib/fpm/flags.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "fpm/namespace"
|
2
|
+
|
3
|
+
class FPM::Flags
|
4
|
+
def initialize(opts, flag_prefix, help_prefix)
|
5
|
+
@opts = opts
|
6
|
+
@flag_prefix = flag_prefix
|
7
|
+
@help_prefix = help_prefix
|
8
|
+
end # def initialize
|
9
|
+
|
10
|
+
def on(*args, &block)
|
11
|
+
fixed_args = args.collect do |arg|
|
12
|
+
if arg =~ /^--/
|
13
|
+
"--#{@flag_prefix}-#{arg.gsub(/^--/, "")}"
|
14
|
+
else
|
15
|
+
"(#{@help_prefix}) #{arg}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
@opts.on(*fixed_args, &block)
|
19
|
+
end # def on
|
20
|
+
end # class FPM::Flags
|
data/lib/fpm/source/gem.rb
CHANGED
@@ -5,6 +5,13 @@ require "rubygems"
|
|
5
5
|
require "fileutils"
|
6
6
|
|
7
7
|
class FPM::Source::Gem < FPM::Source
|
8
|
+
def self.flags(opts, settings)
|
9
|
+
opts.on("--bin-path DIRECTORY",
|
10
|
+
"The directory to install gem executables") do |path|
|
11
|
+
settings.source[:bin_path] = path
|
12
|
+
end
|
13
|
+
end # def flags
|
14
|
+
|
8
15
|
def get_source(params)
|
9
16
|
gem = @paths.first
|
10
17
|
looks_like_name_re = /^[A-Za-z0-9_-]+$/
|
@@ -102,17 +109,26 @@ class FPM::Source::Gem < FPM::Source
|
|
102
109
|
if self[:prefix]
|
103
110
|
installdir = "#{tmpdir}/#{self[:prefix]}"
|
104
111
|
# TODO(sissel): Overwriting @paths is bad mojo and confusing...
|
112
|
+
# Maybe we shouldn't?
|
105
113
|
@paths = [ self[:prefix] ]
|
106
114
|
else
|
107
|
-
installdir =
|
115
|
+
installdir = File.join(tmpdir, ::Gem::dir)
|
108
116
|
@paths = [ ::Gem::dir ]
|
109
117
|
end
|
118
|
+
|
110
119
|
::FileUtils.mkdir_p(installdir)
|
111
120
|
args = ["gem", "install", "--quiet", "--no-ri", "--no-rdoc",
|
112
|
-
"--install-dir", installdir, "--ignore-dependencies"
|
121
|
+
"--install-dir", installdir, "--ignore-dependencies"]
|
122
|
+
if self[:settings][:bin_path]
|
123
|
+
args += ["--bindir", File.join(tmpdir, self[:settings][:bin_path])]
|
124
|
+
@paths << self[:settings][:bin_path]
|
125
|
+
end
|
126
|
+
|
127
|
+
args << gem
|
113
128
|
system(*args)
|
114
129
|
|
115
|
-
|
130
|
+
# make paths relative (/foo becomes ./foo)
|
131
|
+
tar(tar_path, @paths.collect {|p| ".#{p}"}, tmpdir)
|
116
132
|
FileUtils.rm_r(tmpdir)
|
117
133
|
|
118
134
|
# TODO(sissel): Make a helper method.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 35
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 26
|
10
|
+
version: 0.2.26
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-17 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/rpm/header.rb
|
49
49
|
- lib/rpm/rpmfile.rb
|
50
50
|
- lib/fpm/builder.rb
|
51
|
+
- lib/fpm/flags.rb
|
51
52
|
- lib/fpm/namespace.rb
|
52
53
|
- lib/fpm/source.rb
|
53
54
|
- lib/fpm/rubyfixes.rb
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
requirements: []
|
100
101
|
|
101
102
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.5.1
|
103
104
|
signing_key:
|
104
105
|
specification_version: 3
|
105
106
|
summary: fpm - package building and mangling
|