suppository 0.0.2 → 0.0.3
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/README.md +1 -1
- data/lib/suppository/command_runner.rb +1 -1
- data/lib/suppository/release.rb +58 -19
- data/lib/suppository/version.rb +1 -1
- data/spec/suppository/release_spec.rb +28 -18
- data/spec/suppository_spec.rb +0 -1
- data/suppository.gemspec +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGVlYmFkYTM5ODQwNGI1MDJlODA5YWQwMWMwYmNjOTNiY2I5ZjdlNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2FjZjA0ODRlNDczYTZjOWIwOWIwNDgzMjU1MmEyYTE4NmI1ODc2YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2Q5NTlkYTBiNWU3NDJjMWQyNjYxNWU1NjhjZDBmODNhYzgzMTk2OTAzMTc2
|
10
|
+
NWVjYmI3MzRhMzY5NGExYWY5MDlhZTU5OTc4Yjc1MjQ3MTVjOTEzODk5NjMx
|
11
|
+
ZDUxMmUzYmIyMzkxYzFkZjM1MGI1ODg2NzIyMTJmNjk2MTY4Yjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGFlZGYwYTU4NWQzZWYwOGIxM2E5Y2ZjNzliMzkwMDkyNjIyZjk2YjJmYmE4
|
14
|
+
NjA4N2FkYzYyZjgzNmFkODg5ZDU0MzM3NzEzZGEzMTBmNzgwMjU1MDkzOTVh
|
15
|
+
MThhM2MzYzIyM2I0NmVkYzhiN2IyYjI5MTNlNWRjNTFjMTExODY=
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Super Simple Apt Repository
|
2
|
-
[](https://travis-ci.org/TheBookPeople/suppository) [](https://codeclimate.com/github/TheBookPeople/suppository) [](https://codeclimate.com/github/TheBookPeople/suppository)
|
2
|
+
[](https://travis-ci.org/TheBookPeople/suppository) [](https://codeclimate.com/github/TheBookPeople/suppository) [](https://codeclimate.com/github/TheBookPeople/suppository) [](http://badge.fury.io/rb/suppository)
|
3
3
|
|
4
4
|
Based on the ideas from Super Simple Apt Repository https://github.com/lukepfarrar/suppository.
|
5
5
|
|
data/lib/suppository/release.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'English'
|
2
|
-
|
3
1
|
require 'suppository/exceptions'
|
4
2
|
require 'suppository/command_runner'
|
5
3
|
require 'fileutils'
|
@@ -14,44 +12,85 @@ module Suppository
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def create
|
17
|
-
|
15
|
+
write_file
|
18
16
|
sign unless @unsigned
|
19
17
|
end
|
20
18
|
|
21
19
|
private
|
22
20
|
|
23
|
-
def
|
24
|
-
|
25
|
-
FileUtils.rm_rf(gpg_file)
|
26
|
-
CommandRunner.new('gpg', "-abs -o #{gpg_file} #{@release_file}").run
|
21
|
+
def write_file
|
22
|
+
open(@release_file, 'w') { |f| f.puts content }
|
27
23
|
end
|
28
24
|
|
29
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
30
25
|
def content
|
31
26
|
result = "Codename: #{@dist}\n"
|
32
|
-
component_dirs = Dir.glob("#{@dist_path}/*").select { |f| File.directory? f }
|
33
|
-
components = component_dirs.collect { |d| File.basename(d) }.join(' ')
|
34
|
-
arch_dirs = Dir.glob("#{@dist_path}/*/*").select { |f| File.directory? f }
|
35
|
-
architectures = arch_dirs.collect { |d| File.basename(d).split('-')[1] }
|
36
|
-
.uniq.join(' ')
|
37
27
|
result << "Architectures: #{architectures}\n"
|
38
28
|
result << "Components: #{components}\n"
|
39
|
-
result << "Date: #{
|
40
|
-
|
41
|
-
|
29
|
+
result << "Date: #{date}\n"
|
30
|
+
result << package_hashes
|
31
|
+
end
|
32
|
+
|
33
|
+
def package_hashes
|
34
|
+
result = md5_hashes
|
35
|
+
result << sha1_hashes
|
36
|
+
result << sha2_hashes
|
37
|
+
result << sha5_hashes
|
38
|
+
end
|
39
|
+
|
40
|
+
def md5_hashes
|
41
|
+
result = "MD5Sum:\n"
|
42
42
|
packages.each { |f| result << puts_hash(f, Digest::MD5.file(f)) }
|
43
|
-
result
|
43
|
+
result
|
44
|
+
end
|
45
|
+
|
46
|
+
def sha1_hashes
|
47
|
+
result = "SHA1:\n"
|
44
48
|
packages.each { |f| result << puts_hash(f, Digest::SHA1.file(f)) }
|
45
|
-
result
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
def sha2_hashes
|
53
|
+
result = "SHA256:\n"
|
46
54
|
packages.each { |f| result << puts_hash(f, Digest::SHA256.file(f)) }
|
47
|
-
result
|
55
|
+
result
|
56
|
+
end
|
57
|
+
|
58
|
+
def sha5_hashes
|
59
|
+
result = "SHA512:\n"
|
48
60
|
packages.each { |f| result << puts_hash(f, Digest::SHA512.file(f)) }
|
49
61
|
result
|
50
62
|
end
|
51
63
|
|
64
|
+
def sign
|
65
|
+
gpg_file = "#{@release_file}.gpg"
|
66
|
+
FileUtils.rm_rf(gpg_file)
|
67
|
+
CommandRunner.new('gpg', "-abs -o #{gpg_file} #{@release_file}").run
|
68
|
+
end
|
69
|
+
|
70
|
+
def packages
|
71
|
+
@packages ||= Dir.glob("#{@dist_path}/*/*/Packages*")
|
72
|
+
end
|
73
|
+
|
52
74
|
def puts_hash(f, hash)
|
53
75
|
relative = f.split(@dist_path).pop[1..-1]
|
54
76
|
sprintf(" %s %17d %s\n", hash, File.size(f), relative)
|
55
77
|
end
|
78
|
+
|
79
|
+
def date
|
80
|
+
Time.new.strftime('%a, %d %b %Y %H:%M:%S %Z')
|
81
|
+
end
|
82
|
+
|
83
|
+
def components
|
84
|
+
directories("#{@dist_path}/*").join(' ')
|
85
|
+
end
|
86
|
+
|
87
|
+
def architectures
|
88
|
+
directories("#{@dist_path}/*/*").collect { |d| d.split('-')[1] }.uniq.join(' ')
|
89
|
+
end
|
90
|
+
|
91
|
+
def directories(path_pattern)
|
92
|
+
directories = Dir.glob(path_pattern).select { |f| File.directory? f }
|
93
|
+
directories.collect { |d| File.basename(d) }
|
94
|
+
end
|
56
95
|
end
|
57
96
|
end
|
data/lib/suppository/version.rb
CHANGED
@@ -9,28 +9,27 @@ RELEASE_CONTENT = <<-EOS
|
|
9
9
|
Codename: lucid
|
10
10
|
Architectures: amd64 i386
|
11
11
|
Components: internal
|
12
|
-
Date:
|
12
|
+
Date: [A-Za-z]{3}, [0-9]{2} [A-Za-z]{3} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3}
|
13
13
|
MD5Sum:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
[a-f0-9]{32}[ 0-9]{18,18} internal/binary-amd64/Packages
|
15
|
+
[a-f0-9]{32}[ 0-9]{18,18} internal/binary-amd64/Packages.gz
|
16
|
+
[a-f0-9]{32}[ 0-9]{18,18} internal/binary-i386/Packages
|
17
|
+
[a-f0-9]{32}[ 0-9]{18,18} internal/binary-i386/Packages.gz
|
18
18
|
SHA1:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
[a-f0-9]{40}[ 0-9]{18,18} internal/binary-amd64/Packages
|
20
|
+
[a-f0-9]{40}[ 0-9]{18,18} internal/binary-amd64/Packages.gz
|
21
|
+
[a-f0-9]{40}[ 0-9]{18,18} internal/binary-i386/Packages
|
22
|
+
[a-f0-9]{40}[ 0-9]{18,18} internal/binary-i386/Packages.gz
|
23
23
|
SHA256:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
[a-f0-9]{64}[ 0-9]{18,18} internal/binary-amd64/Packages
|
25
|
+
[a-f0-9]{64}[ 0-9]{18,18} internal/binary-amd64/Packages.gz
|
26
|
+
[a-f0-9]{64}[ 0-9]{18,18} internal/binary-i386/Packages
|
27
|
+
[a-f0-9]{64}[ 0-9]{18,18} internal/binary-i386/Packages.gz
|
28
28
|
SHA512:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-amd64/Packages
|
30
|
+
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-amd64/Packages.gz
|
31
|
+
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-i386/Packages
|
32
|
+
[a-f0-9]{128}[ 0-9]{18,18} internal/binary-i386/Packages.gz
|
34
33
|
EOS
|
35
34
|
|
36
35
|
|
@@ -47,6 +46,17 @@ EOS
|
|
47
46
|
FileUtils.rm_r @repo_path if File.exist? @repo_path
|
48
47
|
end
|
49
48
|
|
49
|
+
it "has correct content" do
|
50
|
+
@instance.create
|
51
|
+
content = File.read(@release_file)
|
52
|
+
expect(Regexp.new(RELEASE_CONTENT).match content ).to be_truthy
|
53
|
+
end
|
54
|
+
|
55
|
+
it "creates file" do
|
56
|
+
@instance.create
|
57
|
+
expect(File.exists?(@release_file)).to eql true
|
58
|
+
end
|
59
|
+
|
50
60
|
it "creates file" do
|
51
61
|
@instance.create
|
52
62
|
expect(File.exists?(@release_file)).to eql true
|
data/spec/suppository_spec.rb
CHANGED
data/suppository.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = ">= 1.9.3"
|
21
22
|
spec.add_development_dependency "rake", "~> 10.4"
|
22
23
|
spec.add_development_dependency "bundler", '~> 1.7'
|
23
24
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
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.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Griffiths
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -252,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
252
|
requirements:
|
253
253
|
- - ! '>='
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version:
|
255
|
+
version: 1.9.3
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
258
|
- - ! '>='
|