suppository 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDViNGM2ZTY5OWUyYThmMzlmZjBmZGY0MzMwMWI5ZWFjYTdkNGY2Yw==
4
+ MGVlYmFkYTM5ODQwNGI1MDJlODA5YWQwMWMwYmNjOTNiY2I5ZjdlNg==
5
5
  data.tar.gz: !binary |-
6
- YTdhOTczMGZjMzdmYTBjNzIxY2M4Y2U1ZDJkNTgzNmU3ZGVhNTYxNA==
6
+ M2FjZjA0ODRlNDczYTZjOWIwOWIwNDgzMjU1MmEyYTE4NmI1ODc2YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjY3YmRjMGQ5ZjY2ZjM5NTQ0NjY1Y2JjYWQwYzFkN2VmZDljMTZhMzRjZDU1
10
- OWM4MzE4M2U4ZjNiN2IzNzExNTVhN2ZhYWQ5MDIxZDk3YTUxNTg4MDFmZGE5
11
- ODc0OGI0NTI0YzRhZDE2OTdhYjRmZjU5NDA2OWExZDlkNjI2Yjk=
9
+ Y2Q5NTlkYTBiNWU3NDJjMWQyNjYxNWU1NjhjZDBmODNhYzgzMTk2OTAzMTc2
10
+ NWVjYmI3MzRhMzY5NGExYWY5MDlhZTU5OTc4Yjc1MjQ3MTVjOTEzODk5NjMx
11
+ ZDUxMmUzYmIyMzkxYzFkZjM1MGI1ODg2NzIyMTJmNjk2MTY4Yjg=
12
12
  data.tar.gz: !binary |-
13
- NjUyNWZmYjIzMzVhMDY3YTA0YTMxNmJlNWM2NTMyMWJmZmQ1N2NhMmU3MGVk
14
- ZjBiODEyMjYyY2I5ZDI4MWMyNWVkY2MzNDQ4MjIwOGZiNTE1YTRlOTEzMThi
15
- ZDZiNTNiYTZiYmE2OGY0YTFmNzNiMzQ2NWU4YzQ2Nzk1ZjQyMGE=
13
+ NGFlZGYwYTU4NWQzZWYwOGIxM2E5Y2ZjNzliMzkwMDkyNjIyZjk2YjJmYmE4
14
+ NjA4N2FkYzYyZjgzNmFkODg5ZDU0MzM3NzEzZGEzMTBmNzgwMjU1MDkzOTVh
15
+ MThhM2MzYzIyM2I0NmVkYzhiN2IyYjI5MTNlNWRjNTFjMTExODY=
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)
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)
3
3
 
4
4
  Based on the ideas from Super Simple Apt Repository https://github.com/lukepfarrar/suppository.
5
5
 
@@ -1,4 +1,4 @@
1
-
1
+ require 'English'
2
2
  require 'suppository/exceptions'
3
3
 
4
4
  module Suppository
@@ -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
- open(@release_file, 'w') { |f| f.puts content }
15
+ write_file
18
16
  sign unless @unsigned
19
17
  end
20
18
 
21
19
  private
22
20
 
23
- def sign
24
- gpg_file = "#{@release_file}.gpg"
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: #{Time.new.strftime('%a, %d %b %Y %H:%M:%S %Z')}\n"
40
- packages = Dir.glob("#{@dist_path}/*/*/Packages*")
41
- result << "MD5Sum:\n"
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 << "SHA1:\n"
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 << "SHA256:\n"
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 << "SHA512:\n"
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
@@ -1,3 +1,3 @@
1
1
  module Suppository
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -9,28 +9,27 @@ RELEASE_CONTENT = <<-EOS
9
9
  Codename: lucid
10
10
  Architectures: amd64 i386
11
11
  Components: internal
12
- Date: Tue, 06 Jan 2015 00:43:13 GMT
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
- d41d8cd98f00b204e9800998ecf8427e 0 dists/lucid/internal/binary-amd64/Packages
15
- 2f3e2442476f5464c314716ef684c02c 103 dists/lucid/internal/binary-amd64/Packages.gz
16
- d41d8cd98f00b204e9800998ecf8427e 0 dists/lucid/internal/binary-i386/Packages
17
- 7c0c23a67294ee276556e2f7f0ad5bc2 102 dists/lucid/internal/binary-i386/Packages.gz
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
- da39a3ee5e6b4b0d3255bfef95601890afd80709 0 dists/lucid/internal/binary-amd64/Packages
20
- 3e9ac8f4be976f1c6a52c13a3a251dfec7c204e7 103 dists/lucid/internal/binary-amd64/Packages.gz
21
- da39a3ee5e6b4b0d3255bfef95601890afd80709 0 dists/lucid/internal/binary-i386/Packages
22
- 14934aa27c0ea7148d5b94b0ff3c769cfa59a297 102 dists/lucid/internal/binary-i386/Packages.gz
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
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 dists/lucid/internal/binary-amd64/Packages
25
- bce970b56be93d9280b806bf630b3c85332293212002dcb38eb9911c6dcd725c 103 dists/lucid/internal/binary-amd64/Packages.gz
26
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 dists/lucid/internal/binary-i386/Packages
27
- 6e2679e057b8b9fa202677d114914fb9d67d378445449983fc432c27becedc38 102 dists/lucid/internal/binary-i386/Packages.gz
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
- cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 dists/lucid/internal/binary-amd64/Packages
30
- 8c5a6c5573e2b5e6e187cb8aa85a7d5cdbc941ba2dfbc705fb33404a643d5ddee64014a4a9d094151400ce4ac58946bff52e53e4b922485f06405637ab9e080b 103 dists/lucid/internal/binary-amd64/Packages.gz
31
- cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 dists/lucid/internal/binary-i386/Packages
32
- 2a977dcc902cb6105c5981d114fb5759b8bd3a0805b30d70b2b519ad17fed233a1bd62b5b705b187ac31ea6e3def0fa598c0731281e8be2de513757d5190be14 102 dists/lucid/internal/binary-i386/Packages.gz
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
@@ -1,4 +1,3 @@
1
-
2
1
  require 'spec_helper'
3
2
  require 'suppository/version'
4
3
  require 'English'
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.2
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-09 00:00:00.000000000 Z
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: '0'
255
+ version: 1.9.3
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
258
  - - ! '>='