reaper-man 0.1.8 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fe0a8460eccd12458ba86ddb12122bd29fbc8a8084158a52d637bfe870fedcd
4
- data.tar.gz: 9175cc079bbcab1456b48800d2822011677c527d49fe9c471e0e07a7f3ab7fa1
3
+ metadata.gz: 2bbf13ad88d42d664d1a59174b7472b3516974f4fbca42741509128d8d118660
4
+ data.tar.gz: 8ad4195b8ae031277e3e8a8f67324360d2ddb941ef04ed21acd1a13a193495b6
5
5
  SHA512:
6
- metadata.gz: b2b31a39aedd71418287811778c8c0eb911dcb026b04caa5c4796b2ec8415a6a88248081e63f87b4dda2f157cd6a8ee1889b4e08084a21bd724dc69a97a76d83
7
- data.tar.gz: 326a8a66aad3929c2b761bd7fde213f89263d84f55d4cc57e0c5d1b5a174d24a7733e28829cec0a702ad4b68c5abc4c1ff7dc2286760927dd41a3d7a66dd9c0b
6
+ metadata.gz: 94e65fc9f9f4067498ba42c64d0db8bb56f1a4958cd0a322a2940efebf259f2a4486550a954c723294594ac8002ce23874f0bb21f10c47713eeaf4dbd8dad794
7
+ data.tar.gz: 4843d2d153f323c5c5f72cba8c22fe9bf06b92b6befec7fb2f8d51f3bb2c23af1372281761bb4db9f3a65b4b4408c864b7c779c9bd97ad77a8568eac68913744
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # v0.1.16
2
+ * [enhancement] Update Ruby version constraints
3
+
4
+ # v0.1.14
5
+ * [fix] Ignore undefined dependencies during repo generation
6
+
7
+ # v0.1.12
8
+ * [fix] Only map dependencies when dependencies are defined
9
+
10
+ # v0.1.10
11
+ * [fix] extract rubygem specification data via proper API
12
+ * [enhancement] clean rubygems package data to remove empty values
13
+
1
14
  # v0.1.8
2
15
  * [fix] only set specification value when value is set
3
16
 
data/README.md CHANGED
@@ -44,7 +44,7 @@ or remove a specific version
44
44
  ### Create a repository
45
45
 
46
46
  ```
47
- > reaper-man repo create --packages-file registry.json --package-system apt --output-directory /tmp/test-repo
47
+ > reaper-man repo generate --packages-file registry.json --package-system apt --output-directory /tmp/test-repo
48
48
  ```
49
49
 
50
50
  This can also be used to update an existing repository structure.
data/lib/reaper-man.rb CHANGED
@@ -1,13 +1,13 @@
1
- require 'multi_json'
1
+ require "multi_json"
2
2
 
3
3
  module ReaperMan
4
- autoload :Cli, 'reaper-man/cli'
5
- autoload :Command, 'reaper-man/command'
6
- autoload :Config, 'reaper-man/config'
7
- autoload :Error, 'reaper-man/error'
8
- autoload :Generator, 'reaper-man/generator'
9
- autoload :PackageList, 'reaper-man/package_list'
10
- autoload :Signer, 'reaper-man/signer'
11
- autoload :Version, 'reaper-man/version'
12
- autoload :Utils, 'reaper-man/utils'
4
+ autoload :Cli, "reaper-man/cli"
5
+ autoload :Command, "reaper-man/command"
6
+ autoload :Config, "reaper-man/config"
7
+ autoload :Error, "reaper-man/error"
8
+ autoload :Generator, "reaper-man/generator"
9
+ autoload :PackageList, "reaper-man/package_list"
10
+ autoload :Signer, "reaper-man/signer"
11
+ autoload :Version, "reaper-man/version"
12
+ autoload :Utils, "reaper-man/utils"
13
13
  end
@@ -1,11 +1,9 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command < Bogo::Cli::Command
5
-
6
- autoload :Repository, 'reaper-man/command/repository'
7
- autoload :Package, 'reaper-man/command/package'
8
- autoload :Sign, 'reaper-man/command/sign'
9
-
5
+ autoload :Repository, "reaper-man/command/repository"
6
+ autoload :Package, "reaper-man/command/package"
7
+ autoload :Sign, "reaper-man/command/sign"
10
8
  end
11
9
  end
@@ -1,12 +1,10 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Package < Command
6
-
7
- autoload :Add, 'reaper-man/command/package/add'
8
- autoload :Remove, 'reaper-man/command/package/remove'
9
-
6
+ autoload :Add, "reaper-man/command/package/add"
7
+ autoload :Remove, "reaper-man/command/package/remove"
10
8
  end
11
9
  end
12
10
  end
@@ -1,11 +1,9 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Package
6
-
7
6
  class Add < Package
8
-
9
7
  def execute!
10
8
  arguments.each do |path|
11
9
  run_action "Adding package to repository manifest: #{path}" do
@@ -16,9 +14,7 @@ module ReaperMan
16
14
  end
17
15
  end
18
16
  end
19
-
20
17
  end
21
-
22
18
  end
23
19
  end
24
20
  end
@@ -1,11 +1,9 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Package
6
-
7
6
  class Remove < Package
8
-
9
7
  def execute!
10
8
  arguments.each do |pkg|
11
9
  run_action "Remove package from repository manifest: #{pkg}" do
@@ -16,9 +14,7 @@ module ReaperMan
16
14
  end
17
15
  end
18
16
  end
19
-
20
17
  end
21
-
22
18
  end
23
19
  end
24
20
  end
@@ -1,11 +1,9 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Repository < Command
6
-
7
- autoload :Generate, 'reaper-man/command/repository/generate'
8
-
6
+ autoload :Generate, "reaper-man/command/repository/generate"
9
7
  end
10
8
  end
11
9
  end
@@ -1,29 +1,25 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Repository
6
-
7
6
  class Generate < Repository
8
-
9
7
  def execute!
10
- run_action 'Generating repository' do
8
+ run_action "Generating repository" do
11
9
  ReaperMan::Generator.new(
12
10
  config.merge(
13
11
  Smash.new(
14
12
  :package_config => MultiJson.load(
15
13
  File.read(config[:packages_file])
16
14
  ).to_smash,
17
- :signer => config[:sign] ? Signer.new(config) : nil
15
+ :signer => config[:sign] ? Signer.new(config) : nil,
18
16
  )
19
17
  )
20
18
  ).generate!
21
19
  nil
22
20
  end
23
21
  end
24
-
25
22
  end
26
-
27
23
  end
28
24
  end
29
25
  end
@@ -1,23 +1,22 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Command
5
5
  class Sign < Command
6
-
7
6
  def execute!
8
7
  files = arguments.map do |item|
9
- if(File.file?(item))
8
+ if File.file?(item)
10
9
  item
11
10
  else
12
11
  File.directory?(item)
13
- i_files = Dir.glob(File.join(item, '**', '*'))
12
+ i_files = Dir.glob(File.join(item, "**", "*"))
14
13
  i_files.delete_if do |path|
15
14
  !File.file?(path)
16
15
  end
17
16
  i_files
18
17
  end
19
18
  end.flatten.compact.uniq
20
- run_action 'Signing file(s)' do
19
+ run_action "Signing file(s)" do
21
20
  signer = Signer.new(config)
22
21
  signer.package(*files)
23
22
  nil
@@ -27,7 +26,6 @@ module ReaperMan
27
26
  ui.puts " #{ui.color(File.expand_path(path), :yellow)}"
28
27
  end
29
28
  end
30
-
31
29
  end
32
30
  end
33
31
  end
@@ -1,4 +1,4 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  # Standard error for reaper errors
@@ -12,9 +12,8 @@ module ReaperMan
12
12
  end
13
13
 
14
14
  # Define errors here
15
- ['UnknownCommand', 'FileNotFound'].each_with_index do |klass_name, idx|
15
+ ["UnknownCommand", "FileNotFound"].each_with_index do |klass_name, idx|
16
16
  self.class_eval("class #{klass_name} < Error; CODE=#{idx + 1}; end;")
17
17
  end
18
-
19
18
  end
20
19
  end
@@ -1,16 +1,15 @@
1
- require 'time'
2
- require 'zlib'
3
- require 'fileutils'
1
+ require "time"
2
+ require "zlib"
3
+ require "fileutils"
4
4
 
5
- require 'reaper-man'
5
+ require "reaper-man"
6
6
 
7
7
  module ReaperMan
8
8
  # Repository generator
9
9
  class Generator
10
-
11
- autoload :Apt, 'reaper-man/generator/apt'
12
- autoload :Yum, 'reaper-man/generator/yum'
13
- autoload :Rubygems, 'reaper-man/generator/rubygems'
10
+ autoload :Apt, "reaper-man/generator/apt"
11
+ autoload :Yum, "reaper-man/generator/yum"
12
+ autoload :Rubygems, "reaper-man/generator/rubygems"
14
13
 
15
14
  include Utils::Checksum
16
15
 
@@ -29,17 +28,17 @@ module ReaperMan
29
28
  # @option args [String] :package_system apt/gem/etc...
30
29
  # @option args [Hash] :package_config
31
30
  # @option args [Signer] :signer
32
- def initialize(args={})
31
+ def initialize(args = {})
33
32
  @package_system = args[:package_system]
34
33
  @package_config = args.fetch(:package_config, Smash.new)
35
34
  @signer = args[:signer]
36
35
  @options = args
37
- extend self.class.const_get(package_system.to_s.split('_').map(&:capitalize).join.to_sym)
36
+ extend self.class.const_get(package_system.to_s.split("_").map(&:capitalize).join.to_sym)
38
37
  end
39
38
 
40
39
  # Generate new repository
41
40
  def generate!
42
- raise NoMethodError.new 'Not implemented'
41
+ raise NoMethodError.new "Not implemented"
43
42
  end
44
43
 
45
44
  # Create new file
@@ -51,8 +50,8 @@ module ReaperMan
51
50
  def create_file(*name)
52
51
  path = File.join(options[:output_directory], *name)
53
52
  FileUtils.mkdir_p(File.dirname(path))
54
- file = File.open(path, 'wb+')
55
- if(block_given?)
53
+ file = File.open(path, "wb+")
54
+ if block_given?
56
55
  yield file
57
56
  end
58
57
  file.close unless file.closed?
@@ -68,8 +67,8 @@ module ReaperMan
68
67
  def for_file(*name)
69
68
  path = File.join(options[:output_directory], *name)
70
69
  FileUtils.mkdir_p(File.dirname(path))
71
- if(block_given?)
72
- file = File.open(path, 'a+')
70
+ if block_given?
71
+ file = File.open(path, "a+")
73
72
  yield file
74
73
  file.close
75
74
  end
@@ -86,13 +85,11 @@ module ReaperMan
86
85
  base_file = File.open(for_file(path))
87
86
  create_file(compressed_path) do |file|
88
87
  compressor = Zlib::GzipWriter.new(file)
89
- while(data = base_file.read(2048))
88
+ while data = base_file.read(2048)
90
89
  compressor.write(data)
91
90
  end
92
91
  compressor.close
93
92
  end
94
93
  end
95
-
96
94
  end
97
-
98
95
  end
@@ -1,4 +1,4 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Generator
@@ -21,8 +21,8 @@ module ReaperMan
21
21
  arches.each do |arch_name, packages|
22
22
  package_file(origin_name, dist_name, component_name, arch_name, packages)
23
23
  release_headers = Smash.new
24
- release_headers['Label'] = dist_args['label']
25
- release_headers['Archive'] = dist_name
24
+ release_headers["Label"] = dist_args["label"]
25
+ release_headers["Archive"] = dist_name
26
26
  sign_file_if_setup do
27
27
  release_file(origin_name, dist_name, component_name, arch_name, release_headers)
28
28
  end
@@ -30,19 +30,19 @@ module ReaperMan
30
30
  end
31
31
  release_headers = Smash[
32
32
  %w(Codename Suite Label Description Version).map do |field_name|
33
- if(val = dist_args[field_name.downcase])
33
+ if val = dist_args[field_name.downcase]
34
34
  [field_name, val]
35
35
  end
36
36
  end.compact
37
37
  ]
38
- release_headers['Components'] = dist_args[:components].keys.join(' ')
39
- signed = sign_file_if_setup('--clearsign') do
38
+ release_headers["Components"] = dist_args[:components].keys.join(" ")
39
+ signed = sign_file_if_setup("--clearsign") do
40
40
  release_file(origin_name, dist_name, release_headers)
41
41
  end
42
- if(File.exists?("#{signed}.gpg"))
42
+ if File.exists?("#{signed}.gpg")
43
43
  FileUtils.mv(
44
44
  "#{signed}.gpg",
45
- File.join(File.dirname(signed), 'InRelease')
45
+ File.join(File.dirname(signed), "InRelease")
46
46
  )
47
47
  end
48
48
  sign_file_if_setup do
@@ -57,9 +57,9 @@ module ReaperMan
57
57
  #
58
58
  # @yield block returning file path
59
59
  # @return [String] file path
60
- def sign_file_if_setup(opts=nil)
60
+ def sign_file_if_setup(opts = nil)
61
61
  path = yield
62
- if(signer && options[:sign])
62
+ if signer && options[:sign]
63
63
  signer.file(path, nil, opts)
64
64
  end
65
65
  path
@@ -71,12 +71,12 @@ module ReaperMan
71
71
  # @return [String] path to compressed Packages file
72
72
  def package_file(*args)
73
73
  pkgs = args.pop
74
- args.insert(1, 'dists')
75
- create_file(*args.push('Packages')) do |file|
74
+ args.insert(1, "dists")
75
+ create_file(*args.push("Packages")) do |file|
76
76
  pkgs.each do |pkg_name, pkgs|
77
77
  pkgs.each do |pkg_version, pkg_meta|
78
78
  pkg_meta.each do |field_name, field_value|
79
- if(field_value)
79
+ if field_value
80
80
  file.puts "#{field_name}: #{field_value}"
81
81
  end
82
82
  end
@@ -92,35 +92,34 @@ module ReaperMan
92
92
  # @param args [String] argument list for file path
93
93
  # @return [TrueClass]
94
94
  def release_file(*args)
95
- header = args.detect{|a| a.is_a?(Hash)}
95
+ header = args.detect { |a| a.is_a?(Hash) }
96
96
  header ? args.delete(header) : header = Smash.new
97
97
  header.merge(Smash[%w(Origin Codename Component Architecture).zip(args)])
98
- header['Date'] = Time.now.utc.strftime('%a, %d %b %Y %H:%M:%S %Z')
99
- args.insert(1, 'dists')
100
- create_file(*args.dup.push('Release')) do |file|
101
- contents = Dir.glob(File.join(File.dirname(file.path), '**', '*'))
98
+ header["Date"] = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
99
+ args.insert(1, "dists")
100
+ create_file(*args.dup.push("Release")) do |file|
101
+ contents = Dir.glob(File.join(File.dirname(file.path), "**", "*"))
102
102
  header_content = header.map do |key, value|
103
103
  next unless value
104
104
  "#{key.to_s.capitalize}: #{value}"
105
105
  end.compact.join("\n")
106
106
  file.puts header_content
107
- [['MD5Sum', :md5], ['SHA1', :sha1], ['SHA256', :sha256]].each do |field, digest|
107
+ [["MD5Sum", :md5], ["SHA1", :sha1], ["SHA256", :sha256]].each do |field, digest|
108
108
  file.puts "#{field}:"
109
109
  contents.each do |content|
110
110
  next if File.expand_path(content) == File.expand_path(file.path) || File.directory?(content)
111
- File.open(content, 'r') do |content_file|
112
- line = [' ']
111
+ File.open(content, "r") do |content_file|
112
+ line = [" "]
113
113
  line << checksum(content_file, digest)
114
114
  line << content_file.size
115
- line << content_file.path.sub(File.dirname(file.path), '').sub(/^\//, '')
116
- file.puts line.join(' ')
115
+ line << content_file.path.sub(File.dirname(file.path), "").sub(/^\//, "")
116
+ file.puts line.join(" ")
117
117
  end
118
118
  end
119
119
  end
120
120
  true
121
121
  end
122
122
  end
123
-
124
123
  end
125
124
  end
126
125
  end
@@ -1,4 +1,4 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Generator
@@ -18,9 +18,9 @@ module ReaperMan
18
18
  end
19
19
 
20
20
  def generate_indexing(gems)
21
- build_spec_file('specs', gems.fetch(:release, {}))
22
- build_spec_file('latest_specs', gems.fetch(:release, {}))
23
- build_spec_file('prerelease', gems.fetch(:prerelease, {}))
21
+ build_spec_file("specs", gems.fetch(:release, {}))
22
+ build_spec_file("latest_specs", gems.fetch(:release, {}))
23
+ build_spec_file("prerelease", gems.fetch(:prerelease, {}))
24
24
  end
25
25
 
26
26
  def create_index(gems)
@@ -34,11 +34,11 @@ module ReaperMan
34
34
  end
35
35
 
36
36
  def marshal_path
37
- ['Marshal', marshal_version].join('.')
37
+ ["Marshal", marshal_version].join(".")
38
38
  end
39
39
 
40
40
  def marshal_version
41
- [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION].join('.')
41
+ [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION].join(".")
42
42
  end
43
43
 
44
44
  def build_spec_file(name, gems)
@@ -54,7 +54,7 @@ module ReaperMan
54
54
  list.each do |version, info|
55
55
  spec = Gem::Specification.new(name)
56
56
  info.each do |var, value|
57
- if(value && spec.respond_to?("#{var}="))
57
+ if value && spec.respond_to?("#{var}=")
58
58
  begin
59
59
  # Ensure we convert Smash instances
60
60
  value = value.to_hash if value.is_a?(Hash)
@@ -66,11 +66,13 @@ module ReaperMan
66
66
  end
67
67
  spec.version = Gem::Version.new(info[:version])
68
68
  spec.date = Time.parse(info[:date])
69
- info[:dependencies].each do |dep|
70
- spec.add_dependency(*dep)
69
+ if info[:dependencies]
70
+ info[:dependencies].each do |dep|
71
+ spec.add_dependency(*dep)
72
+ end
71
73
  end
72
74
  deflator = Zlib::Deflate.new
73
- create_file('quick', marshal_path, "#{name}-#{version}.gemspec.rz") do |file|
75
+ create_file("quick", marshal_path, "#{name}-#{version}.gemspec.rz") do |file|
74
76
  file.write(deflator.deflate(Marshal.dump(spec), Zlib::SYNC_FLUSH))
75
77
  file.write(deflator.finish)
76
78
  end
@@ -84,12 +86,11 @@ module ReaperMan
84
86
  # @return [String] file path
85
87
  def sign_file_if_setup
86
88
  path = yield
87
- if(signer && options[:sign])
89
+ if signer && options[:sign]
88
90
  signer.file(path)
89
91
  end
90
92
  path
91
93
  end
92
-
93
94
  end
94
95
  end
95
96
  end