akabei 0.3.5 → 0.4.0

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
  SHA1:
3
- metadata.gz: 0179b8c29f60792ba543f606fad022ba8f278a16
4
- data.tar.gz: aaf31e3fcc70cdc34f9c7658b82a76b608e4ece0
3
+ metadata.gz: 3eb09aa9bd6389e16b3f858e97653c851f779c91
4
+ data.tar.gz: 101a687e2f16c2f58b7bfabc50789852a98e045f
5
5
  SHA512:
6
- metadata.gz: b7e2b018c3e2f93d200878bb9289f85de1f6ab40860cd0de1a976ca0a6da21b06b1590da43d243c04617691ae668c170a2983773c30e5f42033961983330da46
7
- data.tar.gz: b012b634e2d0c5346b59e90cecdf5f64f4739f8047fb71a55d6055476a9c73fd7f796c3845389513ee958aa93cfc77701b98ce6f4528ad7e45526d7a91791c09
6
+ metadata.gz: 3d8d0e2e2c012a44f834da8447c8307ea9d3751b833ff5ef18b0268bab9d9269082c07a36629f9513d22f6841af2af053dc90265913165dae2c65da99577e4c7
7
+ data.tar.gz: 687f42c50a6ce54c338a5b6f519ee9ea1f8fb53642cc8c340a87f58f0c0922b1734cade396b47e86df13d3357e8ac6f2e7a47520885c78229d7852152de4098d
@@ -1,3 +1,6 @@
1
+ # 0.4.0 (2014-11-02)
2
+ - Switch to AWS SDK for Ruby v2
3
+
1
4
  # 0.3.5 (2014-05-09)
2
5
  - Update makepkg.conf template for pacman 4.1.2-6
3
6
 
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "libarchive"
23
23
  spec.add_dependency "safe_yaml"
24
24
  spec.add_dependency "thor"
25
- spec.add_development_dependency "aws-sdk"
25
+ spec.add_development_dependency "aws-sdk-resources"
26
26
  spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "coveralls"
28
28
  spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec", "~> 3.0.0.beta1"
29
+ spec.add_development_dependency "rspec", ">= 3.0"
30
30
  spec.add_development_dependency "simplecov"
31
31
  end
@@ -44,9 +44,9 @@ module Akabei
44
44
 
45
45
  if options[:s3]
46
46
  begin
47
- require 'aws-sdk'
47
+ require 'aws-sdk-resources'
48
48
  rescue LoadError => e
49
- say("WARNING: You don't have aws-sdk installed. Disable S3 repository.", :yellow)
49
+ say("WARNING: You don't have aws-sdk-resources installed. Disable S3 repository.", :yellow)
50
50
  options[:s3] = false
51
51
  end
52
52
  end
@@ -3,12 +3,12 @@ module Akabei
3
3
  class S3
4
4
  def initialize(aws_config, shell)
5
5
  if aws_config
6
- require 'aws-sdk'
7
- @bucket = AWS::S3.new(
6
+ require 'aws-sdk-resources'
7
+ @bucket = Aws::S3::Resource.new(
8
8
  access_key_id: aws_config['access_key_id'],
9
9
  secret_access_key: aws_config['secret_access_key'],
10
10
  region: aws_config['region'],
11
- ).buckets[aws_config['bucket']]
11
+ ).bucket(aws_config['bucket'])
12
12
  @write_options = aws_config['write_options']
13
13
  @shell = shell
14
14
  end
@@ -34,11 +34,11 @@ module Akabei
34
34
  def get(path)
35
35
  @shell.say("Download #{path}", :blue)
36
36
  path.open('wb') do |f|
37
- @bucket.objects[path.to_s].read do |chunk|
37
+ @bucket.object(path.to_s).get do |chunk|
38
38
  f.write(chunk)
39
39
  end
40
40
  end
41
- rescue AWS::S3::Errors::NoSuchKey
41
+ rescue Aws::S3::Errors::NoSuchKey
42
42
  @shell.say("S3: #{path} not found", :red)
43
43
  FileUtils.rm_f(path)
44
44
  end
@@ -64,7 +64,12 @@ module Akabei
64
64
 
65
65
  def put(path, mime_type)
66
66
  @shell.say("Upload #{path}", :green)
67
- @bucket.objects[path.to_s].write(path, @write_options.merge(content_type: mime_type))
67
+ path.open do |f|
68
+ @bucket.object(path.to_s).put(@write_options.merge(
69
+ body: f,
70
+ content_type: mime_type,
71
+ ))
72
+ end
68
73
  end
69
74
  end
70
75
  end
@@ -19,6 +19,6 @@ s3:
19
19
  region:
20
20
  write_options:
21
21
  # :acl: :public_read
22
- # :reduced_redundancy: false
22
+ # :storage_class: REDUCED_REDUNDANCY
23
23
  # :server_side_encryption: :aes256
24
24
  <%- end -%>
@@ -1,3 +1,3 @@
1
1
  module Akabei
2
- VERSION = "0.3.5"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -94,10 +94,8 @@ describe Akabei::Omakase::CLI do
94
94
  let(:bucket_name) { 'test.bucket.name' }
95
95
  let(:region) { 'ap-northeast-1' }
96
96
 
97
- let(:buckets) { double('S3::BucketCollection') }
98
97
  let(:bucket) { double('S3::Bucket') }
99
- let(:objects) { double('S3::ObjectCollection') }
100
- let(:write_options) { { reduced_redundancy: true } }
98
+ let(:write_options) { { storage_class: 'REDUCED_REDUNDANCY' } }
101
99
 
102
100
  before do
103
101
  c = SafeYAML.load_file('.akabei.yml')
@@ -107,31 +105,28 @@ describe Akabei::Omakase::CLI do
107
105
  c['s3']['region'] = region
108
106
  c['s3']['write_options'] = write_options
109
107
  open('.akabei.yml', 'w') { |f| YAML.dump(c, f) }
110
-
111
- allow_any_instance_of(AWS::S3).to receive(:buckets).and_return(buckets)
112
108
  end
113
109
 
114
110
  it 'uploads built packages and update repositories' do
115
111
  %w[i686 x86_64].each do |arch|
116
112
  setup_command_expectations(arch, config.package_dir('nkf'))
117
113
  end
118
- expect(buckets).to receive(:[]).with(bucket_name).and_return(bucket)
119
- allow(bucket).to receive(:objects).and_return(objects)
114
+ allow_any_instance_of(Aws::S3::Resource).to receive(:bucket).with(bucket_name).and_return(bucket)
120
115
 
121
116
  %w[i686 x86_64].each do |arch|
122
117
  %w[test.db test.files test.abs.tar.gz].each do |fname|
123
118
  obj = double("S3::Object #{fname}")
124
119
  # download and upload
125
- expect(objects).to receive(:[]).with("test/os/#{arch}/#{fname}").twice.and_return(obj)
126
- expect(obj).to receive(:read).and_yield('')
127
- expect(obj).to receive(:write)
120
+ expect(bucket).to receive(:object).with("test/os/#{arch}/#{fname}").twice.and_return(obj)
121
+ expect(obj).to receive(:get).and_yield('')
122
+ expect(obj).to receive(:put)
128
123
  end
129
124
 
130
125
  # upload only
131
126
  pkg = double("S3::Object built package (#{arch})")
132
127
  db_name = "nkf-2.1.3-1-#{arch}.pkg.tar.xz"
133
- expect(objects).to receive(:[]).with("test/os/#{arch}/#{db_name}").and_return(pkg)
134
- expect(pkg).to receive(:write).with(anything, hash_including(write_options))
128
+ expect(bucket).to receive(:object).with("test/os/#{arch}/#{db_name}").and_return(pkg)
129
+ expect(pkg).to receive(:put).with(hash_including(write_options))
135
130
  end
136
131
 
137
132
  cli.invoke(:build, ['nkf'])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akabei
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-09 00:00:00.000000000 Z
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gpgme
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: aws-sdk
70
+ name: aws-sdk-resources
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 3.0.0.beta1
131
+ version: '3.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 3.0.0.beta1
138
+ version: '3.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement