a9s_swift 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +105 -0
- data/LICENSE.txt +20 -0
- data/README.md +57 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/a9s_swift.gemspec +66 -0
- data/examples/rails_carrierwave_initializer.rb +7 -0
- data/examples/rails_paperclip_initializer.rb +7 -0
- data/lib/a9s_swift.rb +10 -0
- data/lib/a9s_swift/utility.rb +110 -0
- data/test/helper.rb +34 -0
- data/test/test_a9s_swift.rb +7 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3abb3585ace40df7fac853a7dcd46f70233663f6
|
4
|
+
data.tar.gz: 72e10f8a0deb3410ab69a31cd343a23404ea780e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1737f1fc453221b54286ffdb924a8b754de75d0bea657a3a97d38ceb2678ea23da184558bf8ec5003d97bf6a15cd55f2cf48f38b54303e01f2e5230ac7d72006
|
7
|
+
data.tar.gz: 8883b2375203f6f5f9588b9c54c242afef08bb07bbb22b5b3d7e8a5a54a90555beb6ee947bfc876d42c3777904e503335bf5643c1d9389a10c29b5096ef726b4
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "rdoc", "~> 3.12"
|
11
|
+
gem "bundler", "~> 1.0"
|
12
|
+
gem "jeweler", "~> 2.0.1"
|
13
|
+
gem "simplecov", ">= 0"
|
14
|
+
end
|
15
|
+
|
16
|
+
group :production do
|
17
|
+
gem 'fog'
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.0.4)
|
5
|
+
i18n (~> 0.6, >= 0.6.9)
|
6
|
+
minitest (~> 4.2)
|
7
|
+
multi_json (~> 1.3)
|
8
|
+
thread_safe (~> 0.1)
|
9
|
+
tzinfo (~> 0.3.37)
|
10
|
+
addressable (2.3.5)
|
11
|
+
atomic (1.1.15)
|
12
|
+
builder (3.2.2)
|
13
|
+
descendants_tracker (0.0.3)
|
14
|
+
docile (1.1.3)
|
15
|
+
excon (0.32.1)
|
16
|
+
faraday (0.9.0)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
fog (1.21.0)
|
19
|
+
fog-brightbox
|
20
|
+
fog-core (~> 1.21, >= 1.21.1)
|
21
|
+
fog-json
|
22
|
+
nokogiri (~> 1.5, >= 1.5.11)
|
23
|
+
fog-brightbox (0.0.1)
|
24
|
+
fog-core
|
25
|
+
fog-json
|
26
|
+
fog-core (1.21.1)
|
27
|
+
builder
|
28
|
+
excon (~> 0.32)
|
29
|
+
formatador (~> 0.2.0)
|
30
|
+
mime-types
|
31
|
+
net-scp (~> 1.1)
|
32
|
+
net-ssh (>= 2.1.3)
|
33
|
+
fog-json (1.0.0)
|
34
|
+
multi_json (~> 1.0)
|
35
|
+
formatador (0.2.4)
|
36
|
+
git (1.2.6)
|
37
|
+
github_api (0.11.3)
|
38
|
+
addressable (~> 2.3)
|
39
|
+
descendants_tracker (~> 0.0.1)
|
40
|
+
faraday (~> 0.8, < 0.10)
|
41
|
+
hashie (>= 1.2)
|
42
|
+
multi_json (>= 1.7.5, < 2.0)
|
43
|
+
nokogiri (~> 1.6.0)
|
44
|
+
oauth2
|
45
|
+
hashie (2.0.5)
|
46
|
+
highline (1.6.21)
|
47
|
+
i18n (0.6.9)
|
48
|
+
jeweler (2.0.1)
|
49
|
+
builder
|
50
|
+
bundler (>= 1.0)
|
51
|
+
git (>= 1.2.5)
|
52
|
+
github_api
|
53
|
+
highline (>= 1.6.15)
|
54
|
+
nokogiri (>= 1.5.10)
|
55
|
+
rake
|
56
|
+
rdoc
|
57
|
+
json (1.8.1)
|
58
|
+
jwt (0.1.11)
|
59
|
+
multi_json (>= 1.5)
|
60
|
+
mime-types (2.0)
|
61
|
+
mini_portile (0.5.3)
|
62
|
+
minitest (4.7.5)
|
63
|
+
multi_json (1.9.2)
|
64
|
+
multi_xml (0.5.5)
|
65
|
+
multipart-post (2.0.0)
|
66
|
+
net-scp (1.1.2)
|
67
|
+
net-ssh (>= 2.6.5)
|
68
|
+
net-ssh (2.8.0)
|
69
|
+
nokogiri (1.6.1)
|
70
|
+
mini_portile (~> 0.5.0)
|
71
|
+
oauth2 (0.9.3)
|
72
|
+
faraday (>= 0.8, < 0.10)
|
73
|
+
jwt (~> 0.1.8)
|
74
|
+
multi_json (~> 1.3)
|
75
|
+
multi_xml (~> 0.5)
|
76
|
+
rack (~> 1.2)
|
77
|
+
rack (1.5.2)
|
78
|
+
rake (10.2.2)
|
79
|
+
rdoc (3.12.2)
|
80
|
+
json (~> 1.4)
|
81
|
+
shoulda (3.5.0)
|
82
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
83
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
84
|
+
shoulda-context (1.1.6)
|
85
|
+
shoulda-matchers (2.5.0)
|
86
|
+
activesupport (>= 3.0.0)
|
87
|
+
simplecov (0.8.2)
|
88
|
+
docile (~> 1.1.0)
|
89
|
+
multi_json
|
90
|
+
simplecov-html (~> 0.8.0)
|
91
|
+
simplecov-html (0.8.0)
|
92
|
+
thread_safe (0.3.1)
|
93
|
+
atomic (>= 1.1.7, < 2)
|
94
|
+
tzinfo (0.3.39)
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
ruby
|
98
|
+
|
99
|
+
DEPENDENCIES
|
100
|
+
bundler (~> 1.0)
|
101
|
+
fog
|
102
|
+
jeweler (~> 2.0.1)
|
103
|
+
rdoc (~> 3.12)
|
104
|
+
shoulda
|
105
|
+
simplecov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Julian Weber
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
= a9s_swift
|
2
|
+
|
3
|
+
a9s_swift is a small utility gem to ease up the usage of the anyines.com swift service within your applications.
|
4
|
+
It enables a one-line configuration of the following libraries:
|
5
|
+
|
6
|
+
* paperclip
|
7
|
+
* carrierwave
|
8
|
+
* fog
|
9
|
+
|
10
|
+
== Dependencies
|
11
|
+
|
12
|
+
* fog gem : https://github.com/fog/fog
|
13
|
+
* paperclip (optional: if you would like to use the paperclip configuration feature)
|
14
|
+
* carrierwave (optional: if you would like to use the carrierwave configuration feature)
|
15
|
+
|
16
|
+
== Installation
|
17
|
+
gem install a9s_swift
|
18
|
+
|
19
|
+
or
|
20
|
+
|
21
|
+
gem 'a9s_swift' -> Gemfile
|
22
|
+
bundle
|
23
|
+
|
24
|
+
== Usage
|
25
|
+
|
26
|
+
=== rails applications with carrierwave or paperclip
|
27
|
+
|
28
|
+
Some example initializers are provided in the examples directory. Just copy the according file over to your rails application's app/config/initializers directory and start using the anynines swift service within your live applications.
|
29
|
+
|
30
|
+
Please make sure to bind a swift service instance to your application to enable access to the swift credentials.
|
31
|
+
|
32
|
+
=== fog
|
33
|
+
con = Anynines::Swift::Utility.fog_connection # returns a fog connection to the a9s swift service
|
34
|
+
con.directories
|
35
|
+
|
36
|
+
=== paperclip configuration featue
|
37
|
+
Anynines::Swift::Utility.configure_paperclip("image_bucket") # create bucket, configure paperclip with a9s swift service
|
38
|
+
|
39
|
+
=== carrierwave configuration feature
|
40
|
+
Anynines::Swift::Utility.configure_carrierwave("image_bucket") # create bucket, configure carrierwave with a9s swift service
|
41
|
+
|
42
|
+
|
43
|
+
== Contributing to a9s_swift
|
44
|
+
|
45
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
46
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
47
|
+
* Fork the project.
|
48
|
+
* Start a feature/bugfix branch.
|
49
|
+
* Commit and push until you are happy with your contribution.
|
50
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
51
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
52
|
+
|
53
|
+
== Copyright
|
54
|
+
|
55
|
+
Copyright (c) 2014 Julian Weber. See LICENSE.txt for
|
56
|
+
further details.
|
57
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "a9s_swift"
|
18
|
+
gem.homepage = "http://github.com/anynines/a9s_swift"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{anynines.com swift service utility library for simplifying app acces to the a9s swift service.}
|
21
|
+
gem.description = %Q{anynines.com swift service utility library for simplifying app acces to the a9s swift service.}
|
22
|
+
gem.email = "jweber@anynines.com"
|
23
|
+
gem.authors = ["Julian Weber"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Code coverage detail"
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = "true"
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "a9s_swift #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Run an irb console session'
|
54
|
+
task :irb_console do
|
55
|
+
exec("irb -r ./lib/a9s_swift.rb")
|
56
|
+
end
|
57
|
+
|
58
|
+
task irb: :irb_console
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/a9s_swift.gemspec
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: a9s_swift 0.1.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "a9s_swift"
|
9
|
+
s.version = "0.1.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Julian Weber"]
|
14
|
+
s.date = "2014-04-04"
|
15
|
+
s.description = "anynines.com swift service utility library for simplifying app acces to the a9s swift service."
|
16
|
+
s.email = "jweber@anynines.com"
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"a9s_swift.gemspec",
|
30
|
+
"examples/rails_carrierwave_initializer.rb",
|
31
|
+
"examples/rails_paperclip_initializer.rb",
|
32
|
+
"lib/a9s_swift.rb",
|
33
|
+
"lib/a9s_swift/utility.rb",
|
34
|
+
"test/helper.rb",
|
35
|
+
"test/test_a9s_swift.rb"
|
36
|
+
]
|
37
|
+
s.homepage = "http://github.com/anynines/a9s_swift"
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.rubygems_version = "2.2.2"
|
40
|
+
s.summary = "anynines.com swift service utility library for simplifying app acces to the a9s swift service."
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 4
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
48
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
50
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
56
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
62
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
63
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
data/lib/a9s_swift.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'fog'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Anynines::Swift::Utility
|
5
|
+
SWIFT_HOST = "https://swift.hydranodes.de"
|
6
|
+
|
7
|
+
# Returns a fog storage connection to the swift service
|
8
|
+
# @return [Fog::Storage] a fog storage connection
|
9
|
+
def self.fog_connection
|
10
|
+
Fog::Storage.new fog_credentials_hash
|
11
|
+
end
|
12
|
+
|
13
|
+
# Sets up paperclip for the usage with the anynines service.
|
14
|
+
# Creates a bucket with the given name if not already present.
|
15
|
+
# @param image_bucket_name [String] the bucket name to use
|
16
|
+
# @param options [Hash] a hash of additional options
|
17
|
+
def self.configure_paperclip(image_bucket_name, options = {})
|
18
|
+
raise "Paperclip wasn't found in your environment! Please verify that paperclip is included within your Gemfile and loaded correctly." if defined?(Paperclip).nil?
|
19
|
+
|
20
|
+
opts = initialize_options options
|
21
|
+
create_new_bucket(image_bucket_name, opts[:fog_public])
|
22
|
+
|
23
|
+
fog_hash = fog_credentials_hash
|
24
|
+
# configure paperclip to use the credentials provided by the anynines environment
|
25
|
+
|
26
|
+
Paperclip::Attachment.default_options.update(
|
27
|
+
{
|
28
|
+
:path => ":class/:id/:attachment/:style/img_:fingerprint",
|
29
|
+
:storage => :fog,
|
30
|
+
:fog_credentials => {
|
31
|
+
:provider => fog_hash[:provider],
|
32
|
+
:hp_access_key => fog_hash[:hp_access_key],
|
33
|
+
:hp_secret_key => fog_hash[:hp_secret_key],
|
34
|
+
:hp_tenant_id => fog_hash[:hp_tenant_id],
|
35
|
+
:hp_auth_uri => fog_hash[:hp_auth_uri],
|
36
|
+
:hp_use_upass_auth_style => true,
|
37
|
+
:hp_avl_zone => fog_hash[:hp_avl_zone]
|
38
|
+
},
|
39
|
+
:fog_directory => image_bucket_name,
|
40
|
+
:fog_public => opts[:fog_public],
|
41
|
+
:fog_host => "#{SWIFT_HOST}/v1/AUTH_#{fog_hash[:hp_tenant_id]}/#{image_bucket_name}"
|
42
|
+
})
|
43
|
+
end
|
44
|
+
|
45
|
+
# Sets up carrierwave for the usage with the anynines service.
|
46
|
+
# Creates a bucket with the given name if not already present.
|
47
|
+
# @param image_bucket_name [String] the bucket name to use
|
48
|
+
# @param options [Hash] a hash of additional options
|
49
|
+
def self.configure_carrierwave(image_bucket_name, options = {})
|
50
|
+
raise "CarrierWave wasn't found in your environment! Please verify that carrierwave is included within your Gemfile and loaded correctly." if defined?(CarrierWave).nil?
|
51
|
+
|
52
|
+
opts = initialize_options options
|
53
|
+
create_new_bucket(image_bucket_name, opts[:fog_public])
|
54
|
+
|
55
|
+
CarrierWave.configure do |config|
|
56
|
+
config.fog_credentials = fog_credentials_hash
|
57
|
+
|
58
|
+
config.fog_directory = image_bucket_name
|
59
|
+
config.fog_public = opts[:fog_public] # optional, defaults to true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns a fog compatible credentials hash for the swift service
|
64
|
+
def self.fog_credentials_hash
|
65
|
+
# parse the VCAP_SERVICES environment variable
|
66
|
+
services = JSON.parse(ENV["VCAP_SERVICES"])
|
67
|
+
raise "Couldn't find the VCAP_SERVICE env variable! Are you running within an anynines environment?" if services.nil?
|
68
|
+
raise "Couldn't access the a9s swift service credentials from env! Have you bound a swift service instance to the application?" if services["swift-1.0"].nil?
|
69
|
+
swift_service = services["swift-1.0"].first
|
70
|
+
|
71
|
+
return {
|
72
|
+
:provider => 'HP',
|
73
|
+
:hp_access_key => swift_service["credentials"]["user_name"],
|
74
|
+
:hp_secret_key => swift_service["credentials"]["password"],
|
75
|
+
:hp_tenant_id => swift_service["credentials"]["tenant_id"],
|
76
|
+
:hp_auth_uri => swift_service["credentials"]["authentication_uri"],
|
77
|
+
:hp_use_upass_auth_style => true,
|
78
|
+
:hp_avl_zone => swift_service["credentials"]["availability_zone"]
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# Creates a new bucket with the given name if not already present
|
83
|
+
# @param bucket_name [String] a name for the bucket
|
84
|
+
# @param public_access [Boolean] should the bucket be publicly accessible?
|
85
|
+
def self.create_new_bucket(bucket_name, public_access)
|
86
|
+
connection = fog_connection
|
87
|
+
if connection.directories.get(bucket_name).nil?
|
88
|
+
puts "The bucket with key=#{bucket_name} wasn't found. Creating bucket with key=#{bucket_name} ."
|
89
|
+
bucket = connection.directories.create key: bucket_name
|
90
|
+
|
91
|
+
# set the directory to be public
|
92
|
+
bucket.public = public_access
|
93
|
+
bucket.save
|
94
|
+
|
95
|
+
connection = nil
|
96
|
+
return true
|
97
|
+
else
|
98
|
+
puts "The bucket with key=#{bucket_name} is already present! Skipping bucket creation."
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
def self.initialize_options(options)
|
106
|
+
# set fog_public to true if not defined within the options
|
107
|
+
options[:fog_public] = true if options[:fog_public].nil?
|
108
|
+
return options
|
109
|
+
end
|
110
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_adapter 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
require 'rubygems'
|
18
|
+
require 'bundler'
|
19
|
+
begin
|
20
|
+
Bundler.setup(:default, :development)
|
21
|
+
rescue Bundler::BundlerError => e
|
22
|
+
$stderr.puts e.message
|
23
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
+
exit e.status_code
|
25
|
+
end
|
26
|
+
require 'test/unit'
|
27
|
+
require 'shoulda'
|
28
|
+
|
29
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
|
+
require 'a9s_swift'
|
32
|
+
|
33
|
+
class Test::Unit::TestCase
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: a9s_swift
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julian Weber
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: shoulda
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: anynines.com swift service utility library for simplifying app acces
|
84
|
+
to the a9s swift service.
|
85
|
+
email: jweber@anynines.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files:
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
files:
|
92
|
+
- .document
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- VERSION
|
99
|
+
- a9s_swift.gemspec
|
100
|
+
- examples/rails_carrierwave_initializer.rb
|
101
|
+
- examples/rails_paperclip_initializer.rb
|
102
|
+
- lib/a9s_swift.rb
|
103
|
+
- lib/a9s_swift/utility.rb
|
104
|
+
- test/helper.rb
|
105
|
+
- test/test_a9s_swift.rb
|
106
|
+
homepage: http://github.com/anynines/a9s_swift
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.2.2
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: anynines.com swift service utility library for simplifying app acces to the
|
130
|
+
a9s swift service.
|
131
|
+
test_files: []
|