bunchr 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e10dbc02432e9a86050d6d50bfef5665c7e553ef
4
- data.tar.gz: 3f05668357550d568a08ad33e9535f3b8fc5680b
3
+ metadata.gz: e33b41c1da8008ed42f82b43adf8f1d55c865408
4
+ data.tar.gz: e75b37cda8720b625c6e330232dd74a0bb42c7e8
5
5
  SHA512:
6
- metadata.gz: 90e7b6a6a60d7d82fc516ca595f44cbdd15865e3def97347ac8ad9ac373fc8a898230b08c8763c5d84b25eb2ed46f7a1b71da4ca8ae93b834c0e03c2574f875c
7
- data.tar.gz: d4d2279305d9b2402b64233077e2d81ee35c7100ac5a94d152cf042a4a6163fe30591c36f8d9c1410882147949283c2db093fb2da4bb0f46d4affacb84d74d60
6
+ metadata.gz: eb6a260cc02821557098c6194c651d871ec3474951ab6333bc2d8504d2aef47b8e7934454bfb3873d73394c40dfb9ebf0952c9339c0b1723ff284996434283c8
7
+ data.tar.gz: 9894fd7bdfb924cefbae555d8a924af350e7a6314b052c965ae53c4bf95ab9f9a0b0348e836f7a60693e3621f0320d6cea6e8c47a15ef2b15f07c96e70e8aa28
data/lib/bunchr/ohai.rb CHANGED
@@ -8,6 +8,7 @@ module Bunchr
8
8
  def self.ohai
9
9
  if @@ohai.nil?
10
10
  @@ohai ||= ::Ohai::System.new
11
+ @@ohai.load_plugins
11
12
  @@ohai.require_plugin('os')
12
13
  @@ohai.require_plugin('platform')
13
14
  end
@@ -9,22 +9,26 @@ module Bunchr
9
9
  include ::Bunchr::Utils
10
10
 
11
11
  # only attempt to build .rpm's on these platforms (as reported by
12
- # ohai.platform)
12
+ # ohai[:platform])
13
13
  RPM_PLATFORMS = %w[centos redhat fedora scientific suse]
14
14
 
15
15
  # only attempt to build .deb's on these platforms (as reported by
16
16
  # ohai.platform)
17
- DEB_PLATFORMS = %w[debian ubuntu]
17
+ DEB_PLATFORMS = %w[debian ubuntu raspbian]
18
+
19
+ # only attempt to build .pkg's on these platforms (as reported by
20
+ # ohai[:platform])
21
+ PKG_PLATFORMS = %w[freebsd]
18
22
 
19
23
  attr_accessor :name, :version, :iteration, :license, :vendor, :maintainer, :url, :category
20
24
  attr_accessor :description
21
25
  attr_accessor :files, :config_files, :scripts
22
26
 
23
- def initialize
27
+ def initialize
24
28
  @name = nil
25
29
  @version = nil
26
30
  @iteration = nil
27
- @arch = ohai['kernel']['machine']
31
+ @arch = ohai[:kernel][:machine]
28
32
  @license = nil
29
33
  @vendor = nil
30
34
  @maintainer = nil
@@ -38,8 +42,8 @@ module Bunchr
38
42
  define unless name.nil? or version.nil?
39
43
  end
40
44
 
41
- #
42
- # returns the current architecture. Convert some architectures for the
45
+ #
46
+ # returns the current architecture. Convert some architectures for the
43
47
  # underlying packaging systems, such as i686 to i386.
44
48
  def arch
45
49
  case @arch
@@ -63,10 +67,11 @@ module Bunchr
63
67
  define_build_tarball
64
68
  define_build_rpm
65
69
  define_build_deb
70
+ define_build_pkg
66
71
  # TODO-future: build solaris pkgs, windows too?!
67
72
 
68
73
  define_build_all
69
-
74
+
70
75
  task :done => "#{name}:build"
71
76
  task :default => "#{name}:done"
72
77
  end
@@ -92,7 +97,7 @@ module Bunchr
92
97
  desc "Build RPM: #{name}-#{version}-#{iteration}-#{arch}"
93
98
  task :build_rpm do
94
99
 
95
- if RPM_PLATFORMS.include? ohai.platform
100
+ if RPM_PLATFORMS.include? ohai[:platform]
96
101
  logger.info "Building RPM '#{name}-#{version}-#{iteration}-#{arch}'"
97
102
 
98
103
  sh "fpm -s dir -t rpm -a #{arch} -n #{name} -v #{version} \
@@ -110,9 +115,9 @@ module Bunchr
110
115
 
111
116
  logger.info "RPM built."
112
117
  else
113
- logger.info "Not building RPM, platform [#{ohai.platform}] does not support it."
118
+ logger.info "Not building RPM, platform [#{ohai[:platform]}] does not support it."
114
119
  end
115
-
120
+
116
121
  end
117
122
  end
118
123
 
@@ -120,7 +125,7 @@ module Bunchr
120
125
  desc "Build deb: #{name}-#{version}-#{iteration}-#{arch}"
121
126
  task :build_deb do
122
127
 
123
- if DEB_PLATFORMS.include? ohai.platform
128
+ if DEB_PLATFORMS.include? ohai[:platform]
124
129
  logger.info "Building DEB '#{name}-#{version}-#{iteration}-#{arch}'"
125
130
 
126
131
  sh "fpm -s dir -t deb -a #{arch} -n #{name} -v #{version} \
@@ -138,7 +143,37 @@ module Bunchr
138
143
 
139
144
  logger.info "DEB built."
140
145
  else
141
- logger.info "Not building DEB, platform [#{ohai.platform}] does not support it."
146
+ logger.info "Not building DEB, platform [#{ohai[:platform]}] does not support it."
147
+ end
148
+
149
+ end
150
+ end
151
+
152
+ def define_build_pkg
153
+ desc "Build pkg: #{name}-#{version}-#{iteration}-#{arch}"
154
+ task :build_pkg do
155
+
156
+ if PKG_PLATFORMS.include? ohai[:platform]
157
+ logger.info "Building PKG '#{name}-#{version}-#{iteration}-#{arch}'"
158
+
159
+ cmd = "fpm -s dir -t freebsd -a #{arch} -n #{name} -v #{version} \
160
+ --iteration #{iteration} \
161
+ --url '#{url}' \
162
+ --description '#{description}' \
163
+ --license '#{license}' \
164
+ --vendor '#{vendor}' \
165
+ --category '#{category}' \
166
+ #{fpm_scripts_args} \
167
+ #{fpm_config_files_args} \
168
+ #{config_files.join(' ')} \
169
+ #{files.join(' ')}"
170
+
171
+ logger.info cmd.inspect
172
+ sh cmd
173
+
174
+ logger.info "PKG built."
175
+ else
176
+ logger.info "Not building PKG, platform [#{ohai[:platform]}] does not support it."
142
177
  end
143
178
 
144
179
  end
@@ -146,7 +181,7 @@ module Bunchr
146
181
 
147
182
  def define_build_all
148
183
  desc "Build all packages: #{name}-#{version}-#{iteration}-#{arch}"
149
- task :build => [:build_tarball, :build_rpm, :build_deb]
184
+ task :build => [:build_tarball, :build_rpm, :build_deb, :build_pkg]
150
185
  end
151
186
 
152
187
  # depend on a {Bunchr::Software} object to be built and installed
@@ -159,7 +194,7 @@ module Bunchr
159
194
  end
160
195
 
161
196
  # return an argument string for fpm with '--config-files' prefixed to
162
- # every file in the config_files array.
197
+ # every file in the config_files array.
163
198
  # eg: '--config-files /etc/file1 --config-files /etc/file2'
164
199
  def fpm_config_files_args
165
200
  config_files.map { |f| '--config-files ' + f }.join(' ')
@@ -67,7 +67,7 @@ module Bunchr
67
67
  desc "Download, build, and install #{name} #{version}"
68
68
  task name => "#{name}:default"
69
69
  end
70
-
70
+
71
71
  end
72
72
 
73
73
  def define_download
@@ -96,7 +96,7 @@ module Bunchr
96
96
  end
97
97
 
98
98
  file dotfile('build') => "software:#{name}:download" do
99
- logger.info "Bulding #{name} #{version}"
99
+ logger.info "Building #{name} #{version}"
100
100
  Dir.chdir(work_dir) do
101
101
  build
102
102
  end
@@ -111,7 +111,7 @@ module Bunchr
111
111
  logger.info "#{name} #{version} is installed"
112
112
  end
113
113
 
114
- file dotfile('install') => "software:#{name}:build" do
114
+ file dotfile('install') => "software:#{name}:build" do
115
115
  logger.info "Installing #{name} #{version}"
116
116
  Dir.chdir(work_dir) do
117
117
  install
@@ -1,3 +1,3 @@
1
1
  module Bunchr
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunchr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2012-04-17 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.4.26
61
+ version: 1.6.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.4.26
68
+ version: 1.6.1
69
69
  description: |
70
70
  A DSL for building complex software projects and packaging them (RPM, DEB, etc).
71
71
  Originally developed to create "omnibus" style packages that include an entire
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.4.4
115
+ rubygems_version: 2.5.1
116
116
  signing_key:
117
117
  specification_version: 3
118
118
  summary: A DSL for bundling complex software projects into 'omnibus'-style packages.