suppository 0.0.6 → 0.1.0

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.
Files changed (49) hide show
  1. checksums.yaml +5 -13
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +7 -5
  4. data/Gemfile +2 -0
  5. data/Guardfile +2 -0
  6. data/README.md +1 -1
  7. data/Rakefile +4 -2
  8. data/bin/suppository +2 -0
  9. data/lib/suppository/add_command.rb +14 -6
  10. data/lib/suppository/checksummed.rb +2 -0
  11. data/lib/suppository/cli.rb +3 -1
  12. data/lib/suppository/command_runner.rb +5 -3
  13. data/lib/suppository/create_command.rb +5 -3
  14. data/lib/suppository/dpkg_deb.rb +2 -0
  15. data/lib/suppository/dpkg_deb_line.rb +3 -1
  16. data/lib/suppository/exceptions.rb +5 -0
  17. data/lib/suppository/gzip.rb +2 -0
  18. data/lib/suppository/help.rb +11 -9
  19. data/lib/suppository/help_command.rb +2 -2
  20. data/lib/suppository/logger.rb +2 -0
  21. data/lib/suppository/master_deb.rb +4 -2
  22. data/lib/suppository/package.rb +4 -2
  23. data/lib/suppository/release.rb +16 -8
  24. data/lib/suppository/repository.rb +4 -2
  25. data/lib/suppository/tty.rb +2 -0
  26. data/lib/suppository/version.rb +3 -1
  27. data/lib/suppository/version_command.rb +3 -2
  28. data/lib/suppository.rb +2 -0
  29. data/spec/spec_helper.rb +2 -1
  30. data/spec/suppository/add_command_spec.rb +11 -9
  31. data/spec/suppository/cli_spec.rb +2 -0
  32. data/spec/suppository/command_runner_spec.rb +2 -0
  33. data/spec/suppository/create_command_spec.rb +2 -0
  34. data/spec/suppository/dpkg_deb_line_spec.rb +2 -0
  35. data/spec/suppository/dpkg_deb_spec.rb +2 -0
  36. data/spec/suppository/gzip_spec.rb.rb +2 -0
  37. data/spec/suppository/help_command_spec.rb +2 -0
  38. data/spec/suppository/help_spec.rb +19 -1
  39. data/spec/suppository/logger_spec.rb +2 -0
  40. data/spec/suppository/master_deb_spec.rb +6 -4
  41. data/spec/suppository/package_spec.rb +2 -0
  42. data/spec/suppository/release_spec.rb +29 -29
  43. data/spec/suppository/repository_spec.rb +4 -2
  44. data/spec/suppository/tty_spec.rb +2 -0
  45. data/spec/suppository/version_command_spec.rb +2 -0
  46. data/spec/suppository/version_spec.rb +2 -0
  47. data/spec/suppository_spec.rb +3 -1
  48. data/suppository.gemspec +5 -3
  49. metadata +38 -38
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzUzYWU5N2UzZWUyMTQ5MjNhYzBlMWVmNzY3MzkwZjU2YTcyYjM4YQ==
5
- data.tar.gz: !binary |-
6
- ZWI3ZGNhN2VmYWY5NTU2ZmI1ZDYyYTczZDE3OTdhZjk5NzY0MjQ1MA==
2
+ SHA1:
3
+ metadata.gz: e9fe676598bd46189561acd6f6921b69b92305b4
4
+ data.tar.gz: a7936a2ffed2f98867547c2d34374785790dde7e
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MjUxYmNmOTVjN2U1NzhhNmI3N2M3OWFhNzJhZTM2YjdkYzY1OGM4ODZmMWEy
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
- ruby-2.0.0-p598
1
+ 2.4.1
data/.travis.yml CHANGED
@@ -1,19 +1,21 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.5
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.0.0
19
+ ruby: 2.4.1
20
+ tags: true
19
21
  repo: TheBookPeople/suppository
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in suppository.gemspec
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
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: [:clean, :rubocop, :test]
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: [:clean, :rubocop, :test, :gem]
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,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
+ # frozen_string_literal: true
4
+
3
5
  # -*- mode: ruby -*-
4
6
  require_relative '../lib/suppository/cli'
5
7
  require_relative '../lib/suppository/logger'
@@ -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
- fail UsageError if args.nil? || args.length < 4 || args.length > 5
38
- fail UsageError if args.length == 5 && args[4] != '--unsigned'
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 = "#{@repository.path} is not a valid repository.\n"
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
- fail InvalidRepositoryError, message unless @repository.exist?
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
- fail InvalidDistribution, message unless File.exist?("#{dist_path}")
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
- fail InvalidComponent, message unless File.exist?("#{component_path}")
73
+ raise InvalidComponent, message unless File.exist?(component_path.to_s)
66
74
  end
67
75
 
68
76
  def create_suppository_file(deb)
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'digest'
3
5
 
4
6
  module Suppository
@@ -1,10 +1,12 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'suppository/exceptions'
3
5
 
4
6
  module Suppository
5
7
  class CLI
6
8
  def self.run(args)
7
- fail UsageError if args.empty?
9
+ raise UsageError if args.empty?
8
10
  cmd = args.delete_at(0)
9
11
 
10
12
  begin
@@ -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 = "'#{@command}' was not found."
21
- fail(CommandMissingError, message) unless $CHILD_STATUS.success?
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
- fail(CommandError, output) unless $CHILD_STATUS.success?
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
- fail UsageError, message if args.nil? || args.length != 1
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? ? fail("#{path} is already a repository") : ''
36
+ @repository.exist? ? raise("#{path} is already a repository") : ''
35
37
  end
36
38
 
37
39
  def create_repository
38
- FileUtils.mkdir_p "#{suppository}"
40
+ FileUtils.mkdir_p suppository.to_s
39
41
  create_dists_folders
40
42
  log_success "Created new Repository - #{path}"
41
43
  end
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'suppository/dpkg_deb_line'
3
5
  require 'suppository/command_runner'
4
6
 
@@ -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
- fail "can't parse line - '#{line}'"
16
+ raise "can't parse line - '#{line}'"
15
17
  end
16
18
  end
17
19
 
@@ -1,9 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class UsageError < RuntimeError
2
4
  end
3
5
 
4
6
  class InvalidDistribution < RuntimeError
5
7
  end
6
8
 
9
+ class MissingFile < RuntimeError
10
+ end
11
+
7
12
  class InvalidComponent < RuntimeError
8
13
  end
9
14
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'zlib'
3
5
 
4
6
  module Suppository
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  HELP = <<-EOS
2
- Example usage:
4
+ Example usage:
3
5
 
4
- suppository help
5
- - Display this Help message
6
+ suppository help
7
+ - Display this Help message
6
8
 
7
- suppository version
8
- - Display version
9
+ suppository version
10
+ - Display version
9
11
 
10
- suppository create <REPOSITORY_PATH>
11
- - Create new empty repository in REPOSITORY_PATH
12
+ suppository create <REPOSITORY_PATH>
13
+ - Create new empty repository in REPOSITORY_PATH
12
14
 
13
- suppository add <REPOSITORY_PATH> <DIST> <COMPONENT> <DEB_FILE> [--unsigned]
14
- - Add DEB_FILE to DIST and COMPONENT of repository at REPOSITORY_PATH
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
 
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  require 'suppository/help'
3
4
 
4
5
  module Suppository
5
6
  class HelpCommand
6
- def initialize(_)
7
- end
7
+ def initialize(_); end
8
8
 
9
9
  def run
10
10
  puts Suppository.help
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'suppository/tty'
3
5
 
4
6
  module Suppository
@@ -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
- fail InvalidMasterDeb, message unless suppository_file?
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
- fail InvalidMasterDeb, message unless matches
56
+ raise InvalidMasterDeb, message unless matches
55
57
  matches
56
58
  end
57
59
 
@@ -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
- .to_a.map { |kv_pair| kv_pair.join(': ') }
14
- .join("\n") << "\n\n"
15
+ .to_a.map { |kv_pair| kv_pair.join(': ') }
16
+ .join("\n") << "\n\n"
15
17
  end
16
18
 
17
19
  private
@@ -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 = "Codename: #{@dist}\n"
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 = md5_hashes
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 = "MD5Sum:\n"
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 = "SHA1:\n"
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 = "SHA256:\n"
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 = "SHA512:\n"
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
- sprintf(" %s %17d %s\n", hash, File.size(f), relative)
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(natty lucid precise saucy trusty).sort
8
- @archs = %w(amd64 i386).sort
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Suppository
2
4
  class Tty
3
5
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Suppository
2
- VERSION = '0.0.6'
4
+ VERSION = '0.1.0'
3
5
  end
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
 
3
+ require 'suppository/version'
2
4
 
3
5
  module Suppository
4
6
  class VersionCommand
5
- def initialize(_)
6
- end
7
+ def initialize(_); end
7
8
 
8
9
  def run
9
10
  puts "Suppository Version #{Suppository::VERSION}"
data/lib/suppository.rb CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'suppository/version'
3
5
 
4
6
  module Suppository
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 "add the same package again" do
26
- release = double(Suppository::Release)
27
- expect(release).to receive(:create).twice
28
- expect(Suppository::Release).to receive(:new).twice.with(@repository.path, @dist, false) { release }
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,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/version'
4
6
  require 'suppository/cli'
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/command_runner'
4
6
  require 'suppository/exceptions'
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/create_command'
4
6
  require 'suppository/repository'
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/dpkg_deb_line'
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/dpkg_deb'
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/gzip'
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/help_command'
4
6
 
@@ -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("Example usage:\n\n suppository help\n - Display this Help message\n\n suppository version\n - Display version\n\n suppository create <REPOSITORY_PATH>\n - Create new empty repository in REPOSITORY_PATH\n\n suppository add <REPOSITORY_PATH> <DIST> <COMPONENT> <DEB_FILE> [--unsigned]\n - Add DEB_FILE to DIST and COMPONENT of repository at REPOSITORY_PATH\n\n")
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/logger'
4
6
 
@@ -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
- rescue InvalidMasterDeb => e
49
- exception = e
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
- rescue InvalidMasterDeb => e
61
- exception = e
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,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/package'
4
6
  require 'suppository/master_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
- end
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 "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
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 "creates file" do
57
- @instance.create
58
- expect(File.exists?(@release_file)).to eql true
55
+
56
+ it 'creates file' do
57
+ @instance.create
58
+ expect(File.exist?(@release_file)).to eql true
59
59
  end
60
-
61
- it "creates file" do
62
- @instance.create
63
- expect(File.exists?(@release_file)).to eql true
60
+
61
+ it 'creates file' do
62
+ @instance.create
63
+ expect(File.exist?(@release_file)).to eql true
64
64
  end
65
-
66
- it "unsigned" do
67
- @instance.create
68
- expect(File.exists?(@release_file_gpg)).to eql false
65
+
66
+ it 'unsigned' do
67
+ @instance.create
68
+ expect(File.exist?(@release_file_gpg)).to eql false
69
69
  end
70
-
71
- it "signed" do
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.exists?(@release_file_gpg)).to eql true
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(natty lucid precise saucy trusty).sort
9
- @archs = %w(amd64 i386).sort
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
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/tty'
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/version_command'
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'spec_helper'
3
5
  require 'suppository/version'
4
6
 
@@ -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' do
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', '~> 10.4'
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.9'
33
- spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
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.6
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: 2015-01-29 00:00:00.000000000 Z
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: '10.4'
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: '10.4'
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.9'
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.9'
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: '0.4'
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: '0.4'
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: []