right_publish 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +2 -0
- data/README.rdoc +25 -25
- data/VERSION +1 -1
- data/bin/right_publish +1 -5
- data/lib/right_publish/annotation.rb +101 -0
- data/lib/right_publish/cli.rb +91 -0
- data/lib/right_publish/profile.rb +30 -20
- data/lib/right_publish/repo.rb +74 -25
- data/lib/right_publish/repos/apt.rb +8 -10
- data/lib/right_publish/repos/gem.rb +15 -11
- data/lib/right_publish/repos/msi.rb +45 -0
- data/lib/right_publish/repos/yum.rb +8 -11
- data/lib/right_publish/storage.rb +42 -3
- data/lib/right_publish/stores/local.rb +3 -3
- data/lib/right_publish.rb +24 -86
- data/right_publish.gemspec +13 -3
- data/spec/annotation_spec.rb +22 -0
- data/spec/repo_manager_spec.rb +1 -3
- data/spec/repo_spec.rb +5 -7
- data/spec/repos/apt_spec.rb +3 -3
- data/spec/repos/gem_spec.rb +3 -3
- data/spec/repos/yum_spec.rb +3 -3
- data/spec/spec_helper.rb +7 -0
- data/spec/storage_manager_spec.rb +0 -1
- data/spec/storage_spec.rb +26 -2
- data/spec/stores/local_spec.rb +0 -1
- data/spec/stores/s3_spec.rb +0 -1
- metadata +87 -52
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RightPublish::Annotation do
|
4
|
+
subject { described_class } # the class itself, not an instance
|
5
|
+
|
6
|
+
context '.generate_html' do
|
7
|
+
context 'options' do
|
8
|
+
it 'includes stylesheets'
|
9
|
+
it 'includes scripts'
|
10
|
+
it 'includes the title in the head'
|
11
|
+
it 'includes an h1 with the title'
|
12
|
+
it 'accepts a single-glob filter'
|
13
|
+
it 'accepts a multi-glob filter'
|
14
|
+
it 'accepts complex filters'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'sorts its list alphabetically'
|
18
|
+
it 'generates folder elements'
|
19
|
+
it 'generates file elements'
|
20
|
+
it 'generates hierarchical trees of folders and files'
|
21
|
+
end
|
22
|
+
end
|
data/spec/repo_manager_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'right_publish/repo'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::RepoManager do
|
@@ -52,8 +51,7 @@ describe RightPublish::RepoManager do
|
|
52
51
|
end
|
53
52
|
|
54
53
|
it "accpets repos who are properly defined" do
|
55
|
-
class GoodRepo
|
56
|
-
include RightPublish::Repo
|
54
|
+
class GoodRepo < RightPublish::Repo
|
57
55
|
REPO_KEY = :good_repo
|
58
56
|
REPO_OPTIONS = {}
|
59
57
|
end
|
data/spec/repo_spec.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
require 'right_publish/repo'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::Repo do
|
5
4
|
|
6
|
-
class FakeRepo
|
7
|
-
include RightPublish::Repo
|
5
|
+
class FakeRepo < RightPublish::Repo
|
8
6
|
REPO_KEY = :fake_repo
|
9
7
|
REPO_OPTIONS = {}
|
10
8
|
end
|
@@ -48,25 +46,25 @@ describe RightPublish::Repo do
|
|
48
46
|
@repo = RightPublish::RepoManager.get_repository(:fake_repo)
|
49
47
|
end
|
50
48
|
|
51
|
-
context "#
|
49
|
+
context "#pull" do
|
52
50
|
it "fetches from remote storage to local" do
|
53
51
|
flexmock(RightPublish::Storage).should_receive(:sync_dirs).and_return do |src,dest,options|
|
54
52
|
src.should be_equal(MockRemote)
|
55
53
|
dest.should be_equal(MockLocal)
|
56
54
|
nil
|
57
55
|
end
|
58
|
-
@repo.
|
56
|
+
@repo.pull
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
context "#
|
60
|
+
context "#push" do
|
63
61
|
it "stores from local storage to remote" do
|
64
62
|
flexmock(RightPublish::Storage).should_receive(:sync_dirs).and_return do |src,dest,options|
|
65
63
|
src.should be_equal(MockLocal)
|
66
64
|
dest.should be_equal(MockRemote)
|
67
65
|
nil
|
68
66
|
end
|
69
|
-
@repo.
|
67
|
+
@repo.push
|
70
68
|
end
|
71
69
|
end
|
72
70
|
|
data/spec/repos/apt_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'right_publish/repo'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::AptRepo do
|
@@ -8,8 +7,9 @@ describe RightPublish::AptRepo do
|
|
8
7
|
@repo_subdir = 'fake/'
|
9
8
|
|
10
9
|
@repo = flexmock(RightPublish::RepoManager.get_repository(:apt_repo)) do |obj|
|
11
|
-
obj.should_receive(:
|
12
|
-
obj.should_receive(:
|
10
|
+
obj.should_receive(:pull)
|
11
|
+
obj.should_receive(:annotate)
|
12
|
+
obj.should_receive(:push)
|
13
13
|
obj.should_receive(:do_in_subdir).and_return {|dir,block| block.call}
|
14
14
|
obj.should_receive(:prune_all)
|
15
15
|
obj.should_receive(:write_conf_file)
|
data/spec/repos/gem_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'right_publish/repo'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::GemRepo do
|
@@ -7,8 +6,9 @@ describe RightPublish::GemRepo do
|
|
7
6
|
@install_expectations = []
|
8
7
|
@repo_subdir = 'fake/'
|
9
8
|
@repo = flexmock(RightPublish::RepoManager.get_repository(:gem_repo)) do |obj|
|
10
|
-
obj.should_receive(:
|
11
|
-
obj.should_receive(:
|
9
|
+
obj.should_receive(:pull)
|
10
|
+
obj.should_receive(:annotate)
|
11
|
+
obj.should_receive(:push)
|
12
12
|
obj.should_receive(:do_in_subdir).and_return {|dir,block| block.call}
|
13
13
|
end
|
14
14
|
|
data/spec/repos/yum_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'right_publish/repo'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::YumRepo do
|
@@ -17,8 +16,9 @@ describe RightPublish::YumRepo do
|
|
17
16
|
before(:each) do
|
18
17
|
@repo_subdir = 'fake/'
|
19
18
|
@repo = flexmock(RightPublish::RepoManager.get_repository(:yum_repo)) do |obj|
|
20
|
-
obj.should_receive(:
|
21
|
-
obj.should_receive(:
|
19
|
+
obj.should_receive(:pull)
|
20
|
+
obj.should_receive(:annotate)
|
21
|
+
obj.should_receive(:push)
|
22
22
|
obj.should_receive(:do_in_subdir).and_return {|dir,block| block.call}
|
23
23
|
obj.should_receive(:yum_prune)
|
24
24
|
obj.should_receive(:pkg_parts).and_return { |pkg| pkg_parts(pkg) }
|
data/spec/spec_helper.rb
CHANGED
@@ -25,6 +25,13 @@ require 'flexmock'
|
|
25
25
|
require 'ruby-debug'
|
26
26
|
require 'simplecov' unless RUBY_VERSION =~ /1\.8/
|
27
27
|
|
28
|
+
# This is a Jewelerized project; it won't be activated as a gem when invoked in situ.
|
29
|
+
# Compensate by adding the lib dir to our path.
|
30
|
+
lib_dir = File.expand_path('../../lib', __FILE__)
|
31
|
+
$: << lib_dir unless $:.include?(lib_dir)
|
32
|
+
|
28
33
|
RSpec.configure do |config|
|
29
34
|
config.mock_with :flexmock
|
30
35
|
end
|
36
|
+
|
37
|
+
require 'right_publish'
|
data/spec/storage_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'right_publish/storage'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe RightPublish::Storage do
|
@@ -43,7 +42,7 @@ describe RightPublish::Storage do
|
|
43
42
|
create_proc = Proc.new { |file| files << file }
|
44
43
|
delete_proc = Proc.new { |file| files.delete_if { |f| f.key == file } }
|
45
44
|
|
46
|
-
# Create the File mocks and
|
45
|
+
# Create the File mocks and push in the Array
|
47
46
|
file_hash.each_pair do |name,expects|
|
48
47
|
files << make_file(name, expects, create_proc, delete_proc )
|
49
48
|
end
|
@@ -314,4 +313,29 @@ describe RightPublish::Storage do
|
|
314
313
|
end
|
315
314
|
end
|
316
315
|
|
316
|
+
context ".guess_mime_type" do
|
317
|
+
it 'always prefers RightPublish built-in types' do
|
318
|
+
RightPublish::MIME_TYPES.each_pair do |mt, ext|
|
319
|
+
RightPublish::Storage.guess_mime_type("some-file.#{ext}").should == mt
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
other_types = {
|
324
|
+
'html' => 'text/html',
|
325
|
+
'txt' => 'text/plain',
|
326
|
+
'gz' => 'application/x-gzip',
|
327
|
+
'png' => 'image/png',
|
328
|
+
'jpg' => 'image/jpeg'
|
329
|
+
}
|
330
|
+
|
331
|
+
other_types.each_pair do |ext, mt|
|
332
|
+
it "knows about .#{ext} files" do
|
333
|
+
RightPublish::Storage.guess_mime_type("some-file.#{ext}").should == mt
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'guesses application/octet-stream for unknown files' do
|
338
|
+
RightPublish::Storage.guess_mime_type('some-file.xyzzywwfoobflo').should == 'application/octet-stream'
|
339
|
+
end
|
340
|
+
end
|
317
341
|
end
|
data/spec/stores/local_spec.rb
CHANGED
data/spec/stores/s3_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_publish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Szmyd
|
@@ -16,12 +16,10 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-11-12 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
@@ -31,11 +29,11 @@ dependencies:
|
|
31
29
|
- 0
|
32
30
|
version: "0"
|
33
31
|
type: :runtime
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: fog
|
32
|
+
requirement: *id001
|
37
33
|
prerelease: false
|
38
|
-
|
34
|
+
name: builder
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
37
|
none: false
|
40
38
|
requirements:
|
41
39
|
- - ~>
|
@@ -46,11 +44,42 @@ dependencies:
|
|
46
44
|
- 9
|
47
45
|
version: "1.9"
|
48
46
|
type: :runtime
|
49
|
-
|
47
|
+
requirement: *id002
|
48
|
+
prerelease: false
|
49
|
+
name: fog
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - <=
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 125
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
- 25
|
60
|
+
- 3
|
61
|
+
version: 0.25.3
|
62
|
+
type: :runtime
|
63
|
+
requirement: *id003
|
52
64
|
prerelease: false
|
53
|
-
|
65
|
+
name: excon
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 15
|
73
|
+
segments:
|
74
|
+
- 1
|
75
|
+
- 0
|
76
|
+
version: "1.0"
|
77
|
+
type: :runtime
|
78
|
+
requirement: *id004
|
79
|
+
prerelease: false
|
80
|
+
name: mime-types
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
54
83
|
none: false
|
55
84
|
requirements:
|
56
85
|
- - ~>
|
@@ -61,11 +90,11 @@ dependencies:
|
|
61
90
|
- 0
|
62
91
|
version: "2.0"
|
63
92
|
type: :runtime
|
64
|
-
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: rake
|
93
|
+
requirement: *id005
|
67
94
|
prerelease: false
|
68
|
-
|
95
|
+
name: trollop
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
69
98
|
none: false
|
70
99
|
requirements:
|
71
100
|
- - ~>
|
@@ -76,11 +105,11 @@ dependencies:
|
|
76
105
|
- 9
|
77
106
|
version: "0.9"
|
78
107
|
type: :development
|
79
|
-
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: jeweler
|
108
|
+
requirement: *id006
|
82
109
|
prerelease: false
|
83
|
-
|
110
|
+
name: rake
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
84
113
|
none: false
|
85
114
|
requirements:
|
86
115
|
- - ~>
|
@@ -92,11 +121,11 @@ dependencies:
|
|
92
121
|
- 3
|
93
122
|
version: 1.8.3
|
94
123
|
type: :development
|
95
|
-
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: right_develop
|
124
|
+
requirement: *id007
|
98
125
|
prerelease: false
|
99
|
-
|
126
|
+
name: jeweler
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
100
129
|
none: false
|
101
130
|
requirements:
|
102
131
|
- - ~>
|
@@ -107,11 +136,11 @@ dependencies:
|
|
107
136
|
- 0
|
108
137
|
version: "1.0"
|
109
138
|
type: :development
|
110
|
-
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rdoc
|
139
|
+
requirement: *id008
|
113
140
|
prerelease: false
|
114
|
-
|
141
|
+
name: right_develop
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
115
144
|
none: false
|
116
145
|
requirements:
|
117
146
|
- - ">="
|
@@ -123,11 +152,11 @@ dependencies:
|
|
123
152
|
- 2
|
124
153
|
version: 2.4.2
|
125
154
|
type: :development
|
126
|
-
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: rspec
|
155
|
+
requirement: *id009
|
129
156
|
prerelease: false
|
130
|
-
|
157
|
+
name: rdoc
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
131
160
|
none: false
|
132
161
|
requirements:
|
133
162
|
- - ~>
|
@@ -138,11 +167,11 @@ dependencies:
|
|
138
167
|
- 0
|
139
168
|
version: "2.0"
|
140
169
|
type: :development
|
141
|
-
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: flexmock
|
170
|
+
requirement: *id010
|
144
171
|
prerelease: false
|
145
|
-
|
172
|
+
name: rspec
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
146
175
|
none: false
|
147
176
|
requirements:
|
148
177
|
- - ~>
|
@@ -153,11 +182,11 @@ dependencies:
|
|
153
182
|
- 9
|
154
183
|
version: "0.9"
|
155
184
|
type: :development
|
156
|
-
|
157
|
-
- !ruby/object:Gem::Dependency
|
158
|
-
name: simplecov
|
185
|
+
requirement: *id011
|
159
186
|
prerelease: false
|
160
|
-
|
187
|
+
name: flexmock
|
188
|
+
- !ruby/object:Gem::Dependency
|
189
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
161
190
|
none: false
|
162
191
|
requirements:
|
163
192
|
- - ">="
|
@@ -167,11 +196,11 @@ dependencies:
|
|
167
196
|
- 0
|
168
197
|
version: "0"
|
169
198
|
type: :development
|
170
|
-
|
171
|
-
- !ruby/object:Gem::Dependency
|
172
|
-
name: ruby-debug
|
199
|
+
requirement: *id012
|
173
200
|
prerelease: false
|
174
|
-
|
201
|
+
name: simplecov
|
202
|
+
- !ruby/object:Gem::Dependency
|
203
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
175
204
|
none: false
|
176
205
|
requirements:
|
177
206
|
- - ">="
|
@@ -182,11 +211,11 @@ dependencies:
|
|
182
211
|
- 10
|
183
212
|
version: "0.10"
|
184
213
|
type: :development
|
185
|
-
|
186
|
-
- !ruby/object:Gem::Dependency
|
187
|
-
name: ruby-debug19
|
214
|
+
requirement: *id013
|
188
215
|
prerelease: false
|
189
|
-
|
216
|
+
name: ruby-debug
|
217
|
+
- !ruby/object:Gem::Dependency
|
218
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
190
219
|
none: false
|
191
220
|
requirements:
|
192
221
|
- - ">="
|
@@ -198,12 +227,14 @@ dependencies:
|
|
198
227
|
- 6
|
199
228
|
version: 0.11.6
|
200
229
|
type: :development
|
201
|
-
|
230
|
+
requirement: *id014
|
231
|
+
prerelease: false
|
232
|
+
name: ruby-debug19
|
202
233
|
description: A tool for maintaining S3-based DEB, GEM and RPM packages.
|
203
234
|
email: support@rightscale.com
|
204
235
|
executables:
|
205
|
-
- autosign.expect
|
206
236
|
- right_publish
|
237
|
+
- autosign.expect
|
207
238
|
extensions: []
|
208
239
|
|
209
240
|
extra_rdoc_files:
|
@@ -219,16 +250,20 @@ files:
|
|
219
250
|
- bin/autosign.expect
|
220
251
|
- bin/right_publish
|
221
252
|
- lib/right_publish.rb
|
253
|
+
- lib/right_publish/annotation.rb
|
254
|
+
- lib/right_publish/cli.rb
|
222
255
|
- lib/right_publish/profile.rb
|
223
256
|
- lib/right_publish/repo.rb
|
224
257
|
- lib/right_publish/repos/apt.rb
|
225
258
|
- lib/right_publish/repos/gem.rb
|
259
|
+
- lib/right_publish/repos/msi.rb
|
226
260
|
- lib/right_publish/repos/yum.rb
|
227
261
|
- lib/right_publish/repos/zypp.rb
|
228
262
|
- lib/right_publish/storage.rb
|
229
263
|
- lib/right_publish/stores/local.rb
|
230
264
|
- lib/right_publish/stores/s3.rb
|
231
265
|
- right_publish.gemspec
|
266
|
+
- spec/annotation_spec.rb
|
232
267
|
- spec/repo_manager_spec.rb
|
233
268
|
- spec/repo_spec.rb
|
234
269
|
- spec/repos/apt_spec.rb
|