easy_s3 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in easy_s3.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/easy_s3/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "easy_s3"
6
+ s.version = EasyS3::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Jon Allured"]
9
+ s.email = ["jon.allured@me.com"]
10
+ s.homepage = "http://rubygems.org/gems/easy_s3"
11
+ s.summary = "easy wrapper for working with S3"
12
+ s.description = "easy wrapper for working with S3"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
18
+ s.require_path = 'lib'
19
+
20
+ s.add_dependency "aws-s3"
21
+ end
@@ -0,0 +1,29 @@
1
+ require 'aws/s3'
2
+
3
+ s3_key = ENV['EASY_S3_KEY']
4
+ s3_secret = ENV['EASY_S3_SECRET']
5
+ S3_BUCKET = ENV['EASY_S3_BUCKET']
6
+ AWS::S3::Base.establish_connection!(:access_key_id => s3_key, :secret_access_key => s3_secret)
7
+
8
+ module EasyS3
9
+ def self.write(path, data)
10
+ # creates a new file or overwrites an existing file with data
11
+ AWS::S3::S3Object.store(path, data, S3_BUCKET, :access => :public_read)
12
+ end
13
+ def self.append(path, data)
14
+ # appends data to the value of the file
15
+ self.write(path, self.read(path) + data)
16
+ end
17
+ def self.read(path)
18
+ # retuns the actual value of the file, use EasyS3.get_file if you want the object
19
+ self.file(path).value
20
+ end
21
+ def self.file(path)
22
+ # retuns the actual file object, use .value to get the contents
23
+ AWS::S3::S3Object.find(path, S3_BUCKET)
24
+ end
25
+ def self.exists?(path)
26
+ # returns true or false depending on whether the file exists
27
+ AWS::S3::S3Object.exists?(path, S3_BUCKET)
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module EasyS3
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: easy_s3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jon Allured
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-03 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: aws-s3
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: easy wrapper for working with S3
36
+ email:
37
+ - jon.allured@me.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - Rakefile
48
+ - easy_s3.gemspec
49
+ - lib/easy_s3.rb
50
+ - lib/easy_s3/version.rb
51
+ has_rdoc: true
52
+ homepage: http://rubygems.org/gems/easy_s3
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 23
75
+ segments:
76
+ - 1
77
+ - 3
78
+ - 6
79
+ version: 1.3.6
80
+ requirements: []
81
+
82
+ rubyforge_project:
83
+ rubygems_version: 1.3.7
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: easy wrapper for working with S3
87
+ test_files: []
88
+