pkg-wizard 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -29,6 +29,7 @@ Jeweler::Tasks.new do |gem|
29
29
  gem.add_runtime_dependency 'rufus-scheduler'
30
30
  gem.add_runtime_dependency 'term-ansicolor'
31
31
  gem.add_runtime_dependency 'mixlib-cli'
32
+ gem.add_runtime_dependency 'daemons'
32
33
  # gem.add_development_dependency 'rspec', '> 1.2.3'
33
34
  end
34
35
  Jeweler::RubygemsDotOrgTasks.new
@@ -12,6 +12,7 @@ require 'rufus/scheduler'
12
12
  require 'term/ansicolor'
13
13
  require 'pp'
14
14
  require 'yaml'
15
+ require 'daemons'
15
16
 
16
17
  class String
17
18
  include Term::ANSIColor
@@ -35,6 +36,15 @@ module PKGWizard
35
36
  :short => '-m PROF',
36
37
  :long => '--mock-profile PROF'
37
38
 
39
+ option :port,
40
+ :short => '-p PORT',
41
+ :long => '--port PORT',
42
+ :default => 4567
43
+
44
+ option :daemonize,
45
+ :long => '--daemonize',
46
+ :default => false
47
+
38
48
  class Webapp < Sinatra::Base
39
49
  def find_job_path(name)
40
50
  (Dir["failed/job_*"] + Dir["success/job_*"]).find { |j| File.basename(j) == name }
@@ -189,14 +199,39 @@ module PKGWizard
189
199
  cli = BuildBot.new
190
200
  cli.banner = "\nUsage: rpmwiz build-bot (options)\n\n"
191
201
  cli.parse_options
202
+ if cli.config[:daemonize]
203
+ pwd = Dir.pwd
204
+ umask = File.umask
205
+ Daemons.daemonize :app_name => 'build-bot', :dir_mode => :normal, :dir => pwd
206
+ Dir.chdir pwd
207
+ File.umask umask
208
+ log = File.new("build-bot.log", "a")
209
+ $stdout.reopen(log)
210
+ $stderr.reopen(log)
211
+ $stdout.sync = true
212
+ $stderr.sync = true
213
+ end
214
+
192
215
  mock_profile = cli.config[:mock_profile]
193
216
  if not mock_profile
194
217
  $stderr.puts 'Invalid mock profile.'
195
218
  $stderr.puts cli.opt_parser.help
196
- exit
219
+ exit 1
220
+ end
221
+
222
+ if not File.exist? '/usr/bin/rpmbuild'
223
+ $stderr.puts 'rpmbuild command not found. Install it first.'
224
+ exit 1
225
+ end
226
+
227
+ if not File.exist? '/usr/sbin/mock'
228
+ $stderr.puts 'mock command not found. Install it first.'
229
+ exit 1
197
230
  end
231
+
198
232
  meta = { :mock_profile => mock_profile }
199
233
 
234
+
200
235
  Dir.mkdir 'incoming' if not File.exist?('incoming')
201
236
  Dir.mkdir 'output' if not File.exist?('output')
202
237
  Dir.mkdir 'workspace' if not File.exist?('workspace')
@@ -321,6 +356,7 @@ module PKGWizard
321
356
  end
322
357
  end
323
358
  end
359
+ Webapp.set :port => cli.config[:port]
324
360
  Webapp.run!
325
361
  end
326
362
 
@@ -30,7 +30,7 @@ module PKGWizard
30
30
  end
31
31
  if File.exist?('/etc/redhat-release')
32
32
  print '* Installing RHEL/Fedora requirements... '
33
- output = `yum install -y git rpmdevtools mock createrepo yum-utils screen`
33
+ output = `yum install -y git rpm-build rpmdevtools mock createrepo yum-utils screen`
34
34
  if $? != 0
35
35
  $stderr.puts "Failed installing requirementes: \n#{output}"
36
36
  exit 1
data/lib/pkg-wizard.rb CHANGED
@@ -4,7 +4,7 @@ require 'mixlib/cli'
4
4
 
5
5
  module PKGWizard
6
6
 
7
- VERSION = '0.1.17'
7
+ VERSION = '0.1.18'
8
8
 
9
9
  class Distribution
10
10
  def self.detect
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-wizard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 17
10
- version: 0.1.17
9
+ - 18
10
+ version: 0.1.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Rubio
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-01 00:00:00 +02:00
18
+ date: 2011-04-04 00:00:00 +02:00
19
19
  default_executable: pkgwiz
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -162,6 +162,20 @@ dependencies:
162
162
  version: "0"
163
163
  requirement: *id010
164
164
  prerelease: false
165
+ - !ruby/object:Gem::Dependency
166
+ type: :runtime
167
+ name: daemons
168
+ version_requirements: &id011 !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ hash: 3
174
+ segments:
175
+ - 0
176
+ version: "0"
177
+ requirement: *id011
178
+ prerelease: false
165
179
  description: Tools to manage,create and build distribution packages
166
180
  email: rubiojr@frameos.org
167
181
  executables: