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 CHANGED
@@ -63,7 +63,7 @@ optparse.parse!
63
63
 
64
64
 
65
65
  ARGV.each do |package|
66
- packages << package
66
+ packages << File.join(Dir.pwd,package)
67
67
  end
68
68
 
69
69
 
data/frm.gemspec CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["bin"]
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_dependency('aws-s3')
23
+ s.add_dependency('aws-sdk')
24
24
 
25
- s.add_development_dependency('mock-aws-s3')
26
25
  end
27
26
 
@@ -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,server='s3-us-west-1.amazonaws.com')
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,server)
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
- my_dir = File.dirname __FILE__
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
- attr_reader :max_retries
9
- @connection
10
- def initialize(access_key_id,secret_access_key,server='s3.amazonaws.com')
11
- require 'aws/s3'
5
+
6
+ attr_reader :max_retries, :s3
7
+
8
+ def initialize(access_key_id,secret_access_key)
12
9
  @max_retries = 10
13
- @connection = AWS::S3::Base.establish_connection!(:access_key_id => access_key_id,
14
- :secret_access_key => secret_access_key,
15
- :server => server )
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
- AWS::S3::S3Object.exists?(key,bucket)
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
- AWS::S3::S3Object.store(key,value,bucket,:server => 's3-us-west-1.amazonaws.com',:access => :public_read)
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
- value = AWS::S3::S3Object.value(key,bucket)
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
- AWS::S3::S3Object.delete(key,bucket)
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
- def move(old_key,new_key,vucket)
57
+
58
+ def move(old_key,new_key,bucket)
71
59
  begin
72
- AWS::S3::S3Object.rename(old_key,new_key,bucket)
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
@@ -1,3 +1,3 @@
1
1
  module Frm
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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
- require 'frm/base'
10
- require 'frm/s3'
11
- require 'frm/package'
12
- require 'frm/release'
13
- require 'frm/release_pusher'
14
- require 'frm/deb'
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.7
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-08-14 00:00:00.000000000 Z
12
+ date: 2012-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: aws-s3
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