suppository 0.0.3 → 0.0.6
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 +8 -8
- data/Guardfile +2 -2
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/bin/suppository +4 -8
- data/lib/suppository/add_command.rb +14 -5
- data/lib/suppository/release.rb +2 -2
- data/lib/suppository/repository.rb +2 -2
- data/lib/suppository/version.rb +1 -1
- data/spec/spec_helper.rb +11 -16
- data/spec/suppository/add_command_spec.rb +37 -41
- data/spec/suppository/cli_spec.rb +19 -22
- data/spec/suppository/command_runner_spec.rb +5 -10
- data/spec/suppository/create_command_spec.rb +22 -27
- data/spec/suppository/dpkg_deb_line_spec.rb +10 -13
- data/spec/suppository/dpkg_deb_spec.rb +25 -29
- data/spec/suppository/gzip_spec.rb.rb +4 -6
- data/spec/suppository/help_command_spec.rb +2 -5
- data/spec/suppository/help_spec.rb +1 -4
- data/spec/suppository/logger_spec.rb +17 -27
- data/spec/suppository/master_deb_spec.rb +30 -39
- data/spec/suppository/package_spec.rb +32 -37
- data/spec/suppository/release_spec.rb +1 -0
- data/spec/suppository/repository_spec.rb +20 -25
- data/spec/suppository/tty_spec.rb +24 -39
- data/spec/suppository/version_command_spec.rb +2 -5
- data/spec/suppository/version_spec.rb +1 -5
- data/spec/suppository_spec.rb +23 -31
- data/suppository.gemspec +17 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzUzYWU5N2UzZWUyMTQ5MjNhYzBlMWVmNzY3MzkwZjU2YTcyYjM4YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWI3ZGNhN2VmYWY5NTU2ZmI1ZDYyYTczZDE3OTdhZjk5NzY0MjQ1MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjUxYmNmOTVjN2U1NzhhNmI3N2M3OWFhNzJhZTM2YjdkYzY1OGM4ODZmMWEy
|
10
|
+
YjRjNTQ4YTA5ZGM0NDUyYWI2ZWYwMDUyZWY5NGQ0YzQ0MGE1NzVjNGY5OGNk
|
11
|
+
NTQ0MjMyYzdlZTZjMjViODYyYjk0ZDBkYjA0ZGZlYWRjYTNlM2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDEyOTY0NTU2MTk2YjMwZjllZWQyMDhkNWQ1Y2M1YmJhOGViM2QyZjQ4ODY3
|
14
|
+
ZjJhMGFhOThjYjMzNTRiYzNkNWQ1M2E1YjcyNDdlNGZlMGRjM2UwZTVlNzUz
|
15
|
+
MzQ2YzkzZGMzM2IyMDY2OTA1Nzk4OWNhNDEzYTFhZTI0ZmRjMWM=
|
data/Guardfile
CHANGED
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
25
|
|
26
|
-
guard :rspec
|
26
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
27
27
|
watch(%r{^spec/.+_spec\.rb$})
|
28
28
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
29
|
-
watch('spec/spec_helper.rb') {
|
29
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
30
30
|
end
|
data/README.md
CHANGED
@@ -71,7 +71,7 @@ This will run all the tests and then create a gem file. NOTE: Only files tracked
|
|
71
71
|
|
72
72
|
Check everything build and the tests pass
|
73
73
|
|
74
|
-
$ bundle exec build
|
74
|
+
$ bundle exec rake build
|
75
75
|
|
76
76
|
Create release using GitFlow (http://danielkummer.github.io/git-flow-cheatsheet/)
|
77
77
|
|
data/Rakefile
CHANGED
@@ -4,11 +4,11 @@ require 'rspec/core/rake_task'
|
|
4
4
|
require 'rubocop/rake_task'
|
5
5
|
require 'suppository/version'
|
6
6
|
|
7
|
-
desc
|
8
|
-
task :
|
7
|
+
desc 'Run Code quality checks and tests '
|
8
|
+
task default: [:clean, :rubocop, :test]
|
9
9
|
|
10
|
-
desc
|
11
|
-
task :
|
10
|
+
desc 'Run Code quality checks, tests and then create Gem File'
|
11
|
+
task build: [:clean, :rubocop, :test, :gem]
|
12
12
|
|
13
13
|
CLEAN.include("suppository-#{Suppository::VERSION}.gem")
|
14
14
|
CLEAN.include('coverage')
|
@@ -18,8 +18,8 @@ task :test do
|
|
18
18
|
t.pattern = 'spec/**/*_spec.rb'
|
19
19
|
t.verbose = false
|
20
20
|
end
|
21
|
-
|
22
|
-
Rake::Task[
|
21
|
+
|
22
|
+
Rake::Task['spec'].execute
|
23
23
|
end
|
24
24
|
|
25
25
|
task :rubocop do
|
@@ -30,5 +30,5 @@ task :rubocop do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
task :gem do
|
33
|
-
system
|
33
|
+
system 'gem build suppository.gemspec'
|
34
34
|
end
|
data/bin/suppository
CHANGED
@@ -5,16 +5,16 @@ require_relative '../lib/suppository/cli'
|
|
5
5
|
require_relative '../lib/suppository/logger'
|
6
6
|
require_relative '../lib/suppository/help'
|
7
7
|
|
8
|
-
std_trap = trap(
|
8
|
+
std_trap = trap('INT') { exit! 130 } # no backtrace thanks
|
9
9
|
|
10
10
|
begin
|
11
|
-
trap(
|
11
|
+
trap('INT', std_trap) # restore default CTRL-C handler
|
12
12
|
Suppository::CLI.run(ARGV)
|
13
13
|
rescue UsageError
|
14
|
-
Suppository::Logger.log_error
|
14
|
+
Suppository::Logger.log_error 'Invalid usage'
|
15
15
|
abort Suppository.help
|
16
16
|
rescue SystemExit
|
17
|
-
puts
|
17
|
+
puts 'Kernel.exit' if ARGV.verbose?
|
18
18
|
raise
|
19
19
|
rescue Interrupt => e
|
20
20
|
puts # seemingly a newline is typical
|
@@ -30,7 +30,3 @@ rescue Exception => e
|
|
30
30
|
puts e.backtrace
|
31
31
|
exit 1
|
32
32
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
@@ -72,18 +72,27 @@ module Suppository
|
|
72
72
|
def create_dist_file(master_file, deb)
|
73
73
|
@repository.archs.each do |arch|
|
74
74
|
FileUtils.ln_s master_file, dist_file(arch, deb), force: true
|
75
|
-
update_packages
|
75
|
+
update_packages arch
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def update_packages(
|
80
|
-
deb = Suppository::MasterDeb.new(master_file)
|
79
|
+
def update_packages(arch)
|
81
80
|
file = package_file(arch)
|
82
|
-
|
83
|
-
|
81
|
+
FileUtils.rm(file)
|
82
|
+
FileUtils.rm("#{file}.gz")
|
83
|
+
Dir.glob("#{component_path}/binary-#{arch}/*deb").each do |deb_link|
|
84
|
+
update_package(deb_link, arch)
|
85
|
+
end
|
84
86
|
Suppository::Gzip.compress file
|
85
87
|
end
|
86
88
|
|
89
|
+
def update_package(deb_link, arch)
|
90
|
+
master_file = File.symlink?(deb_link) ? File.readlink(deb_link) : deb_link
|
91
|
+
deb = Suppository::MasterDeb.new(master_file)
|
92
|
+
package_info = Suppository::Package.new(internal_path(arch), deb).content
|
93
|
+
open(package_file(arch), 'a') { |f| f.puts package_info }
|
94
|
+
end
|
95
|
+
|
87
96
|
def dist_file(arch, deb)
|
88
97
|
filename = Suppository::MasterDeb.new(suppository_file(deb)).filename
|
89
98
|
"#{component_path}/binary-#{arch}/#{filename}"
|
data/lib/suppository/release.rb
CHANGED
@@ -68,7 +68,7 @@ module Suppository
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def packages
|
71
|
-
@packages ||= Dir.glob("#{@dist_path}/*/*/Packages*")
|
71
|
+
@packages ||= Dir.glob("#{@dist_path}/*/*/Packages*").sort
|
72
72
|
end
|
73
73
|
|
74
74
|
def puts_hash(f, hash)
|
@@ -85,7 +85,7 @@ module Suppository
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def architectures
|
88
|
-
directories("#{@dist_path}/*/*").collect { |d| d.split('-')[1] }.uniq.join(' ')
|
88
|
+
directories("#{@dist_path}/*/*").collect { |d| d.split('-')[1] }.uniq.sort.join(' ')
|
89
89
|
end
|
90
90
|
|
91
91
|
def directories(path_pattern)
|
@@ -4,8 +4,8 @@ module Suppository
|
|
4
4
|
|
5
5
|
def initialize(path)
|
6
6
|
@path = File.expand_path(path)
|
7
|
-
@dists = %w(natty lucid precise saucy trusty)
|
8
|
-
@archs = %w(amd64 i386)
|
7
|
+
@dists = %w(natty lucid precise saucy trusty).sort
|
8
|
+
@archs = %w(amd64 i386).sort
|
9
9
|
@suppository = "#{@path}/.suppository"
|
10
10
|
end
|
11
11
|
|
data/lib/suppository/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -3,19 +3,18 @@ require 'fakefs/spec_helpers'
|
|
3
3
|
require 'rspec/mocks/standalone'
|
4
4
|
require 'stringio'
|
5
5
|
require 'simplecov'
|
6
|
-
require
|
6
|
+
require 'codeclimate-test-reporter'
|
7
7
|
CodeClimate::TestReporter.start
|
8
8
|
|
9
9
|
SimpleCov.start do
|
10
10
|
SimpleCov.minimum_coverage 100
|
11
|
-
SimpleCov.add_filter
|
11
|
+
SimpleCov.add_filter '/spec/'
|
12
12
|
end
|
13
13
|
|
14
14
|
lib = File.expand_path('../lib', __FILE__)
|
15
15
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
16
16
|
|
17
|
-
RSpec.configure do |config|
|
18
|
-
|
17
|
+
RSpec.configure do |config|
|
19
18
|
config.before do
|
20
19
|
$stdout = StringIO.new
|
21
20
|
end
|
@@ -23,8 +22,8 @@ RSpec.configure do |config|
|
|
23
22
|
config.after(:all) do
|
24
23
|
$stdout = STDOUT
|
25
24
|
end
|
26
|
-
|
27
|
-
config.filter_run :
|
25
|
+
|
26
|
+
config.filter_run focus: true
|
28
27
|
config.run_all_when_everything_filtered = true
|
29
28
|
config.color = true
|
30
29
|
config.mock_with :rspec
|
@@ -32,24 +31,20 @@ RSpec.configure do |config|
|
|
32
31
|
config.raise_errors_for_deprecations!
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
begin
|
34
|
+
def get_exception
|
35
|
+
e_message = ''
|
36
|
+
begin
|
39
37
|
yield
|
40
38
|
rescue => e
|
41
39
|
e_message = e.message
|
42
|
-
end
|
40
|
+
end
|
43
41
|
e_message
|
44
42
|
end
|
45
43
|
|
46
44
|
def deb_file
|
47
|
-
File.expand_path(File.dirname(__FILE__)+
|
45
|
+
File.expand_path(File.dirname(__FILE__) + '../../fixtures/curl_7.22.0-3ubuntu4.11_amd64.deb')
|
48
46
|
end
|
49
47
|
|
50
48
|
def deb_file_glob
|
51
|
-
File.expand_path(File.dirname(__FILE__)+
|
49
|
+
File.expand_path(File.dirname(__FILE__) + '../../fixtures/*.deb')
|
52
50
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
@@ -7,9 +7,8 @@ require 'suppository/create_command'
|
|
7
7
|
require 'suppository/exceptions'
|
8
8
|
|
9
9
|
describe Suppository::AddCommand do
|
10
|
-
|
11
10
|
before(:each) do
|
12
|
-
repository_path = "/tmp/
|
11
|
+
repository_path = "/tmp/suppository_test_#{Time.now.to_f}"
|
13
12
|
@file_name = 'e5ca0a9797acda4bfe8404524f0976b3_b37ce9b17405d93c323c0b8bbe167c6f2dccfe02_5a315c56bc34f1ffed365f9aa50bbb36916e5a8fae8614f00d952983d4316555.deb'
|
14
13
|
@second_file = '2f860ed12d2ad99bacc78d95fb9e7989_323ee30c17a0ca4bbb2b95032fc79f84f4ca26f2_66bce137768403d517468a1f70bd98644558cd000f250dd8cc2faeedda5d4b2f.deb'
|
15
14
|
@repository = Suppository::Repository.new(repository_path)
|
@@ -32,26 +31,26 @@ describe Suppository::AddCommand do
|
|
32
31
|
expect(File.file?("#{@repository.suppository}/#{@file_name}")).to be_truthy
|
33
32
|
end
|
34
33
|
|
35
|
-
describe
|
34
|
+
describe 'expects release to work -' do
|
36
35
|
before(:each) do
|
37
36
|
release = double(Suppository::Release)
|
38
37
|
expect(release).to receive(:create)
|
39
38
|
expect(Suppository::Release).to receive(:new).with(@repository.path, @dist, false) { release }
|
40
39
|
end
|
41
40
|
|
42
|
-
it
|
41
|
+
it 'add suppository file' do
|
43
42
|
@adder.run
|
44
43
|
expect(File.file?("#{@repository.suppository}/#{@file_name}")).to be_truthy
|
45
44
|
end
|
46
45
|
|
47
|
-
it
|
46
|
+
it 'supports globs for deb file' do
|
48
47
|
@adder = Suppository::AddCommand.new([@repository.path, @dist, @component, deb_file_glob])
|
49
48
|
@adder.run
|
50
49
|
expect(File.file?("#{@repository.suppository}/#{@file_name}")).to be_truthy
|
51
50
|
expect(File.file?("#{@repository.suppository}/#{@second_file}")).to be_truthy
|
52
51
|
end
|
53
52
|
|
54
|
-
it
|
53
|
+
it 'adds package to dists' do
|
55
54
|
@adder.run
|
56
55
|
@repository.dists.each do |dist|
|
57
56
|
@repository.archs.each do |arch|
|
@@ -64,8 +63,7 @@ describe Suppository::AddCommand do
|
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
|
-
|
68
|
-
it "updates Packages file" do
|
66
|
+
it 'updates Packages file' do
|
69
67
|
supository_file = "#{@repository.suppository}/#{@file_name}"
|
70
68
|
@adder.run
|
71
69
|
@repository.archs.each do |arch|
|
@@ -78,7 +76,7 @@ describe Suppository::AddCommand do
|
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
81
|
-
it
|
79
|
+
it 'updates Packages.gz file' do
|
82
80
|
supository_file = "#{@repository.suppository}/#{@file_name}"
|
83
81
|
@adder.run
|
84
82
|
@repository.archs.each do |arch|
|
@@ -86,56 +84,54 @@ describe Suppository::AddCommand do
|
|
86
84
|
path = "#{@repository.path}/#{internal_path}"
|
87
85
|
packages_path = "#{path}/Packages.gz"
|
88
86
|
deb = Suppository::MasterDeb.new(supository_file)
|
89
|
-
content = Suppository::Package.new(internal_path,deb).content
|
90
|
-
result =
|
91
|
-
Zlib::GzipReader.open(packages_path)
|
87
|
+
content = Suppository::Package.new(internal_path, deb).content
|
88
|
+
result = ''
|
89
|
+
Zlib::GzipReader.open(packages_path) do|gz|
|
92
90
|
result << gz.read
|
93
|
-
|
91
|
+
end
|
94
92
|
|
95
93
|
expect(result).to match content
|
96
94
|
end
|
97
95
|
end
|
98
96
|
end
|
99
|
-
|
100
|
-
it
|
101
|
-
adder = Suppository::AddCommand.new([@repository.path, 'new_dist', @component, deb_file])
|
102
|
-
expect
|
103
|
-
|
104
|
-
|
97
|
+
|
98
|
+
it 'cant add package to new dists' do
|
99
|
+
adder = Suppository::AddCommand.new([@repository.path, 'new_dist', @component, deb_file])
|
100
|
+
expect do
|
101
|
+
adder.run
|
102
|
+
end.to raise_error(InvalidDistribution)
|
105
103
|
end
|
106
|
-
|
107
|
-
it
|
104
|
+
|
105
|
+
it 'cant add package to new component' do
|
108
106
|
adder = Suppository::AddCommand.new([@repository.path, @dist, 'testing', deb_file])
|
109
|
-
expect
|
107
|
+
expect do
|
110
108
|
adder.run
|
111
|
-
|
109
|
+
end.to raise_error(InvalidComponent)
|
112
110
|
end
|
113
|
-
|
114
|
-
it
|
111
|
+
|
112
|
+
it 'cant add package to non existant repository' do
|
115
113
|
adder = Suppository::AddCommand.new(['boom', @dist, 'testing', deb_file])
|
116
|
-
|
117
|
-
expect
|
114
|
+
|
115
|
+
expect do
|
118
116
|
adder.run
|
119
|
-
|
117
|
+
end.to raise_error(InvalidRepositoryError)
|
120
118
|
end
|
121
|
-
|
122
|
-
it
|
123
|
-
expect
|
119
|
+
|
120
|
+
it 'needs non nil arguments' do
|
121
|
+
expect do
|
124
122
|
Suppository::AddCommand.new(nil)
|
125
|
-
|
123
|
+
end.to raise_error(UsageError)
|
126
124
|
end
|
127
|
-
|
128
|
-
it
|
129
|
-
expect
|
125
|
+
|
126
|
+
it 'needs arguments' do
|
127
|
+
expect do
|
130
128
|
Suppository::AddCommand.new([])
|
131
|
-
|
129
|
+
end.to raise_error(UsageError)
|
132
130
|
end
|
133
131
|
|
134
|
-
it
|
135
|
-
expect
|
132
|
+
it 'needs four arguments' do
|
133
|
+
expect do
|
136
134
|
Suppository::AddCommand.new([@repository.path, @dist, 'testing'])
|
137
|
-
|
135
|
+
end.to raise_error(UsageError)
|
138
136
|
end
|
139
|
-
|
140
137
|
end
|
141
|
-
|
@@ -7,44 +7,41 @@ require 'suppository/create_command'
|
|
7
7
|
require 'suppository/add_command'
|
8
8
|
|
9
9
|
describe Suppository::CLI do
|
10
|
-
|
11
10
|
before(:each) do
|
12
11
|
@path = '/tmp/repo123'
|
13
12
|
@repository = double(Suppository::Repository)
|
14
13
|
end
|
15
|
-
|
16
|
-
it
|
14
|
+
|
15
|
+
it 'shows current version' do
|
17
16
|
command = double(Suppository::VersionCommand)
|
18
|
-
expect(Suppository::VersionCommand).to receive(:new).with([]) {command}
|
17
|
+
expect(Suppository::VersionCommand).to receive(:new).with([]) { command }
|
19
18
|
expect(command).to receive(:run)
|
20
19
|
Suppository::CLI.run(['version'])
|
21
20
|
end
|
22
|
-
|
23
|
-
it
|
21
|
+
|
22
|
+
it 'can create new repository' do
|
24
23
|
creator = double(Suppository::CreateCommand)
|
25
|
-
expect(Suppository::CreateCommand).to receive(:new).with([@path]) {creator}
|
24
|
+
expect(Suppository::CreateCommand).to receive(:new).with([@path]) { creator }
|
26
25
|
expect(creator).to receive(:run)
|
27
26
|
Suppository::CLI.run(['create', @path])
|
28
27
|
end
|
29
|
-
|
30
|
-
it
|
28
|
+
|
29
|
+
it 'can add deb repository' do
|
31
30
|
adder = double(Suppository::AddCommand)
|
32
|
-
expect(Suppository::AddCommand).to receive(:new).with([@path, 'trusty', '/tmp/example.deb']) {adder}
|
33
|
-
expect(adder).to receive(:run)
|
34
|
-
Suppository::CLI.run(['add', @path
|
31
|
+
expect(Suppository::AddCommand).to receive(:new).with([@path, 'trusty', '/tmp/example.deb']) { adder }
|
32
|
+
expect(adder).to receive(:run)
|
33
|
+
Suppository::CLI.run(['add', @path, 'trusty', '/tmp/example.deb'])
|
35
34
|
end
|
36
|
-
|
37
|
-
it
|
38
|
-
expect
|
35
|
+
|
36
|
+
it 'rase usage error for empty args' do
|
37
|
+
expect do
|
39
38
|
Suppository::CLI.run([])
|
40
|
-
|
39
|
+
end.to raise_error(UsageError)
|
41
40
|
end
|
42
|
-
|
43
|
-
it
|
44
|
-
expect
|
41
|
+
|
42
|
+
it 'rase usage error for invalid command' do
|
43
|
+
expect do
|
45
44
|
Suppository::CLI.run(['bla'])
|
46
|
-
|
45
|
+
end.to raise_error(UsageError)
|
47
46
|
end
|
48
47
|
end
|
49
|
-
|
50
|
-
|
@@ -4,23 +4,18 @@ require 'suppository/command_runner'
|
|
4
4
|
require 'suppository/exceptions'
|
5
5
|
|
6
6
|
describe Suppository::CommandRunner do
|
7
|
-
|
8
|
-
it "run command" do
|
7
|
+
it 'run command' do
|
9
8
|
runner = Suppository::CommandRunner.new('echo', '1234')
|
10
9
|
expect(runner.run).to eql("1234\n")
|
11
10
|
end
|
12
|
-
|
13
|
-
it
|
11
|
+
|
12
|
+
it 'command not found' do
|
14
13
|
runner = Suppository::CommandRunner.new('notavalidcommand')
|
15
14
|
expect { runner.run }.to raise_error(CommandMissingError)
|
16
15
|
end
|
17
|
-
|
18
|
-
it
|
16
|
+
|
17
|
+
it 'command error' do
|
19
18
|
runner = Suppository::CommandRunner.new('man', '--invalidoption')
|
20
19
|
expect { runner.run }.to raise_error(CommandError)
|
21
20
|
end
|
22
|
-
|
23
|
-
|
24
21
|
end
|
25
|
-
|
26
|
-
|
@@ -4,33 +4,31 @@ require 'suppository/create_command'
|
|
4
4
|
require 'suppository/repository'
|
5
5
|
|
6
6
|
describe Suppository::CreateCommand do
|
7
|
-
|
8
7
|
before(:each) do
|
9
8
|
repository_path = "/tmp/suppository_test_#{Time.now.to_f}"
|
10
9
|
@repository = Suppository::Repository.new(repository_path)
|
11
10
|
@creator = Suppository::CreateCommand.new([@repository.path])
|
12
11
|
end
|
13
|
-
|
12
|
+
|
14
13
|
after(:each) do
|
15
|
-
FileUtils.rm_r(@repository.path) if File.directory?(@repository.path)
|
14
|
+
FileUtils.rm_r(@repository.path) if File.directory?(@repository.path)
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect{@creator.run}.to output("==> Created new Repository - #{@repository.path}\n").to_stdout
|
17
|
+
it 'can create new repository' do
|
18
|
+
expect { @creator.run }.to output("==> Created new Repository - #{@repository.path}\n").to_stdout
|
20
19
|
end
|
21
20
|
|
22
|
-
|
23
|
-
it "creates repository root folder" do
|
21
|
+
it 'creates repository root folder' do
|
24
22
|
@creator.run
|
25
23
|
expect(File.directory?(@repository.path)).to be_truthy
|
26
24
|
end
|
27
25
|
|
28
|
-
it
|
26
|
+
it 'creates a .supository file' do
|
29
27
|
@creator.run
|
30
28
|
expect(File.directory?("#{@repository.path}/.suppository")).to be_truthy
|
31
29
|
end
|
32
|
-
|
33
|
-
it
|
30
|
+
|
31
|
+
it 'creates a Packages file' do
|
34
32
|
@creator.run
|
35
33
|
@repository.dists.each do |dist|
|
36
34
|
@repository.archs.each do |arch|
|
@@ -38,24 +36,23 @@ describe Suppository::CreateCommand do
|
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
41
|
-
|
42
|
-
it
|
39
|
+
|
40
|
+
it 'creates a Packages.gz file' do
|
43
41
|
@creator.run
|
44
42
|
@repository.dists.each do |dist|
|
45
43
|
@repository.archs.each do |arch|
|
46
|
-
file_name = "#{@repository.path}/dists/#{dist}/internal/binary-#{arch}/Packages.gz"
|
44
|
+
file_name = "#{@repository.path}/dists/#{dist}/internal/binary-#{arch}/Packages.gz"
|
47
45
|
expect(Zlib::GzipReader.open(file_name)).to be_truthy
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
52
|
-
|
53
|
-
it "aborts if file suppository already exists" do
|
50
|
+
it 'aborts if file suppository already exists' do
|
54
51
|
FileUtils.mkdir_p @repository.suppository
|
55
|
-
expect(get_exception{@creator.run}).to eql "#{@repository.path} is already a repository"
|
52
|
+
expect(get_exception { @creator.run }).to eql "#{@repository.path} is already a repository"
|
56
53
|
end
|
57
54
|
|
58
|
-
it
|
55
|
+
it 'creates folder structure' do
|
59
56
|
@creator.run
|
60
57
|
@repository.dists.each do |dist|
|
61
58
|
@repository.archs.each do |arch|
|
@@ -63,18 +60,16 @@ describe Suppository::CreateCommand do
|
|
63
60
|
end
|
64
61
|
end
|
65
62
|
end
|
66
|
-
|
67
|
-
it
|
68
|
-
expect
|
63
|
+
|
64
|
+
it 'needs non nil arguments' do
|
65
|
+
expect do
|
69
66
|
Suppository::CreateCommand.new(nil)
|
70
|
-
|
67
|
+
end.to raise_error(UsageError)
|
71
68
|
end
|
72
|
-
|
73
|
-
it
|
74
|
-
expect
|
69
|
+
|
70
|
+
it 'needs arguments' do
|
71
|
+
expect do
|
75
72
|
Suppository::CreateCommand.new([])
|
76
|
-
|
73
|
+
end.to raise_error(UsageError)
|
77
74
|
end
|
78
|
-
|
79
75
|
end
|
80
|
-
|
@@ -3,34 +3,31 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/dpkg_deb_line'
|
4
4
|
|
5
5
|
describe Suppository::DpkgDebLine do
|
6
|
-
|
7
|
-
it "field" do
|
6
|
+
it 'field' do
|
8
7
|
line = 'Depends: libc6 (>= 2.14), libcurl3 (>= 7.16.2-1), zlib1g (>= 1:1.1.4)'
|
9
8
|
values = Suppository::DpkgDebLine.new(line).attributes
|
10
9
|
expect(values['Depends']).to eql 'libc6 (>= 2.14), libcurl3 (>= 7.16.2-1), zlib1g (>= 1:1.1.4)'
|
11
10
|
end
|
12
|
-
|
13
|
-
it
|
11
|
+
|
12
|
+
it 'description first line' do
|
14
13
|
line = 'Description: Get a file from an HTTP, HTTPS or FTP server'
|
15
14
|
values = Suppository::DpkgDebLine.new(line).attributes
|
16
15
|
expect(values['Description']).to eql 'Get a file from an HTTP, HTTPS or FTP server'
|
17
16
|
end
|
18
|
-
|
19
|
-
it
|
17
|
+
|
18
|
+
it 'description other line' do
|
20
19
|
line = ' curl is a client to get files from servers using any of the supported'
|
21
20
|
values = Suppository::DpkgDebLine.new(line).attributes
|
22
21
|
expect(values['Description']).to eql ' curl is a client to get files from servers using any of the supported'
|
23
22
|
end
|
24
|
-
|
25
|
-
it
|
23
|
+
|
24
|
+
it 'dot' do
|
26
25
|
line = ' .'
|
27
26
|
values = Suppository::DpkgDebLine.new(line).attributes
|
28
27
|
expect(values['Description']).to eql ' .'
|
29
28
|
end
|
30
|
-
|
31
|
-
it
|
32
|
-
expect(get_exception{Suppository::DpkgDebLine.new
|
29
|
+
|
30
|
+
it 'handles invalid' do
|
31
|
+
expect(get_exception { Suppository::DpkgDebLine.new 'Boom Bang' }).to eql "can't parse line - 'Boom Bang'"
|
33
32
|
end
|
34
|
-
|
35
33
|
end
|
36
|
-
|