pkg-wizard 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -27,6 +27,7 @@ Jeweler::Tasks.new do |gem|
27
27
  gem.add_runtime_dependency 'thin'
28
28
  gem.add_runtime_dependency 'rufus-scheduler'
29
29
  gem.add_runtime_dependency 'term-ansicolor'
30
+ gem.add_runtime_dependency 'mixlib-cli'
30
31
  # gem.add_development_dependency 'rspec', '> 1.2.3'
31
32
  end
32
33
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -35,6 +35,10 @@ module PKGWizard
35
35
  :long => '--mock-profile PROF'
36
36
 
37
37
  class Webapp < Sinatra::Base
38
+ def find_job_path(name)
39
+ (Dir["failed/job_*"] + Dir["success/job_*"]).find { |j| File.basename(j) == name }
40
+ end
41
+
38
42
  post '/build/' do
39
43
  pkg = params[:pkg]
40
44
  if pkg.nil?
@@ -52,7 +56,7 @@ module PKGWizard
52
56
  # list failed pkgs
53
57
  get '/job/failed' do
54
58
  max = params[:max] || 10
55
- jobs = Dir["failed/job_*"].sort { |a,b| a <=> b }
59
+ jobs = (Dir["failed/job_*"].sort { |a,b| a <=> b }).map { |j| File.basename(j) }
56
60
  max = max.to_i
57
61
  if jobs.size > max.to_i
58
62
  jobs[- max..-1].to_yaml
@@ -75,7 +79,7 @@ module PKGWizard
75
79
  # list failed pkgs
76
80
  get '/job/successful' do
77
81
  max = params[:max] || 10
78
- jobs = Dir["output/job_*"].sort { |a,b| a <=> b }
82
+ jobs = (Dir["output/job_*"].sort { |a,b| a <=> b }).map { |j| File.basename(j) }
79
83
  max = max.to_i
80
84
  if jobs.size > max.to_i
81
85
  jobs[- max..-1].to_yaml
@@ -84,6 +88,26 @@ module PKGWizard
84
88
  end
85
89
  end
86
90
 
91
+ get '/job/rebuild/:name' do
92
+ name = params[:name]
93
+ job = find_job_path(name)
94
+ if job.nil?
95
+ status 404
96
+ else
97
+ $stdout.puts "Rebuilding job [#{name}]".ljust(40) + File.basename(Dir["#{job}/*.rpm"].first)
98
+ FileUtils.cp Dir["#{job}/*.rpm"].first, 'incoming/'
99
+ end
100
+ end
101
+
102
+ get '/job/current' do
103
+ job = Dir['workspace/job*'].first
104
+ if job
105
+ File.read(job + '/meta.yml')
106
+ else
107
+ status 404
108
+ end
109
+ end
110
+
87
111
  get '/job/:name' do
88
112
  jname = params[:name]
89
113
  jobs = Dir['output/job_*'] + Dir['failed/job_*']
@@ -146,6 +170,10 @@ module PKGWizard
146
170
  result_dir = job_dir + '/result'
147
171
  FileUtils.mkdir_p result_dir
148
172
  meta[:source] = File.basename(queue.first)
173
+ meta[:status] = 'building'
174
+ File.open("workspace/job_#{job_time}/meta.yml", 'w') do |f|
175
+ f.puts meta.to_yaml
176
+ end
149
177
  FileUtils.mv queue.first, qfile
150
178
  $stdout.puts "Building pkg [job_#{job_time}]".ljust(40).yellow.bold + "#{File.basename(qfile)}"
151
179
 
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.6'
7
+ VERSION = '0.1.7'
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
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-02-15 00:00:00 +01:00
18
+ date: 2011-02-16 00:00:00 +01:00
19
19
  default_executable: pkgwiz
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -148,6 +148,20 @@ dependencies:
148
148
  prerelease: false
149
149
  type: :runtime
150
150
  version_requirements: *id009
151
+ - !ruby/object:Gem::Dependency
152
+ requirement: &id010 !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ name: mixlib-cli
162
+ prerelease: false
163
+ type: :runtime
164
+ version_requirements: *id010
151
165
  description: Tools to manage,create and build distribution packages
152
166
  email: rubiojr@frameos.org
153
167
  executables: