polisher 0.4 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -661
  3. data/README.md +39 -0
  4. data/Rakefile +11 -88
  5. data/bin/binary_gem_resolver.rb +95 -0
  6. data/bin/gem_dependency_checker.rb +165 -0
  7. data/bin/git_gem_updater.rb +86 -0
  8. data/bin/ruby_rpm_spec_updater.rb +29 -0
  9. data/lib/polisher.rb +19 -0
  10. data/lib/polisher/apt.rb +12 -0
  11. data/lib/polisher/bodhi.rb +21 -0
  12. data/lib/polisher/bugzilla.rb +9 -0
  13. data/lib/polisher/core.rb +33 -0
  14. data/lib/polisher/errata.rb +43 -0
  15. data/lib/polisher/fedora.rb +43 -0
  16. data/lib/polisher/gem.rb +155 -0
  17. data/lib/polisher/gemfile.rb +72 -0
  18. data/lib/polisher/gemspec.rb +32 -0
  19. data/lib/polisher/git.rb +135 -0
  20. data/lib/polisher/koji.rb +54 -0
  21. data/lib/polisher/rhn.rb +14 -0
  22. data/lib/polisher/rpmspec.rb +254 -0
  23. data/lib/polisher/upstream.rb +29 -0
  24. data/lib/polisher/vendor.rb +9 -0
  25. data/lib/polisher/version_checker.rb +100 -0
  26. data/lib/polisher/yum.rb +28 -0
  27. data/spec/core_spec.rb +64 -0
  28. data/spec/fedora_spec.rb +14 -0
  29. data/spec/gem_spec.rb +82 -0
  30. data/spec/gemfile_spec.rb +45 -0
  31. data/spec/git_spec.rb +74 -0
  32. data/spec/rpmspec_spec.rb +105 -0
  33. data/spec/spec_helper.rb +50 -37
  34. data/spec/upstream_spec.rb +39 -0
  35. metadata +173 -179
  36. data/COPYING +0 -8
  37. data/README.rdoc +0 -105
  38. data/TODO +0 -7
  39. data/bin/server +0 -4
  40. data/config.ru +0 -25
  41. data/config/database.yml +0 -13
  42. data/config/polisher.yml +0 -5
  43. data/db/connection.rb +0 -52
  44. data/db/migrations/001_create_projects.rb +0 -23
  45. data/db/migrations/002_create_sources.rb +0 -25
  46. data/db/migrations/003_create_project_source_versions.rb +0 -28
  47. data/db/migrations/004_create_events.rb +0 -27
  48. data/db/migrations/005_create_project_dependencies.rb +0 -28
  49. data/db/models/event.rb +0 -87
  50. data/db/models/project.rb +0 -110
  51. data/db/models/project_dependency.rb +0 -27
  52. data/db/models/project_source_version.rb +0 -31
  53. data/db/models/source.rb +0 -101
  54. data/lib/common.rb +0 -71
  55. data/lib/dsl.rb +0 -292
  56. data/lib/event_handlers.rb +0 -166
  57. data/lib/gem_adapter.rb +0 -94
  58. data/lib/sinatra/url_for.rb +0 -40
  59. data/polisher.rb +0 -372
  60. data/public/stylesheets/style.css +0 -67
  61. data/spec/common_spec.rb +0 -28
  62. data/spec/dsl_spec.rb +0 -357
  63. data/spec/event_handlers_spec.rb +0 -300
  64. data/spec/gem_adapter_spec.rb +0 -89
  65. data/spec/models_spec.rb +0 -721
  66. data/spec/polisher_spec.rb +0 -573
  67. data/views/layout.haml +0 -22
  68. data/views/projects/index.haml +0 -42
  69. data/views/projects/index.html.haml +0 -38
  70. data/views/result.haml +0 -9
  71. data/views/sources/index.haml +0 -24
  72. data/views/sources/index.html.haml +0 -26
@@ -1,67 +0,0 @@
1
- a{
2
- text-decoration: none;
3
- font-size: 85%;
4
- color: gray;
5
- }
6
-
7
- #header {
8
- width: 850px;
9
- margin-left: auto;
10
- margin-right: auto;
11
- padding-top: 0px;
12
- padding-bottom: 70px;
13
- border-bottom: 1px solid black;
14
- }
15
-
16
- #header h3{
17
- width: 30%;
18
- float: left;
19
- padding-top: 15px;
20
- }
21
-
22
- #header ul{
23
- float: right;
24
- }
25
-
26
- #header ul li{
27
- float: left;
28
- display: block;
29
- padding-left: 15px;
30
- }
31
-
32
- #main {
33
- width: 850px;
34
- margin-left: auto;
35
- margin-right: auto;
36
- padding-left: 10px;
37
- }
38
-
39
- #main h1,
40
- #main h3,
41
- #main h5,
42
- #main h6,
43
- #main ul,
44
- #main li{
45
- padding: 0 0 3px;
46
- margin: 0 15px;
47
- white-space:nowrap;
48
- overflow: hidden;
49
- }
50
-
51
- #main h1{
52
- font-size: 1.5em;
53
- }
54
-
55
- #main h2,
56
- #main h4{
57
- font-size: 0.8em;
58
- display: inline;
59
- }
60
-
61
- #main ul li{
62
- list-style: none;
63
- }
64
-
65
- #main ul li:before {
66
- content: "\00BB \0020";
67
- }
@@ -1,28 +0,0 @@
1
- # polisher common spec
2
- #
3
- # Copyright (C) 2010 Red Hat, Inc.
4
- # Written by Mohammed Morsi <mmorsi@redhat.com>
5
- #
6
- # This program is free software, you can redistribute it and/or modify
7
- # it under the terms of the GNU Affero General Public License
8
- # as published by the Free Software Foundation, either version 3
9
- # of the License, or (at your option) any later version.
10
- #
11
- # You should have received a copy of the the GNU Affero
12
- # General Public License, along with Polisher. If not, see
13
- # <http://www.gnu.org/licenses/>
14
-
15
- require File.dirname(__FILE__) + '/spec_helper'
16
-
17
- describe "Polisher::Common" do
18
- it "should convert has to/from string" do
19
- hash = {:a => 123, :b => "foo"}
20
- str = String.from_h(hash)
21
- stra = str.split(";")
22
- stra.include?("a=123").should be_true
23
- stra.include?("b=foo").should be_true
24
- hash = str.to_h
25
- hash["a"].should == "123"
26
- hash["b"].should == "foo"
27
- end
28
- end
@@ -1,357 +0,0 @@
1
- # ruby gem polisher dsl spec
2
- #
3
- # Copyright (C) 2010 Red Hat, Inc.
4
- # Written by Mohammed Morsi <mmorsi@redhat.com>
5
- #
6
- # This program is free software, you can redistribute it and/or modify
7
- # it under the terms of the GNU Affero General Public License
8
- # as published by the Free Software Foundation, either version 3
9
- # of the License, or (at your option) any later version.
10
- #
11
- # You should have received a copy of the the GNU Affero
12
- # General Public License, along with Polisher. If not, see
13
- # <http://www.gnu.org/licenses/>
14
-
15
- ##########################
16
- ## target typical dsl use case:
17
- #
18
- # polisher "http://localhost:3000"
19
- #
20
- # project :name => "ruby" do |proj|
21
- # proj.add_archive :name => 'ruby_source', :uri => "ftp://ftp.ruby-lang.org/pub/ruby/%{rubyxver}/ruby-%{arcver}.tar.bz2" do |archive|
22
- # archive.version "1.8.6", :rubyxver => "1.8", :arcver => "1.8.7-p311", :corresponds_to => proj.version("1.8.6")
23
- # proj.version "1.9.1", :corresponds_to => archive.version("1.9.1", :rubyxver => "1.9", :arcver => "1.8.7-p300")
24
- # end
25
- # proj.add_patch "http://cvs.fedoraproject.org/viewvc/rpms/ruby/F-13/ruby-deadcode.patch?view=markup"
26
- # # etc...
27
- #
28
- # proj.on_version "*", "create package"
29
- # proj.on_version "=", "1.8.6", "update repo", "stable"
30
- # proj.on_version ">=", "1.9.1", "update repo", "devel"
31
- # end
32
- #
33
- # project :name => "ruby-postgres" do |p|
34
- # end
35
- #
36
- # project :name => "rubygem-rails" do |p|
37
- # p.add_gem "http://rubygems.org/gems/rails-%{version}.gem" do |g|
38
- # g.is_the_primary_source # instruct polisher to process this project w/ gem2rpm
39
- # g.version ..., :corresponds_to p.version ...
40
- # end
41
- #
42
- # p.on_version "*", "create package"
43
- # p.on_version "<", "2.0", "update repo", "legacy"
44
- # p.on_version "=", "2.0", "update repo", "stable"
45
- # p.on_version ">=", "2.1", "update repo", "rawhide"
46
- #
47
- # # etc....
48
- # end
49
- #
50
- # project :name => 'my_project' do |p|
51
- # # ...
52
- # end
53
- #
54
- ######
55
- ## Test firing events
56
- #project(:name => "ruby").released "1.8.6", :any => "other", :optional => "params"
57
-
58
- # TODO test primary_source in Polisher::Source, project_source_versions/create rest call, and source method
59
-
60
- require File.dirname(__FILE__) + '/spec_helper'
61
-
62
- require 'thin'
63
- require 'lib/dsl'
64
-
65
- # start up the polisher server to handle rest requests
66
- server = Thin::Server.new('127.0.0.1', 3000, app)
67
- server_thread = Thread.new { server.start }
68
-
69
- polisher "http://localhost:3000"
70
-
71
- describe "Polisher::DSL::Project" do
72
- it "should accept members as constructor parameters" do
73
- proj = Polisher::Project.new :id => 20, :name => 'foobar'
74
- proj.id.should == 20
75
- proj.name.should == "foobar"
76
- end
77
-
78
- # TODO test add_archive, add_file, add_patch, add_gem
79
-
80
- it "should be instantiatable from xml" do
81
- # TODO versions, sources, events
82
- xml = "<project><id>10</id><name>foo</name></project>"
83
- project = Polisher::Project.from_xml xml
84
- project.id.should == 10
85
- project.name.should == "foo"
86
- end
87
-
88
- it "should return all projects" do
89
- proj1 = Project.create! :name => 'dsl-projects-test1'
90
- proj2 = Project.create! :name => 'dsl-projects-test2'
91
- test_projects = Project.all
92
- Project.find(:all).each { |proj|
93
- test_projects.find { |p| p.name == proj.name }.should_not be_nil
94
- }
95
- end
96
-
97
- it "should permit creating projects" do
98
- proj = Polisher::Project.new :name => 'project-creation-test'
99
- lambda {
100
- proj.create
101
- }.should change(Project, :count).by(1)
102
- end
103
-
104
- it "should raise and exception if project cannot be created" do
105
- proj = Project.create! :name => 'project-invalid-creation-test'
106
- proj = Polisher::Project.new :name => 'project-invalid-creation-test'
107
- lambda {
108
- proj.create
109
- }.should raise_error(RuntimeError)
110
- end
111
-
112
- it "should allow project deletions" do
113
- db_project = Project.create! :name => "project-event-deletion-test"
114
- project = Polisher::Project.new :id => db_project.id, :name => db_project.name
115
- lambda {
116
- project.delete
117
- }.should change(Project, :count).by(-1)
118
- lambda {
119
- Project.find(db_project.id)
120
- }.should raise_error(ActiveRecord::RecordNotFound)
121
- end
122
-
123
- it "should raise and exception if project cannot be deleted" do
124
- project = Polisher::Project.new :id => "abc"
125
- lambda {
126
- project.delete
127
- }.should raise_error(RuntimeError)
128
- end
129
-
130
- it "should allow event creations" do
131
- db_project = Project.create! :name => "project-event-creation-test"
132
- project = Polisher::Project.new :id => db_project.id, :name => db_project.name
133
- lambda {
134
- project.on_version "<", "3.9", "do something", "options"
135
- }.should change(Event, :count).by(1)
136
- Event.find(:first, :conditions => [ 'project_id = ? AND version_qualifier = ? AND version = ? AND process = ? AND process_options = ?',
137
- project.id, "<", "3.9", "do_something", "options" ]).
138
- should_not be_nil
139
- end
140
-
141
- it "should accept additional process options in event creation" do
142
- db_project = Project.create! :name => "project-event-creation-test2"
143
- project = Polisher::Project.new :id => db_project.id, :name => db_project.name
144
- lambda {
145
- project.on_version "<", "3.9", "do something", "options", :more => 'thing', :to => 'set'
146
- }.should change(Event, :count).by(1)
147
- event = Event.find(:first, :conditions => [ 'project_id = ? AND version_qualifier = ? AND version = ? AND process = ?',
148
- project.id, "<", "3.9", "do_something"])
149
- event.should_not be_nil
150
- po = event.process_options.split(";")
151
- po.include?("options").should be_true
152
- po.include?("more=thing").should be_true
153
- po.include?("to=set").should be_true
154
- end
155
-
156
- it "should correctly setup project/source versions" do
157
- proj = Project.create! :name => 'project-source-version-test-proj1'
158
- src = Source.create! :name => 'project-source-version-test-src1', :source_type => 'file', :uri => 'http://host.bar'
159
-
160
- proj1 = Polisher::Project.new :id => proj.id, :name => 'project-source-version-test-proj1'
161
- proj2 = proj1.version "1.9"
162
- proj2.should be(proj1)
163
- proj1.project_version.should == "1.9"
164
-
165
- src1 = Polisher::Source.new :id => src.id
166
- src1 = src1.version("2.0.12", :some => 'attr')
167
-
168
- lambda {
169
- proj1.version "1.6.5", :corresponds_to => src1
170
- }.should change(ProjectSourceVersion, :count).by(1)
171
-
172
- ProjectSourceVersion.find(:first, :conditions => ['project_version = ? AND source_version = ? AND project_id = ? AND source_id = ? AND source_uri_params = ?',
173
- "1.6.5", "2.0.12", proj.id, src.id, 'some=attr']).should_not be_nil
174
- end
175
-
176
- it "should correctly setup project dependencies" do
177
- proj1 = Project.create! :name => 'project-deps-test-proj490'
178
- proj2 = Project.create! :name => 'project-deps-test-proj491'
179
-
180
- dproj1 = Polisher::Project.new :id => proj1.id, :name => proj1.name
181
- dproja = dproj1.version("2.5")
182
- dproja.should be(dproj1)
183
- dproja.project_version.should == "2.5"
184
-
185
- dproj2 = Polisher::Project.new :id => proj2.id, :name => proj2.name
186
- dprojb = dproj2.version("5.6", :some => 'foo', :bar => 'camp')
187
- dprojb.should be(dproj2)
188
- dprojb.project_version.should == "5.6"
189
- dprojb.dependency_params[:some].should == 'foo'
190
- dprojb.dependency_params[:bar].should == 'camp'
191
-
192
- lambda {
193
- dproj1.version "1.6.5", :some => "attr", :depends_on => dproj2
194
- }.should change(ProjectDependency, :count).by(1)
195
-
196
- pd = ProjectDependency.find(:first, :conditions => ['project_id = ? AND project_version = ? AND depends_on_project_id = ? AND depends_on_project_version = ?',
197
- proj1.id, "1.6.5", proj2.id, "5.6"])
198
- pd.should_not be_nil
199
- params = pd.depends_on_project_params.split(";")
200
- params.include?("some=attr").should be_true
201
- params.include?("bar=camp").should be_true
202
- end
203
-
204
- it "should trigger release" do
205
- db_project = Project.create :name => 'dsl-trigger-test'
206
- event = Event.create :project => db_project,
207
- :process => "integration_test_handler2",
208
- :version_qualifier => '<',
209
- :version => 1.0
210
-
211
- project = Polisher::Project.new :id => db_project.id, :name => db_project.name
212
- project.released 0.9
213
- $integration_test_handler_flags.include?(2).should == true
214
- end
215
- end
216
-
217
- describe "Polisher::DSL::Source" do
218
- it "should accept members as constructor parameters" do
219
- src = Polisher::Source.new(:id => 20, :name => 'foobar', :uri => 'http://foo.uri')
220
- src.id.should == 20
221
- src.name.should == "foobar"
222
- src.uri.should == "http://foo.uri"
223
- end
224
-
225
- it "should be instantiatable from xml" do
226
- # TODO versions, projects, events
227
- xml = "<source><id>10</id><name>foo</name><source_type>archive</source_type><uri>http://bar.uri</uri></source>"
228
- src = Polisher::Source.from_xml xml
229
- src.id.should == 10
230
- src.name.should == "foo"
231
- src.source_type.should == "archive"
232
- src.uri.should == "http://bar.uri"
233
- end
234
-
235
- it "should return all sources" do
236
- src1 = Source.create! :name => 'dsl-sources-test1', :source_type => 'patch', :uri => 'ftp://abc.def'
237
- src2 = Source.create! :name => 'dsl-sources-test2', :source_type => 'patch', :uri => 'http://111.222'
238
- test_sources = Source.all
239
- Source.find(:all).each { |src|
240
- test_sources.find { |s| s.name == src.name && s.type == src.type && s.uri == src.uri }.should_not be_nil
241
- }
242
- end
243
-
244
- it "should permit creating sources" do
245
- src = Polisher::Source.new(:name => 'project-creation-test', :source_type => 'archive', :uri => 'http://abc53')
246
- lambda {
247
- src.create
248
- }.should change(Source, :count).by(1)
249
- end
250
-
251
- it "should raise an exception if source cannot be created" do
252
- args = {:name => 'source-invalid-creation-test', :source_type => 'patch', :uri => 'ftp://invalid.source'}
253
- Source.create! args
254
- src = Polisher::Source.new args
255
- lambda {
256
- src.create
257
- }.should raise_error(RuntimeError)
258
- end
259
-
260
- it "should correctly setup project/source versions" do
261
- proj = Project.create! :name => 'project-source-version-test-proj41'
262
- src = Source.create! :name => 'project-source-version-test-src41', :source_type => 'file', :uri => 'http://bar.host.uri'
263
-
264
- src1 = Polisher::Source.new :id => src.id, :name => 'project-source-version-test-src41'
265
- src2 = src1.version "1.9", :some => "attr", :other => 'thing'
266
- src2.should be(src1)
267
- src1.source_version.should == "1.9"
268
-
269
- uri_args = src1.uri_args.split(";")
270
- uri_args.include?("some=attr").should be_true
271
- uri_args.include?("other=thing").should be_true
272
-
273
- proj1 = Polisher::Project.new :id => proj.id
274
- proj1 = proj1.version("2.0.12")
275
-
276
- lambda {
277
- src1.version "1.6.5", :some => "attr", :other => 'thing', :corresponds_to => proj1
278
- }.should change(ProjectSourceVersion, :count).by(1)
279
-
280
- ps = ProjectSourceVersion.find(:first, :conditions => ['source_version = ? AND project_version = ? AND project_id = ? AND source_id = ?',
281
- "1.6.5", "2.0.12", proj.id, src1.id])
282
- ps.should_not be_nil
283
- uri_args = ps.source_uri_params.split(";")
284
- uri_args.include?("some=attr").should be_true
285
- uri_args.include?("other=thing").should be_true
286
- end
287
- end
288
-
289
-
290
- describe "Polisher::DSL" do
291
- it "should return all projects" do
292
- proj1 = Project.create! :name => 'dsl-projects-test100'
293
- proj2 = Project.create! :name => 'dsl-projects-test200'
294
- test_projects = projects
295
- Project.find(:all).each { |proj|
296
- test_projects.find { |p| p.name == proj.name }.should_not be_nil
297
- }
298
- end
299
-
300
- it "should find or create project" do
301
- test_project = nil
302
- lambda {
303
- test_project = project :name => "dsl-project-testc"
304
- }.should change(Project, :count).by(1)
305
- db_project = Project.find(:first, :conditions => ['name = ?', 'dsl-project-testc'])
306
- test_project.id.should == db_project.id
307
-
308
- lambda {
309
- test_project = project :name => "dsl-project-testc"
310
- }.should_not change(Project, :count)
311
- test_project.id.should == db_project.id
312
- end
313
-
314
- it "should return all sources" do
315
- source1 = Source.create! :name => 'dsl-sources-test51', :uri => "http://test1.host", :source_type => 'archive'
316
- source2 = Source.create! :name => 'dsl-sources-test52', :uri => "http://test2.host", :source_type => 'patch'
317
- test_sources = sources
318
- Source.find(:all).each { |source|
319
- test_sources.find { |s| s.name == source.name && s.uri == source.uri }.should_not be_nil
320
- }
321
- test_sources.find { |s| s.name == "dsl-sources-test51" && s.uri == "http://test1.host" && s.source_type == "archive" }.should_not be_nil
322
- test_sources.find { |s| s.name == "dsl-sources-test52" && s.uri == "http://test2.host" && s.source_type == "patch" }.should_not be_nil
323
- end
324
-
325
- it "should find or create source" do
326
- test_source = nil
327
- lambda {
328
- test_source = source :name => "dsl-source-test", :uri => "http://source.testc", :source_type => 'archive'
329
- }.should change(Source, :count).by(1)
330
- db_source = Source.find(:first, :conditions => ['name = ? AND uri = ? AND source_type = ?', 'dsl-source-test', 'http://source.testc', 'archive'])
331
- test_source.id.should == db_source.id
332
-
333
- lambda {
334
- test_source = source :name => "dsl-source-test", :uri => "http://source.testc"
335
- }.should_not change(Source, :count)
336
- test_source.id.should == db_source.id
337
-
338
- test_source = source :name => "dsl-source-test"
339
- test_source.id.should == db_source.id
340
- end
341
-
342
- end
343
-
344
- # prolly a better way todo this, but fine for now
345
- $integration_test_handler_flags = []
346
-
347
- def integration_test_handler1(entity, process_options = [], optional_params = {})
348
- $integration_test_handler_flags << 1
349
- end
350
-
351
- def integration_test_handler2(entity, process_options = [], optional_params = {})
352
- $integration_test_handler_flags << 2
353
- end
354
-
355
- # stop the sinatra server
356
- #server.stop!
357
- #server_thread.kill!