frm 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/frm +1 -1
- data/frm.gemspec +1 -2
- data/lib/frm/release_pusher.rb +2 -2
- data/lib/frm/s3.rb +21 -33
- data/lib/frm/version.rb +1 -1
- data/lib/frm.rb +6 -7
- metadata +3 -19
data/bin/frm
CHANGED
data/frm.gemspec
CHANGED
data/lib/frm/release_pusher.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module FRM
|
2
2
|
|
3
3
|
class ReleasePusher < Base
|
4
|
-
def initialize(package_release,access_key,secret_key,bucket,prefix
|
4
|
+
def initialize(package_release,access_key,secret_key,bucket,prefix)
|
5
5
|
@release = package_release.release
|
6
6
|
@bucket = bucket
|
7
7
|
@prefix = prefix
|
8
|
-
@s3 = FRM::S3.new(access_key,secret_key
|
8
|
+
@s3 = FRM::S3.new(access_key,secret_key)
|
9
9
|
push_packages(package_release.packages)
|
10
10
|
push_release_files(package_release)
|
11
11
|
end
|
data/lib/frm/s3.rb
CHANGED
@@ -1,28 +1,27 @@
|
|
1
|
-
|
2
|
-
STDERR.puts "#{File.join my_dir, 's3'}"
|
3
|
-
#require File.join my_dir, 'base'
|
4
|
-
|
1
|
+
require 'aws-sdk'
|
5
2
|
|
6
3
|
module FRM
|
7
4
|
class S3 < Base
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
|
6
|
+
attr_reader :max_retries, :s3
|
7
|
+
|
8
|
+
def initialize(access_key_id,secret_access_key)
|
12
9
|
@max_retries = 10
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
AWS.config(:access_key_id => access_key_id,
|
11
|
+
:secret_access_key => secret_access_key)
|
12
|
+
@s3 = AWS::S3.new
|
16
13
|
end
|
14
|
+
|
17
15
|
|
18
16
|
def key?(key,bucket)
|
19
|
-
|
17
|
+
@s3.buckets[bucket].objects[key].exists?
|
20
18
|
end
|
19
|
+
|
21
20
|
|
22
21
|
def put(key,value,bucket)
|
23
22
|
@max_retries.times do |i|
|
24
23
|
begin
|
25
|
-
|
24
|
+
@s3.buckets[bucket].objects[key].write(value)
|
26
25
|
return true
|
27
26
|
rescue Object => o
|
28
27
|
print_retry(__method__,o)
|
@@ -31,12 +30,12 @@ module FRM
|
|
31
30
|
end
|
32
31
|
raise "could not put object!!!"
|
33
32
|
end
|
34
|
-
|
33
|
+
|
34
|
+
|
35
35
|
def get(key,bucket)
|
36
36
|
@max_retries.times do |i|
|
37
37
|
begin
|
38
|
-
|
39
|
-
return value
|
38
|
+
return @s3.buckets[bucket].objects[key].read
|
40
39
|
rescue Object => o
|
41
40
|
print_retry(__method__,o)
|
42
41
|
end
|
@@ -45,32 +44,21 @@ module FRM
|
|
45
44
|
raise "could not get object!!!"
|
46
45
|
end
|
47
46
|
|
48
|
-
def get_stream(key,bucket)
|
49
|
-
@max_retries.times do |i|
|
50
|
-
begin
|
51
|
-
stream = AWS::S3::S3Object.stream(key,bucket)
|
52
|
-
return stream
|
53
|
-
rescue Object => o
|
54
|
-
print_retry(__method__,o)
|
55
|
-
end
|
56
|
-
raise "could not get object!!!" if i == (@max_retries - 1)
|
57
|
-
end
|
58
|
-
raise "could not get object!!!"
|
59
|
-
end
|
60
47
|
|
61
48
|
def delete(key,bucket)
|
62
49
|
begin
|
63
|
-
|
64
|
-
true
|
50
|
+
@s3.buckets[bucket].objects[object].delete
|
51
|
+
return true
|
65
52
|
rescue Object => o
|
66
53
|
print_retry(__method__,o)
|
67
54
|
end
|
68
55
|
end
|
69
56
|
|
70
|
-
|
57
|
+
|
58
|
+
def move(old_key,new_key,bucket)
|
71
59
|
begin
|
72
|
-
|
73
|
-
return
|
60
|
+
@s3.buckets[bucket].objects[old_key].move_to(new_key)
|
61
|
+
return true
|
74
62
|
rescue Object => o
|
75
63
|
print_retry(__method__,o)
|
76
64
|
end
|
data/lib/frm/version.rb
CHANGED
data/lib/frm.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
DEFAULT_HOST = 's3-us-west-1.amazonaws.com' # stupid hack to point to the right s3 region
|
2
1
|
|
3
2
|
require 'zlib'
|
4
3
|
require 'tempfile'
|
@@ -6,10 +5,10 @@ require 'digest/md5'
|
|
6
5
|
require 'digest/sha1'
|
7
6
|
require 'digest/sha2'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
require_relative 'frm/base'
|
9
|
+
require_relative 'frm/s3'
|
10
|
+
require_relative 'frm/package'
|
11
|
+
require_relative 'frm/release'
|
12
|
+
require_relative 'frm/release_pusher'
|
13
|
+
require_relative 'frm/deb'
|
15
14
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: aws-
|
15
|
+
name: aws-sdk
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: mock-aws-s3
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
30
|
description: FRM makes it easy to build package repositories on S3
|
47
31
|
email:
|
48
32
|
- ermal14@gmail.com
|