deb-s3 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,15 +10,17 @@ sync the files to S3.
10
10
 
11
11
  The annoying thing about this process is it requires you to maintain a local
12
12
  copy of the file tree for regenerating and syncing the next time. Personally,
13
- my process is to use one-off virtual machines with [Vagrant](http://vagrantup.com),
14
- script out the build process, and then would prefer to just upload the final
15
- `.deb` from my Mac.
13
+ my process is to use one-off virtual machines with
14
+ [Vagrant](http://vagrantup.com), script out the build process, and then would
15
+ prefer to just upload the final `.deb` from my Mac.
16
16
 
17
17
  With `deb-s3`, there is no need for this. `deb-s3` features:
18
18
 
19
19
  * Downloads the existing package manifest and parses it.
20
- * Updates it with the new package, replacing the existing entry if already there.
21
- * Uploads the package itself, the Packages manifest, and the Packages.gz manifest.
20
+ * Updates it with the new package, replacing the existing entry if already
21
+ there or adding a new one if not.
22
+ * Uploads the package itself, the Packages manifest, and the Packages.gz
23
+ manifest.
22
24
  * Updates the Release file with the new hashes and file sizes.
23
25
 
24
26
  ## Getting Started
@@ -70,6 +72,7 @@ Options:
70
72
  [--secret-key=SECRET_KEY] # The secret key for connecting to S3.
71
73
  # Default: $AMAZON_SECRET_ACCESS_KEY
72
74
  [--sign=SIGN] # Sign the Release file. Use --sign with your key ID to use a specific key.
75
+ -p, [--preserve-versions] # Whether to preserve other versions of a package in the repository when uploading one.
73
76
 
74
77
  Uploads the given FILE to a S3 bucket as an APT repository.
75
78
  ```
@@ -79,4 +82,3 @@ Uploads the given FILE to a S3 bucket as an APT repository.
79
82
  This is still experimental. These are several things to be done:
80
83
 
81
84
  * Don't re-upload a package if it already exists and has the same hashes.
82
- * Clean up the code some more.
data/lib/deb/s3.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Deb
2
2
  module S3
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/deb/s3/cli.rb CHANGED
@@ -55,6 +55,13 @@ class Deb::S3::CLI < Thor
55
55
  :desc => "Sign the Release file. Use --sign with your key ID to use " +
56
56
  "a specific key."
57
57
 
58
+ option :preserve_versions,
59
+ :default => false,
60
+ :type => :boolean,
61
+ :aliases => "-p",
62
+ :desc => "Whether to preserve other versions of a package " +
63
+ "in the repository when uploading one."
64
+
58
65
  desc "upload FILE",
59
66
  "Uploads the given FILE to a S3 bucket as an APT repository."
60
67
  def upload(file)
@@ -108,7 +115,7 @@ class Deb::S3::CLI < Thor
108
115
  manifest = Deb::S3::Manifest.retrieve(options[:codename], options[:section], arch)
109
116
 
110
117
  # add in the package
111
- manifest.add(pkg)
118
+ manifest.add(pkg, options[:preserve_versions])
112
119
 
113
120
  log("Uploading package and new manifests to S3")
114
121
  manifest.write_to_s3 { |f| sublog("Transferring #{f}") }
@@ -45,8 +45,12 @@ class Deb::S3::Manifest
45
45
  @packages
46
46
  end
47
47
 
48
- def add(pkg)
49
- @packages.delete_if { |p| p.name == pkg.name }
48
+ def add(pkg, preserve_versions)
49
+ if preserve_versions
50
+ @packages.delete_if { |p| p.name == pkg.name && p.version == pkg.version }
51
+ else
52
+ @packages.delete_if { |p| p.name == pkg.name }
53
+ end
50
54
  @packages << pkg
51
55
  pkg
52
56
  end
@@ -239,6 +239,7 @@ class Deb::S3::Package
239
239
  self.url = parse.call("Homepage")
240
240
  self.vendor = parse.call("Vendor") || self.vendor
241
241
  self.attributes[:deb_priority] = parse.call("Priority")
242
+ self.attributes[:deb_installed_size] = parse.call("Installed-Size")
242
243
 
243
244
  # Packages manifest fields
244
245
  self.url_filename = parse.call("Filename")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deb-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-22 00:00:00.000000000 Z
12
+ date: 2013-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor