fpm-cookery 0.9.0 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.10.0 (2012-08-12)
2
+ * Add support for shar and bin files to curl source handler. (brandonmartin)
3
+ * Support an optional basename parameter for the `install` helper.
4
+ * Deprecate public usage of the `install_p` helper.
5
+ * Add license option to the recipe class.
6
+
1
7
  # v0.9.0 (2012-07-21)
2
8
  * Allow architecture specific settings via the `architectures` method.
3
9
  * Unbreak RPM creation on RHEL5. (brandonmartin)
@@ -0,0 +1,43 @@
1
+ require 'fpm/package/dir'
2
+ require 'delegate'
3
+
4
+ module FPM
5
+ module Cookery
6
+ module Package
7
+ class Dir < SimpleDelegator
8
+ def initialize(recipe)
9
+ super(FPM::Package::Dir.new)
10
+
11
+ self.name = recipe.name
12
+ self.url = recipe.homepage || recipe.source
13
+ self.category = recipe.section || 'optional'
14
+ self.description = recipe.description.strip if recipe.description
15
+ self.architecture = recipe.arch.to_s if recipe.arch
16
+
17
+ self.dependencies += recipe.depends
18
+ self.conflicts += recipe.conflicts
19
+ self.provides += recipe.provides
20
+ self.replaces += recipe.replaces
21
+ self.config_files += recipe.config_files
22
+
23
+ attributes[:prefix] = '/'
24
+ attributes[:chdir] = recipe.destdir.to_s
25
+ attributes[:deb_compression] = 'gzip'
26
+ attributes[:rpm_compression] = 'gzip'
27
+ attributes[:rpm_digest] = 'md5'
28
+ attributes[:rpm_user] = 'root'
29
+ attributes[:rpm_group] = 'root'
30
+
31
+ # TODO replace remove_excluded_files() in packager with this.
32
+ attributes[:excludes] = []
33
+
34
+ input('.')
35
+
36
+ # The call to input() overwrites the license and vendor attributes.
37
+ # XXX Needs to be fixed in fpm/package/dir.rb.
38
+ self.license = recipe.license if recipe.license
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -5,7 +5,7 @@ require 'fpm/cookery/utils'
5
5
  require 'fpm/cookery/source_integrity_check'
6
6
  require 'fpm/cookery/path'
7
7
  require 'fpm/cookery/log'
8
- require 'fpm/package/dir'
8
+ require 'fpm/cookery/package/dir'
9
9
  require 'fpm/package/deb'
10
10
  require 'fpm/package/rpm'
11
11
 
@@ -147,36 +147,15 @@ module FPM
147
147
  username && useremail ? "#{username} <#{useremail}>" : nil
148
148
  end
149
149
 
150
- input = FPM::Package::Dir.new
150
+ input = FPM::Cookery::Package::Dir.new(recipe)
151
151
 
152
- input.name = recipe.name
153
152
  input.version = version
154
- input.url = recipe.homepage || recipe.url
155
153
  input.maintainer = maintainer
156
- input.category = recipe.section || 'optional'
157
154
  input.epoch = epoch if epoch
158
- input.description = recipe.description.strip if recipe.description
159
- input.architecture = recipe.arch.to_s if recipe.arch
160
-
161
- input.dependencies += recipe.depends
162
- input.conflicts += recipe.conflicts
163
- input.provides += recipe.provides
164
- input.replaces += recipe.replaces
165
- input.config_files += recipe.config_files
166
155
 
167
156
  add_scripts(recipe, input)
168
157
  remove_excluded_files(recipe)
169
158
 
170
- input.attributes[:prefix] = '/'
171
- input.attributes[:chdir] = recipe.destdir.to_s
172
- input.attributes[:excludes] = [] # TODO replace remove_excluded_files() with this
173
- input.attributes[:rpm_compression] = "gzip"
174
- input.attributes[:rpm_digest] = "md5"
175
- input.attributes[:rpm_user] = "root"
176
- input.attributes[:rpm_group] = "root"
177
-
178
- input.input('.')
179
-
180
159
  output_class = FPM::Package.types[@target]
181
160
 
182
161
  output = input.convert(output_class)
@@ -25,17 +25,19 @@ module FPM
25
25
  FileUtils.mkdir_p(self.to_s)
26
26
  end
27
27
 
28
- def install(src)
28
+ def install(src, new_basename = nil)
29
29
  case src
30
30
  when Array
31
31
  src.collect {|src| install_p(src) }
32
32
  when Hash
33
33
  src.collect {|src, new_basename| install_p(src, new_basename) }
34
34
  else
35
- install_p(src)
35
+ install_p(src, new_basename)
36
36
  end
37
37
  end
38
38
 
39
+ # @deprecated Will be made private in the future.
40
+ # @private
39
41
  def install_p(src, new_basename = nil)
40
42
  if new_basename
41
43
  new_basename = File.basename(new_basename) # rationale: see Pathname.+
@@ -54,7 +54,8 @@ module FPM
54
54
 
55
55
  attr_rw :arch, :description, :homepage, :maintainer, :md5, :name,
56
56
  :revision, :section, :sha1, :sha256, :spec, :vendor, :version,
57
- :pre_install, :post_install, :pre_uninstall, :post_uninstall
57
+ :pre_install, :post_install, :pre_uninstall, :post_uninstall,
58
+ :license
58
59
 
59
60
  attr_rw_list :build_depends, :config_files, :conflicts, :depends,
60
61
  :exclude, :patches, :provides, :replaces
@@ -25,6 +25,9 @@ module FPM
25
25
  case local_path.extname
26
26
  when '.bz2', '.gz', '.tgz'
27
27
  safesystem('tar', 'xf', local_path)
28
+ when '.shar', '.bin'
29
+ File.chmod(0755, local_path)
30
+ safesystem(local_path)
28
31
  when '.zip'
29
32
  safesystem('unzip', '-d', local_path.basename('.zip'), local_path)
30
33
  end
@@ -20,7 +20,7 @@ module FPM
20
20
  # Test cases for individual recipe attributes
21
21
  # are not setting spec before hand (due to delegation chain?)
22
22
  # Additionally, one test actually has options being sent as a String
23
- if ( options.nil? || options.class == String || options.has_key?(:with) == false)
23
+ if (options.nil? || options.class == String || options.has_key?(:with) == false)
24
24
  @source_provider = DEFAULT_HANDLER
25
25
  else
26
26
  @source_provider = options[:with]
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.9.0'
3
+ VERSION = '0.10.0'
4
4
  end
5
5
  end
data/spec/path_spec.rb CHANGED
@@ -119,5 +119,16 @@ describe "Path" do
119
119
  end
120
120
  end
121
121
  end
122
+
123
+ describe "with a new basename argument" do
124
+ it "installs the file with a new basename" do
125
+ Dir.mktmpdir do |dir|
126
+ path = FPM::Cookery::Path.new(dir)
127
+ path.install(File.expand_path('../spec_helper.rb', __FILE__), 'foo.rb')
128
+
129
+ File.exist?(path/'foo.rb').must_equal true
130
+ end
131
+ end
132
+ end
122
133
  end
123
134
  end
data/spec/recipe_spec.rb CHANGED
@@ -67,6 +67,7 @@ describe "Recipe" do
67
67
  spec_recipe_attribute(:arch, 'i386')
68
68
  spec_recipe_attribute(:description, 'A nice program.')
69
69
  spec_recipe_attribute(:homepage, 'http://example.com')
70
+ spec_recipe_attribute(:license, 'MIT')
70
71
  spec_recipe_attribute(:maintainer, 'John Doe <john@example.com>')
71
72
  spec_recipe_attribute(:sha256, '123456789abcdef')
72
73
  spec_recipe_attribute(:sha1, '123456789abcdef')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-cookery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-21 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fpm
@@ -116,6 +116,7 @@ files:
116
116
  - lib/fpm/cookery/log/output/console.rb
117
117
  - lib/fpm/cookery/log/output/console_color.rb
118
118
  - lib/fpm/cookery/log/output/null.rb
119
+ - lib/fpm/cookery/package/dir.rb
119
120
  - lib/fpm/cookery/packager.rb
120
121
  - lib/fpm/cookery/path.rb
121
122
  - lib/fpm/cookery/path_helper.rb
@@ -151,12 +152,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
152
  - - ! '>='
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
155
+ segments:
156
+ - 0
157
+ hash: -4411516552651280522
154
158
  required_rubygems_version: !ruby/object:Gem::Requirement
155
159
  none: false
156
160
  requirements:
157
161
  - - ! '>='
158
162
  - !ruby/object:Gem::Version
159
163
  version: '0'
164
+ segments:
165
+ - 0
166
+ hash: -4411516552651280522
160
167
  requirements: []
161
168
  rubyforge_project: fpm-cookery
162
169
  rubygems_version: 1.8.24