suppository 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.ruby-version +1 -1
- data/.travis.yml +7 -5
- data/Gemfile +2 -0
- data/Guardfile +2 -0
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/bin/suppository +2 -0
- data/lib/suppository/add_command.rb +14 -6
- data/lib/suppository/checksummed.rb +2 -0
- data/lib/suppository/cli.rb +3 -1
- data/lib/suppository/command_runner.rb +5 -3
- data/lib/suppository/create_command.rb +5 -3
- data/lib/suppository/dpkg_deb.rb +2 -0
- data/lib/suppository/dpkg_deb_line.rb +3 -1
- data/lib/suppository/exceptions.rb +5 -0
- data/lib/suppository/gzip.rb +2 -0
- data/lib/suppository/help.rb +11 -9
- data/lib/suppository/help_command.rb +2 -2
- data/lib/suppository/logger.rb +2 -0
- data/lib/suppository/master_deb.rb +4 -2
- data/lib/suppository/package.rb +4 -2
- data/lib/suppository/release.rb +16 -8
- data/lib/suppository/repository.rb +4 -2
- data/lib/suppository/tty.rb +2 -0
- data/lib/suppository/version.rb +3 -1
- data/lib/suppository/version_command.rb +3 -2
- data/lib/suppository.rb +2 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/suppository/add_command_spec.rb +11 -9
- data/spec/suppository/cli_spec.rb +2 -0
- data/spec/suppository/command_runner_spec.rb +2 -0
- data/spec/suppository/create_command_spec.rb +2 -0
- data/spec/suppository/dpkg_deb_line_spec.rb +2 -0
- data/spec/suppository/dpkg_deb_spec.rb +2 -0
- data/spec/suppository/gzip_spec.rb.rb +2 -0
- data/spec/suppository/help_command_spec.rb +2 -0
- data/spec/suppository/help_spec.rb +19 -1
- data/spec/suppository/logger_spec.rb +2 -0
- data/spec/suppository/master_deb_spec.rb +6 -4
- data/spec/suppository/package_spec.rb +2 -0
- data/spec/suppository/release_spec.rb +29 -29
- data/spec/suppository/repository_spec.rb +4 -2
- data/spec/suppository/tty_spec.rb +2 -0
- data/spec/suppository/version_command_spec.rb +2 -0
- data/spec/suppository/version_spec.rb +2 -0
- data/spec/suppository_spec.rb +3 -1
- data/suppository.gemspec +5 -3
- metadata +38 -38
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZWI3ZGNhN2VmYWY5NTU2ZmI1ZDYyYTczZDE3OTdhZjk5NzY0MjQ1MA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9fe676598bd46189561acd6f6921b69b92305b4
|
4
|
+
data.tar.gz: a7936a2ffed2f98867547c2d34374785790dde7e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YjRjNTQ4YTA5ZGM0NDUyYWI2ZWYwMDUyZWY5NGQ0YzQ0MGE1NzVjNGY5OGNk
|
11
|
-
NTQ0MjMyYzdlZTZjMjViODYyYjk0ZDBkYjA0ZGZlYWRjYTNlM2E=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDEyOTY0NTU2MTk2YjMwZjllZWQyMDhkNWQ1Y2M1YmJhOGViM2QyZjQ4ODY3
|
14
|
-
ZjJhMGFhOThjYjMzNTRiYzNkNWQ1M2E1YjcyNDdlNGZlMGRjM2UwZTVlNzUz
|
15
|
-
MzQ2YzkzZGMzM2IyMDY2OTA1Nzk4OWNhNDEzYTFhZTI0ZmRjMWM=
|
6
|
+
metadata.gz: 226d2bba2d02260b961a3c70fe121d7522a1640bf835ad795608294e279fd91c10cc673a59037fdbfbe1d0b198b2ebb11dedb7cc83aa624222342b12749abe60
|
7
|
+
data.tar.gz: 1d349096ca91a22fa62d68ca2afa8b5cfa1166bfe3afef0ab5e0a2d017e89bccd6847f3c1fe6b18071fee2ff56e5ef848484116bfb7362cb3a5865a349d1b1cf
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.4.1
|
data/.travis.yml
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
rvm:
|
4
|
-
-
|
5
|
-
- 2.
|
6
|
-
- 2.1
|
7
|
-
- 2.2.0
|
4
|
+
- 2.2.5
|
5
|
+
- 2.3.0
|
6
|
+
- 2.4.1
|
8
7
|
addons:
|
9
8
|
code_climate:
|
10
9
|
repo_token:
|
11
10
|
secure: GJm/TrjSneaH39Q+pI0awm5rkIjvAqqO8Ob7z6RZ18zu7maACYsL9owQ7Fa8zfC9DALGk2RSUikUdlONM+lTetBjT600PZmtTETpeVaZx8pf6Zn8KIgGsejIPV91cpMaavQbVceuA+NUn3eLWK18FvmYpZzQv+ps7/bkmYx+oTQ=
|
11
|
+
after_success:
|
12
|
+
- bundle exec codeclimate-test-reporter
|
12
13
|
deploy:
|
13
14
|
provider: rubygems
|
14
15
|
api_key:
|
15
16
|
secure: gE9BoetPOYM2BbhUGZb35UhMoY1Rjv7KUMyMKJ2f5ceQrIp+Qi+rqrRyvt8Fu9EcnLgE1XjB+PxpMKxOeWKYUzVRgQdjpjYU/c+v8bHh7jfblixwum4BhoGaiQkrK+A42we9hTmu4dNALnm5vTMhsN/bPFaRgFB15bk4UYOTZNM=
|
16
17
|
gem: suppository
|
17
18
|
on:
|
18
|
-
ruby: 2.
|
19
|
+
ruby: 2.4.1
|
20
|
+
tags: true
|
19
21
|
repo: TheBookPeople/suppository
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Super Simple Apt Repository
|
2
|
-
[![Build Status](https://travis-ci.org/TheBookPeople/suppository.svg?branch=develop)](https://travis-ci.org/TheBookPeople/suppository) [![Code Climate](https://codeclimate.com/github/TheBookPeople/suppository/badges/gpa.svg)](https://codeclimate.com/github/TheBookPeople/suppository) [![Test Coverage](https://codeclimate.com/github/TheBookPeople/suppository/badges/coverage.svg)](https://codeclimate.com/github/TheBookPeople/suppository) [![Gem Version](https://badge.fury.io/rb/suppository.svg)](http://badge.fury.io/rb/suppository)
|
2
|
+
[![Build Status](https://travis-ci.org/TheBookPeople/suppository.svg?branch=develop)](https://travis-ci.org/TheBookPeople/suppository) [![Code Climate](https://codeclimate.com/github/TheBookPeople/suppository/badges/gpa.svg)](https://codeclimate.com/github/TheBookPeople/suppository) [![Test Coverage](https://codeclimate.com/github/TheBookPeople/suppository/badges/coverage.svg)](https://codeclimate.com/github/TheBookPeople/suppository) [![Gem Version](https://badge.fury.io/rb/suppository.svg)](http://badge.fury.io/rb/suppository) ![Gem Dependency](https://img.shields.io/gemnasium/TheBookPeople/suppository.svg)
|
3
3
|
|
4
4
|
Based on the ideas from Super Simple Apt Repository https://github.com/lukepfarrar/suppository.
|
5
5
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake'
|
2
4
|
require 'rake/clean'
|
3
5
|
require 'rspec/core/rake_task'
|
@@ -5,10 +7,10 @@ require 'rubocop/rake_task'
|
|
5
7
|
require 'suppository/version'
|
6
8
|
|
7
9
|
desc 'Run Code quality checks and tests '
|
8
|
-
task default: [
|
10
|
+
task default: %i[clean rubocop test]
|
9
11
|
|
10
12
|
desc 'Run Code quality checks, tests and then create Gem File'
|
11
|
-
task build: [
|
13
|
+
task build: %i[clean rubocop test gem]
|
12
14
|
|
13
15
|
CLEAN.include("suppository-#{Suppository::VERSION}.gem")
|
14
16
|
CLEAN.include('coverage')
|
data/bin/suppository
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'suppository/master_deb'
|
3
5
|
require 'suppository/repository'
|
4
6
|
require 'suppository/exceptions'
|
@@ -25,6 +27,7 @@ module Suppository
|
|
25
27
|
assert_repository_exists
|
26
28
|
assert_dist_exists
|
27
29
|
assert_component_exists
|
30
|
+
assert_debs_exist
|
28
31
|
|
29
32
|
@debs.each { |deb| add_deb Suppository::Checksummed.new(deb) }
|
30
33
|
|
@@ -34,8 +37,8 @@ module Suppository
|
|
34
37
|
private
|
35
38
|
|
36
39
|
def parse_params(args)
|
37
|
-
|
38
|
-
|
40
|
+
raise UsageError if args.nil? || args.length < 4 || args.length > 5
|
41
|
+
raise UsageError if args.length == 5 && args[4] != '--unsigned'
|
39
42
|
args.length == 5
|
40
43
|
end
|
41
44
|
|
@@ -47,22 +50,27 @@ module Suppository
|
|
47
50
|
log_success message
|
48
51
|
end
|
49
52
|
|
53
|
+
def assert_debs_exist
|
54
|
+
raise MissingFile, 'No valid *.deb has been provided.' if @debs.empty?
|
55
|
+
end
|
56
|
+
|
50
57
|
def assert_repository_exists
|
51
|
-
message =
|
58
|
+
message = []
|
59
|
+
message << "#{@repository.path} is not a valid repository.\n"
|
52
60
|
message << "You can create a new repository by running the following command\n\n"
|
53
61
|
message << " suppository create #{@repository.path}"
|
54
|
-
|
62
|
+
raise InvalidRepositoryError, message.join('') unless @repository.exist?
|
55
63
|
end
|
56
64
|
|
57
65
|
def assert_dist_exists
|
58
66
|
supported_dist = @repository.dists.join(', ')
|
59
67
|
message = "#{@dist} does not exist, try one of the following #{supported_dist}"
|
60
|
-
|
68
|
+
raise InvalidDistribution, message unless File.exist?(dist_path.to_s)
|
61
69
|
end
|
62
70
|
|
63
71
|
def assert_component_exists
|
64
72
|
message = "#{@component} does not exist, try internal instead"
|
65
|
-
|
73
|
+
raise InvalidComponent, message unless File.exist?(component_path.to_s)
|
66
74
|
end
|
67
75
|
|
68
76
|
def create_suppository_file(deb)
|
data/lib/suppository/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'English'
|
2
4
|
require 'suppository/exceptions'
|
3
5
|
|
@@ -17,13 +19,13 @@ module Suppository
|
|
17
19
|
|
18
20
|
def assert_exists
|
19
21
|
`which "#{@command}"`
|
20
|
-
message =
|
21
|
-
|
22
|
+
message = "'#{@command}' was not found."
|
23
|
+
raise(CommandMissingError, message) unless $CHILD_STATUS.success?
|
22
24
|
end
|
23
25
|
|
24
26
|
def run_command
|
25
27
|
output = `#{@command} #{@arguments} 2>&1`
|
26
|
-
|
28
|
+
raise(CommandError, output) unless $CHILD_STATUS.success?
|
27
29
|
output
|
28
30
|
end
|
29
31
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'fileutils'
|
3
5
|
require 'suppository/logger'
|
4
6
|
require 'suppository/repository'
|
@@ -23,7 +25,7 @@ module Suppository
|
|
23
25
|
|
24
26
|
def assert_arguments(args)
|
25
27
|
message = 'Create command needs one argument, the path to the new repository'
|
26
|
-
|
28
|
+
raise UsageError, message if args.nil? || args.length != 1
|
27
29
|
end
|
28
30
|
|
29
31
|
def repository(path)
|
@@ -31,11 +33,11 @@ module Suppository
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def assert_not_created
|
34
|
-
@repository.exist? ?
|
36
|
+
@repository.exist? ? raise("#{path} is already a repository") : ''
|
35
37
|
end
|
36
38
|
|
37
39
|
def create_repository
|
38
|
-
FileUtils.mkdir_p
|
40
|
+
FileUtils.mkdir_p suppository.to_s
|
39
41
|
create_dists_folders
|
40
42
|
log_success "Created new Repository - #{path}"
|
41
43
|
end
|
data/lib/suppository/dpkg_deb.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Suppository
|
2
4
|
class DpkgDebLine
|
3
5
|
DESCRIPTION_FIELD = 'Description'
|
@@ -11,7 +13,7 @@ module Suppository
|
|
11
13
|
elsif field
|
12
14
|
@attributes = { field['fieldname'] => field['fieldvalue'] }
|
13
15
|
else
|
14
|
-
|
16
|
+
raise "can't parse line - '#{line}'"
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
data/lib/suppository/gzip.rb
CHANGED
data/lib/suppository/help.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
HELP = <<-EOS
|
2
|
-
Example usage:
|
4
|
+
Example usage:
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
suppository help
|
7
|
+
- Display this Help message
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
suppository version
|
10
|
+
- Display version
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
suppository create <REPOSITORY_PATH>
|
13
|
+
- Create new empty repository in REPOSITORY_PATH
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
suppository add <REPOSITORY_PATH> <DIST> <COMPONENT> <DEB_FILE> [--unsigned]
|
16
|
+
- Add DEB_FILE to DIST and COMPONENT of repository at REPOSITORY_PATH
|
15
17
|
|
16
18
|
EOS
|
17
19
|
|
data/lib/suppository/logger.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'suppository/exceptions'
|
2
4
|
require 'suppository/dpkg_deb'
|
3
5
|
|
@@ -40,7 +42,7 @@ module Suppository
|
|
40
42
|
|
41
43
|
def assert_in_suppository
|
42
44
|
message = 'Master deb must be in the .suppository folder'
|
43
|
-
|
45
|
+
raise InvalidMasterDeb, message unless suppository_file?
|
44
46
|
end
|
45
47
|
|
46
48
|
def suppository_file?
|
@@ -51,7 +53,7 @@ module Suppository
|
|
51
53
|
file_name = File.basename(@path)
|
52
54
|
matches = filename_regex.match(file_name)
|
53
55
|
message = 'Master deb must have the following name {md5}_{sha1}_{sha256}.deb'
|
54
|
-
|
56
|
+
raise InvalidMasterDeb, message unless matches
|
55
57
|
matches
|
56
58
|
end
|
57
59
|
|
data/lib/suppository/package.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
module Suppository
|
3
5
|
class Package
|
4
6
|
def initialize(parent_folder, deb)
|
@@ -10,8 +12,8 @@ module Suppository
|
|
10
12
|
full_attrs = @deb.full_attr
|
11
13
|
full_attrs[:Filename] = filename
|
12
14
|
full_attrs.sort_by { |k, _v| k == 'Description' ? 1 : 0 }
|
13
|
-
|
14
|
-
|
15
|
+
.to_a.map { |kv_pair| kv_pair.join(': ') }
|
16
|
+
.join("\n") << "\n\n"
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
data/lib/suppository/release.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'suppository/exceptions'
|
2
4
|
require 'suppository/command_runner'
|
3
5
|
require 'fileutils'
|
@@ -19,11 +21,12 @@ module Suppository
|
|
19
21
|
private
|
20
22
|
|
21
23
|
def write_file
|
22
|
-
open(@release_file, 'w') { |f| f.puts content }
|
24
|
+
open(@release_file, 'w') { |f| f.puts content.join('') }
|
23
25
|
end
|
24
26
|
|
25
27
|
def content
|
26
|
-
result =
|
28
|
+
result = []
|
29
|
+
result << "Codename: #{@dist}\n"
|
27
30
|
result << "Architectures: #{architectures}\n"
|
28
31
|
result << "Components: #{components}\n"
|
29
32
|
result << "Date: #{date}\n"
|
@@ -31,32 +34,37 @@ module Suppository
|
|
31
34
|
end
|
32
35
|
|
33
36
|
def package_hashes
|
34
|
-
result =
|
37
|
+
result = []
|
38
|
+
result << md5_hashes
|
35
39
|
result << sha1_hashes
|
36
40
|
result << sha2_hashes
|
37
41
|
result << sha5_hashes
|
38
42
|
end
|
39
43
|
|
40
44
|
def md5_hashes
|
41
|
-
result =
|
45
|
+
result = []
|
46
|
+
result << "MD5Sum:\n"
|
42
47
|
packages.each { |f| result << puts_hash(f, Digest::MD5.file(f)) }
|
43
48
|
result
|
44
49
|
end
|
45
50
|
|
46
51
|
def sha1_hashes
|
47
|
-
result =
|
52
|
+
result = []
|
53
|
+
result << "SHA1:\n"
|
48
54
|
packages.each { |f| result << puts_hash(f, Digest::SHA1.file(f)) }
|
49
55
|
result
|
50
56
|
end
|
51
57
|
|
52
58
|
def sha2_hashes
|
53
|
-
result =
|
59
|
+
result = []
|
60
|
+
result << "SHA256:\n"
|
54
61
|
packages.each { |f| result << puts_hash(f, Digest::SHA256.file(f)) }
|
55
62
|
result
|
56
63
|
end
|
57
64
|
|
58
65
|
def sha5_hashes
|
59
|
-
result =
|
66
|
+
result = []
|
67
|
+
result << "SHA512:\n"
|
60
68
|
packages.each { |f| result << puts_hash(f, Digest::SHA512.file(f)) }
|
61
69
|
result
|
62
70
|
end
|
@@ -73,7 +81,7 @@ module Suppository
|
|
73
81
|
|
74
82
|
def puts_hash(f, hash)
|
75
83
|
relative = f.split(@dist_path).pop[1..-1]
|
76
|
-
|
84
|
+
format(" %s %17d %s\n", hash, File.size(f), relative)
|
77
85
|
end
|
78
86
|
|
79
87
|
def date
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Suppository
|
2
4
|
class Repository
|
3
5
|
attr_reader :path, :dists, :archs, :suppository
|
4
6
|
|
5
7
|
def initialize(path)
|
6
8
|
@path = File.expand_path(path)
|
7
|
-
@dists = %w
|
8
|
-
@archs = %w
|
9
|
+
@dists = %w[natty lucid precise saucy trusty xenial].sort
|
10
|
+
@archs = %w[amd64 i386].sort
|
9
11
|
@suppository = "#{@path}/.suppository"
|
10
12
|
end
|
11
13
|
|
data/lib/suppository/tty.rb
CHANGED
data/lib/suppository/version.rb
CHANGED
data/lib/suppository.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
require 'fakefs/spec_helpers'
|
3
5
|
require 'rspec/mocks/standalone'
|
4
6
|
require 'stringio'
|
5
7
|
require 'simplecov'
|
6
8
|
require 'codeclimate-test-reporter'
|
7
|
-
CodeClimate::TestReporter.start
|
8
9
|
|
9
10
|
SimpleCov.start do
|
10
11
|
SimpleCov.minimum_coverage 100
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'spec_helper'
|
3
5
|
require 'suppository/add_command'
|
4
6
|
require 'suppository/repository'
|
@@ -17,15 +19,15 @@ describe Suppository::AddCommand do
|
|
17
19
|
@component = 'internal'
|
18
20
|
@adder = Suppository::AddCommand.new([@repository.path, @dist, @component, deb_file])
|
19
21
|
end
|
20
|
-
|
22
|
+
|
21
23
|
after(:each) do
|
22
24
|
FileUtils.rm_r @repository.path
|
23
25
|
end
|
24
|
-
|
25
|
-
it
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
|
27
|
+
it 'add the same package again' do
|
28
|
+
release = double(Suppository::Release)
|
29
|
+
expect(release).to receive(:create).twice
|
30
|
+
expect(Suppository::Release).to receive(:new).twice.with(@repository.path, @dist, false) { release }
|
29
31
|
@adder.run
|
30
32
|
@adder.run
|
31
33
|
expect(File.file?("#{@repository.suppository}/#{@file_name}")).to be_truthy
|
@@ -85,12 +87,12 @@ describe Suppository::AddCommand do
|
|
85
87
|
packages_path = "#{path}/Packages.gz"
|
86
88
|
deb = Suppository::MasterDeb.new(supository_file)
|
87
89
|
content = Suppository::Package.new(internal_path, deb).content
|
88
|
-
result =
|
89
|
-
Zlib::GzipReader.open(packages_path) do|gz|
|
90
|
+
result = []
|
91
|
+
Zlib::GzipReader.open(packages_path) do |gz|
|
90
92
|
result << gz.read
|
91
93
|
end
|
92
94
|
|
93
|
-
expect(result).to match content
|
95
|
+
expect(result.join('')).to match content
|
94
96
|
end
|
95
97
|
end
|
96
98
|
end
|
@@ -1,9 +1,27 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'spec_helper'
|
3
5
|
require 'suppository/help'
|
4
6
|
|
5
7
|
describe Suppository do
|
8
|
+
EXPECTED = <<-EOS
|
9
|
+
Example usage:
|
10
|
+
|
11
|
+
suppository help
|
12
|
+
- Display this Help message
|
13
|
+
|
14
|
+
suppository version
|
15
|
+
- Display version
|
16
|
+
|
17
|
+
suppository create <REPOSITORY_PATH>
|
18
|
+
- Create new empty repository in REPOSITORY_PATH
|
19
|
+
|
20
|
+
suppository add <REPOSITORY_PATH> <DIST> <COMPONENT> <DEB_FILE> [--unsigned]
|
21
|
+
- Add DEB_FILE to DIST and COMPONENT of repository at REPOSITORY_PATH
|
22
|
+
|
23
|
+
EOS
|
6
24
|
it 'has usage string' do
|
7
|
-
expect(Suppository.help).to eql(
|
25
|
+
expect(Suppository.help).to eql(EXPECTED)
|
8
26
|
end
|
9
27
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'spec_helper'
|
3
5
|
require 'suppository/master_deb'
|
4
6
|
require 'suppository/dpkg_deb'
|
@@ -45,8 +47,8 @@ describe Suppository::MasterDeb do
|
|
45
47
|
exception = nil
|
46
48
|
begin
|
47
49
|
Suppository::MasterDeb.new(master_deb_file)
|
48
|
-
|
49
|
-
|
50
|
+
rescue InvalidMasterDeb => e
|
51
|
+
exception = e
|
50
52
|
end
|
51
53
|
|
52
54
|
expect(exception.message).to be_eql 'Master deb must be in the .suppository folder'
|
@@ -57,8 +59,8 @@ describe Suppository::MasterDeb do
|
|
57
59
|
exception = nil
|
58
60
|
begin
|
59
61
|
Suppository::MasterDeb.new(master_deb_file)
|
60
|
-
|
61
|
-
|
62
|
+
rescue InvalidMasterDeb => e
|
63
|
+
exception = e
|
62
64
|
end
|
63
65
|
|
64
66
|
expect(exception.message).to be_eql 'Master deb must have the following name {md5}_{sha1}_{sha256}.deb'
|
@@ -1,11 +1,12 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'spec_helper'
|
3
5
|
require 'suppository/release'
|
4
6
|
require 'suppository/create_command'
|
5
7
|
|
6
8
|
describe Suppository::Release do
|
7
|
-
|
8
|
-
RELEASE_CONTENT = <<-EOS
|
9
|
+
RELEASE_CONTENT = <<-EOS
|
9
10
|
Codename: lucid
|
10
11
|
Architectures: amd64 i386
|
11
12
|
Components: internal
|
@@ -31,8 +32,7 @@ SHA512:
|
|
31
32
|
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-i386/Packages
|
32
33
|
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-i386/Packages.gz
|
33
34
|
EOS
|
34
|
-
|
35
|
-
|
35
|
+
|
36
36
|
before(:each) do
|
37
37
|
@repo_path = "/tmp/suppository_test_#{Time.now.to_f}"
|
38
38
|
@dist = 'lucid'
|
@@ -40,42 +40,42 @@ EOS
|
|
40
40
|
Suppository::CreateCommand.new([@repo_path]).run
|
41
41
|
@release_file = "#{@repo_path}/dists/#{@dist}/Release"
|
42
42
|
@release_file_gpg = "#{@release_file}.gpg"
|
43
|
-
|
44
|
-
|
43
|
+
end
|
44
|
+
|
45
45
|
after(:each) do
|
46
46
|
FileUtils.rm_r @repo_path if File.exist? @repo_path
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
it 'has correct content' do
|
50
|
+
@instance.create
|
51
|
+
content = File.read(@release_file)
|
52
|
+
puts content
|
53
|
+
expect(Regexp.new(RELEASE_CONTENT).match content).to be_truthy
|
54
54
|
end
|
55
|
-
|
56
|
-
it
|
57
|
-
|
58
|
-
|
55
|
+
|
56
|
+
it 'creates file' do
|
57
|
+
@instance.create
|
58
|
+
expect(File.exist?(@release_file)).to eql true
|
59
59
|
end
|
60
|
-
|
61
|
-
it
|
62
|
-
|
63
|
-
|
60
|
+
|
61
|
+
it 'creates file' do
|
62
|
+
@instance.create
|
63
|
+
expect(File.exist?(@release_file)).to eql true
|
64
64
|
end
|
65
|
-
|
66
|
-
it
|
67
|
-
|
68
|
-
|
65
|
+
|
66
|
+
it 'unsigned' do
|
67
|
+
@instance.create
|
68
|
+
expect(File.exist?(@release_file_gpg)).to eql false
|
69
69
|
end
|
70
|
-
|
71
|
-
it
|
70
|
+
|
71
|
+
it 'signed' do
|
72
72
|
command_runner = double(Suppository::CommandRunner)
|
73
73
|
args = "-abs -o #{@release_file_gpg} #{@release_file}"
|
74
|
-
expect(Suppository::CommandRunner).to receive(:new).with('gpg',args) {command_runner}
|
75
|
-
expect(command_runner).to receive(:run) {FileUtils.touch(@release_file_gpg)}
|
76
|
-
|
74
|
+
expect(Suppository::CommandRunner).to receive(:new).with('gpg', args) { command_runner }
|
75
|
+
expect(command_runner).to receive(:run) { FileUtils.touch(@release_file_gpg) }
|
76
|
+
|
77
77
|
@instance = Suppository::Release.new(@repo_path, @dist)
|
78
78
|
@instance.create
|
79
|
-
expect(File.
|
79
|
+
expect(File.exist?(@release_file_gpg)).to eql true
|
80
80
|
end
|
81
81
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'spec_helper'
|
3
5
|
require 'suppository/repository'
|
4
6
|
|
5
7
|
describe Suppository::Repository do
|
6
8
|
before(:each) do
|
7
9
|
@repository = Suppository::Repository.new('/tmp/repo123')
|
8
|
-
@dists = %w
|
9
|
-
@archs = %w
|
10
|
+
@dists = %w[natty lucid precise saucy trusty xenial].sort
|
11
|
+
@archs = %w[amd64 i386].sort
|
10
12
|
@suppository = '/tmp/repo123/.suppository'
|
11
13
|
end
|
12
14
|
|
data/spec/suppository_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'suppository/version'
|
3
5
|
require 'English'
|
@@ -51,7 +53,7 @@ describe 'suppository binary' do
|
|
51
53
|
end
|
52
54
|
|
53
55
|
describe 'add' do
|
54
|
-
it 'runs without error'
|
56
|
+
it 'runs without error' do
|
55
57
|
`"#{@cmd}" create #{@repository_path}`
|
56
58
|
`"#{@cmd}" add #{@repository_path} trusty internal "#{deb_file}" --unsigned`
|
57
59
|
expect($CHILD_STATUS.success?).to be_truthy
|
data/suppository.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
lib = File.expand_path('../lib', __FILE__)
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
6
|
require 'suppository/version'
|
@@ -19,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
19
21
|
spec.require_paths = ['lib']
|
20
22
|
|
21
23
|
spec.required_ruby_version = '>= 1.9.3'
|
22
|
-
spec.add_development_dependency 'rake', '~>
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
23
25
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
26
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
25
27
|
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
@@ -29,6 +31,6 @@ Gem::Specification.new do |spec|
|
|
29
31
|
spec.add_development_dependency 'terminal-notifier-guard', '~> 1.6'
|
30
32
|
spec.add_development_dependency 'rubocop', '~> 0.28'
|
31
33
|
spec.add_development_dependency 'fakefs', '~> 0'
|
32
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
33
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.
|
34
|
+
spec.add_development_dependency 'simplecov', '~> 0.13'
|
35
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.8'
|
34
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suppository
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Griffiths
|
@@ -9,176 +9,176 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '12.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '12.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.7'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.7'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '3.1'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '3.1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: guard-rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '4.5'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '4.5'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rb-inotify
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ~>
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0.9'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - ~>
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0.9'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rb-fsevent
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - ~>
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0.9'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - ~>
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0.9'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rb-fchange
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - ~>
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0.0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - ~>
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: terminal-notifier-guard
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - ~>
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '1.6'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '1.6'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rubocop
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - ~>
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0.28'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - ~>
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0.28'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: fakefs
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - ~>
|
144
|
+
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - ~>
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: simplecov
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - ~>
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '0.
|
160
|
+
version: '0.13'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- - ~>
|
165
|
+
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '0.
|
167
|
+
version: '0.13'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: codeclimate-test-reporter
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- - ~>
|
172
|
+
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
174
|
+
version: 1.0.8
|
175
175
|
type: :development
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- - ~>
|
179
|
+
- - "~>"
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
181
|
+
version: 1.0.8
|
182
182
|
description: A utility for creating and managing simple apt repositories.
|
183
183
|
email:
|
184
184
|
- william.griffiths@thebookpeople.co.uk
|
@@ -188,10 +188,10 @@ executables:
|
|
188
188
|
extensions: []
|
189
189
|
extra_rdoc_files: []
|
190
190
|
files:
|
191
|
-
- .gitignore
|
192
|
-
- .rubocop.yml
|
193
|
-
- .ruby-version
|
194
|
-
- .travis.yml
|
191
|
+
- ".gitignore"
|
192
|
+
- ".rubocop.yml"
|
193
|
+
- ".ruby-version"
|
194
|
+
- ".travis.yml"
|
195
195
|
- Gemfile
|
196
196
|
- Guardfile
|
197
197
|
- LICENSE.txt
|
@@ -250,12 +250,12 @@ require_paths:
|
|
250
250
|
- lib
|
251
251
|
required_ruby_version: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
|
-
- -
|
253
|
+
- - ">="
|
254
254
|
- !ruby/object:Gem::Version
|
255
255
|
version: 1.9.3
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
|
-
- -
|
258
|
+
- - ">="
|
259
259
|
- !ruby/object:Gem::Version
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|