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 +4 -4
- data/CHANGELOG.md +3 -0
- data/akabei.gemspec +2 -2
- data/lib/akabei/omakase/cli.rb +2 -2
- data/lib/akabei/omakase/s3.rb +11 -6
- data/lib/akabei/omakase/templates/.akabei.yml.tt +1 -1
- data/lib/akabei/version.rb +1 -1
- data/spec/akabei/omakase/cli_spec.rb +7 -12
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eb09aa9bd6389e16b3f858e97653c851f779c91
|
4
|
+
data.tar.gz: 101a687e2f16c2f58b7bfabc50789852a98e045f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8d0e2e2c012a44f834da8447c8307ea9d3751b833ff5ef18b0268bab9d9269082c07a36629f9513d22f6841af2af053dc90265913165dae2c65da99577e4c7
|
7
|
+
data.tar.gz: 687f42c50a6ce54c338a5b6f519ee9ea1f8fb53642cc8c340a87f58f0c0922b1734cade396b47e86df13d3357e8ac6f2e7a47520885c78229d7852152de4098d
|
data/CHANGELOG.md
CHANGED
data/akabei.gemspec
CHANGED
@@ -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", "
|
29
|
+
spec.add_development_dependency "rspec", ">= 3.0"
|
30
30
|
spec.add_development_dependency "simplecov"
|
31
31
|
end
|
data/lib/akabei/omakase/cli.rb
CHANGED
@@ -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
|
data/lib/akabei/omakase/s3.rb
CHANGED
@@ -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 =
|
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
|
-
).
|
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.
|
37
|
+
@bucket.object(path.to_s).get do |chunk|
|
38
38
|
f.write(chunk)
|
39
39
|
end
|
40
40
|
end
|
41
|
-
rescue
|
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
|
-
|
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
|
data/lib/akabei/version.rb
CHANGED
@@ -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(:
|
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
|
-
|
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(
|
126
|
-
expect(obj).to receive(:
|
127
|
-
expect(obj).to receive(:
|
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(
|
134
|
-
expect(pkg).to receive(:
|
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.
|
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-
|
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
|
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
|
138
|
+
version: '3.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|