fog-riakcs-0.1.0/0000755000175000017500000000000012477055743015041 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/LICENSE.md0000644000175000017500000000217712477055743016454 0ustar balasankarcbalasankarcThe MIT License (MIT) Copyright (c) 2014-2014 [CONTRIBUTORS.md](https://github.com/fog/fog-riakcs/blob/master/CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.fog-riakcs-0.1.0/Gemfile0000644000175000017500000000013712477055743016335 0ustar balasankarcbalasankarcsource 'https://rubygems.org' # Specify your gem's dependencies in fog-riakcs.gemspec gemspec fog-riakcs-0.1.0/gemfiles/0000755000175000017500000000000012477055743016634 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/gemfiles/Gemfile.1.9.3+0000644000175000017500000000016712477055743020655 0ustar balasankarcbalasankarcsource :rubygems gem 'activesupport', '>= 3.0', '< 4' gem 'mime-types', '< 2.0' gem 'fog-core' gemspec :path => '../'fog-riakcs-0.1.0/gemfiles/Gemfile.1.9.2-0000644000175000017500000000021012477055743020643 0ustar balasankarcbalasankarcsource :rubygems gem 'mime-types', '< 2.0' gem 'nokogiri', '< 1.6' gem 'rest-client', '~> 1.6.8' gem 'fog-core' gemspec :path => '../'fog-riakcs-0.1.0/.gitignore0000644000175000017500000000031012477055743017023 0ustar balasankarcbalasankarc*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp *.bundle *.so *.o *.a mkmf.log gemfiles/*.lockfog-riakcs-0.1.0/Rakefile0000644000175000017500000000056712477055743016516 0ustar balasankarcbalasankarcrequire 'bundler/gem_tasks' require 'rake/testtask' Rake::TestTask.new do |t| t.libs.push %w(spec) t.test_files = FileList['spec/**/*_spec.rb'] t.verbose = true end desc 'Default Task' task :default => [ :test, 'test:travis' ] namespace :test do mock = ENV['FOG_MOCK'] || 'true' task :travis do sh("export FOG_MOCK=#{mock} && bundle exec shindont") end endfog-riakcs-0.1.0/metadata.yml0000644000175000017500000001360512477055743017351 0ustar balasankarcbalasankarc--- !ruby/object:Gem::Specification name: fog-riakcs version: !ruby/object:Gem::Version version: 0.1.0 platform: ruby authors: - Paulo Henrique Lopes Ribeiro autorequire: bindir: bin cert_chain: [] date: 2015-02-03 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: fog-core requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: fog-json requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: fog-xml requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: minitest requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: shindo requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: turn requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: pry requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: coveralls requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rubocop requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' description: |- This library can be used as a module for `fog` or as standalone provider to use the Riakcs in applications. email: - plribeiro3000@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".hound.yml" - ".rubocop.yml" - ".ruby-gemset" - ".ruby-version" - ".travis.yml" - CONTRIBUTING.md - CONTRIBUTORS.md - Gemfile - LICENSE.md - README.md - Rakefile - fog-riakcs.gemspec - gemfiles/Gemfile.1.9.2- - gemfiles/Gemfile.1.9.3+ - lib/fog/bin/riakcs.rb - lib/fog/riakcs.rb - lib/fog/riakcs/multipart_utils.rb - lib/fog/riakcs/multipart_utils/headers.rb - lib/fog/riakcs/provisioning.rb - lib/fog/riakcs/provisioning/create_user.rb - lib/fog/riakcs/provisioning/disable_user.rb - lib/fog/riakcs/provisioning/enable_user.rb - lib/fog/riakcs/provisioning/get_user.rb - lib/fog/riakcs/provisioning/list_users.rb - lib/fog/riakcs/provisioning/regrant_secret.rb - lib/fog/riakcs/provisioning/update_user.rb - lib/fog/riakcs/usage.rb - lib/fog/riakcs/usage/get_usage.rb - lib/fog/riakcs/user_utils.rb - lib/fog/riakcs/utils.rb - lib/fog/riakcs/version.rb - spec/minitest_helper.rb - tests/helper.rb - tests/helpers/collection_helper.rb - tests/helpers/flavors_helper.rb - tests/helpers/formats_helper.rb - tests/helpers/formats_helper_tests.rb - tests/helpers/mock_helper.rb - tests/helpers/model_helper.rb - tests/helpers/responds_to_helper.rb - tests/helpers/schema_validator_tests.rb - tests/helpers/server_helper.rb - tests/helpers/servers_helper.rb - tests/helpers/succeeds_helper.rb - tests/riakcs/provisioning/provisioning_tests.rb - tests/riakcs/usage/usage_tests.rb homepage: '' licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.3 signing_key: specification_version: 4 summary: Module for the 'fog' gem to support Riakcs. test_files: - spec/minitest_helper.rb fog-riakcs-0.1.0/.ruby-gemset0000644000175000017500000000001312477055743017277 0ustar balasankarcbalasankarcfog-riakcs fog-riakcs-0.1.0/tests/0000755000175000017500000000000012477055743016203 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/tests/helper.rb0000644000175000017500000000144212477055743020010 0ustar balasankarcbalasankarcrequire 'excon' if ENV['COVERAGE'] require 'coveralls' require 'simplecov' SimpleCov.start do add_filter '/spec/' add_filter '/test/' end end require File.expand_path(File.join(File.dirname(__FILE__), '../lib/fog/riakcs')) Coveralls.wear! if ENV['COVERAGE'] Excon.defaults.merge!(:debug_request => true, :debug_response => true) # This overrides the default 600 seconds timeout during live test runs if Fog.mocking? FOG_TESTING_TIMEOUT = ENV['FOG_TEST_TIMEOUT'] || 2000 Fog.timeout = 2000 Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds" else FOG_TESTING_TIMEOUT = Fog.timeout end def lorem_file File.open(File.dirname(__FILE__) + '/lorem.txt', 'r') end def array_differences(array_a, array_b) (array_a - array_b) | (array_b - array_a) endfog-riakcs-0.1.0/tests/riakcs/0000755000175000017500000000000012477055743017457 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/tests/riakcs/usage/0000755000175000017500000000000012477055743020563 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/tests/riakcs/usage/usage_tests.rb0000644000175000017500000000132112477055743023433 0ustar balasankarcbalasankarcShindo.tests('RiakCS::Usage | usage requests', ['riakcs']) do @blank_usage_format = { 'Access' => { 'Nodes' => [], 'Errors' => [] }, 'Storage' => { 'Samples' => [], 'Errors' => [] } } tests('Statistics retrieval with no data returned') do start_time = Time.now.utc + 86400 end_time = start_time + 86400 tests('via JSON').returns(@blank_usage_format) do Fog::RiakCS[:usage].get_usage(Fog.credentials[:riakcs_access_key_id], :types => [:access, :storage], :start_time => start_time, :end_time => end_time).body end end end fog-riakcs-0.1.0/tests/riakcs/provisioning/0000755000175000017500000000000012477055743022205 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/tests/riakcs/provisioning/provisioning_tests.rb0000644000175000017500000001203612477055743026504 0ustar balasankarcbalasankarcShindo.tests('RiakCS::Provisioning | provisioning requests', ['riakcs']) do current_timestamp = Time.now.to_i user_format = { 'email' => String, 'display_name' => String, 'name' => String, 'key_id' => String, 'key_secret' => String, 'id' => String, 'status' => String, } tests('User creation') do tests('is successful').returns(String) do # Create a user. # email, name = "successful_user_creation_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] key_id.class end tests('is successful anonymously').returns(String) do # Create a user. # email, name = "successful_anonymous_user_creation_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name, :anonymous => true).body['key_id'] key_id.class end tests('fails if duplicate').raises(Fog::RiakCS::Provisioning::UserAlreadyExists) do 2.times do email, name = "failed_duplicate_user_creation_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] end end tests('fails if invalid email').raises(Fog::RiakCS::Provisioning::ServiceUnavailable) do email, name = "failed_duplicate_user_creation_test_#{current_timestamp}", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] end end tests('User disable') do tests('is successful').returns(200) do # Create a user. # email, name = "successful_user_disable_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] Fog::RiakCS[:provisioning].disable_user(key_id).status end end tests('User enable') do tests('is successful').returns(200) do # Create a user. # email, name = "successful_user_disable_enable_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] Fog::RiakCS[:provisioning].disable_user(key_id).status Fog::RiakCS[:provisioning].enable_user(key_id).status end end tests('User granted new key secret') do tests('is successful').returns(true) do # Create a user. # email, name = "successful_user_regrant_test_#{current_timestamp}@example.com", "Fog User" user = Fog::RiakCS[:provisioning].create_user(email, name).body key_id, key_secret = user['key_id'], user['key_secret'] Fog::RiakCS[:provisioning].regrant_secret(key_id).status # Verify new secret. # new_key_secret = Fog::RiakCS[:provisioning].get_user(key_id).body['key_secret'] new_key_secret != key_secret end end tests('User retrieval') do tests('is successful').formats(user_format) do # Create a user. # email, name = "user_retrieval_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] # Get user details. # Fog::RiakCS[:provisioning].get_user(key_id).body end end tests('User listing') do tests('sucessfully lists users').formats(user_format) do # Create a user. # email, name = "user_listing_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] # Ensure the list users response contains the user that we just # created. # Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first end tests('successfully lists users containing no disabled users').returns(nil) do # Create a user. # email, name = "user_listing_without_disabled_users_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] # Disable that user. # Fog::RiakCS[:provisioning].disable_user(key_id) # Ensure the list users response does not contain the user that we # just created and disabled. # Fog::RiakCS[:provisioning].list_users(:status => :enabled).body.select { |x| x['Email'] == email }.first end tests('successfully lists users containing disabled users').formats(user_format) do # Create a user. # email, name = "user_listing_with_disabled_users_test_#{current_timestamp}@example.com", "Fog User" key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] # Disable that user. # Fog::RiakCS[:provisioning].disable_user(key_id) # Ensure the list users response contains the user that we just # created and disabled. # Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first end end end fog-riakcs-0.1.0/tests/helpers/0000755000175000017500000000000012477055743017645 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/tests/helpers/server_helper.rb0000644000175000017500000000124612477055743023042 0ustar balasankarcbalasankarcdef server_tests(connection, params = {}, mocks_implemented = true) model_tests(connection.servers, params, mocks_implemented) do tests('#reload').returns(true) do pending if Fog.mocking? && !mocks_implemented @instance.wait_for { ready? } identity = @instance.identity !identity.nil? && identity == @instance.reload.identity end responds_to([:ready?, :state]) yield if block_given? tests('#reboot').succeeds do pending if Fog.mocking? && !mocks_implemented @instance.wait_for { ready? } @instance.reboot end if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } end end end fog-riakcs-0.1.0/tests/helpers/servers_helper.rb0000644000175000017500000000041012477055743023215 0ustar balasankarcbalasankarcdef servers_tests(connection, params = {}, mocks_implemented = true) collection_tests(connection.servers, params, mocks_implemented) do if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } yield if block_given? end end end fog-riakcs-0.1.0/tests/helpers/collection_helper.rb0000644000175000017500000000502712477055743023670 0ustar balasankarcbalasankarcdef collection_tests(collection, params = {}, mocks_implemented = true) tests('success') do tests("#new(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.new(params) end tests("#create(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented @instance = collection.create(params) end # FIXME: work around for timing issue on AWS describe_instances mocks if Fog.mocking? && @instance.respond_to?(:ready?) @instance.wait_for { ready? } end tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented collection.all end if !Fog.mocking? || mocks_implemented @identity = @instance.identity end tests("#get(#{@identity})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end tests('Enumerable') do pending if Fog.mocking? && !mocks_implemented methods = [ 'all?', 'any?', 'find', 'detect', 'collect', 'map', 'find_index', 'flat_map', 'collect_concat', 'group_by', 'none?', 'one?' ] # JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep # https://github.com/jruby/jruby/issues/1265 if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/ methods.delete('all?') end methods.each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true } block_called end end end [ 'max_by','min_by' ].each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true; 0 } block_called end end end end if block_given? yield(@instance) end if !Fog.mocking? || mocks_implemented @instance.destroy end end tests('failure') do if !Fog.mocking? || mocks_implemented @identity = @identity.to_s @identity = @identity.gsub(/[a-zA-Z]/) { Fog::Mock.random_letters(1) } @identity = @identity.gsub(/\d/) { Fog::Mock.random_numbers(1) } @identity end tests("#get('#{@identity}')").returns(nil) do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end end end fog-riakcs-0.1.0/tests/helpers/mock_helper.rb0000644000175000017500000000057712477055743022473 0ustar balasankarcbalasankarc# Use so you can run in mock mode from the command line # # FOG_MOCK=true fog if ENV["FOG_MOCK"] == "true" Fog.mock! end # if in mocked mode, fill in some fake credentials for us if Fog.mock? Fog.credentials = { :riakcs_access_key_id => 'riakcs_access_key_id', :riakcs_secret_access_key => 'riakcs_secret_access_key', }.merge(Fog.credentials) end fog-riakcs-0.1.0/tests/helpers/model_helper.rb0000644000175000017500000000141212477055743022627 0ustar balasankarcbalasankarcdef model_tests(collection, params = {}, mocks_implemented = true) tests('success') do @instance = collection.new(params) tests("#save").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.save end if block_given? yield(@instance) end tests("#destroy").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.destroy end end end # Generates a unique identifier with a random differentiator. # Useful when rapidly re-running tests, so we don't have to wait # serveral minutes for deleted objects to disappear from the API # E.g. 'fog-test-1234' def uniq_id(base_name = 'fog-test') # random_differentiator suffix = rand(65536).to_s(16).rjust(4, '0') [base_name, suffix] * '-' end fog-riakcs-0.1.0/tests/helpers/flavors_helper.rb0000644000175000017500000000146312477055743023211 0ustar balasankarcbalasankarcdef flavors_tests(connection, params = {}, mocks_implemented = true) tests('success') do tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented connection.flavors.all end if !Fog.mocking? || mocks_implemented @identity = connection.flavors.first.identity end tests("#get('#{@identity}')").succeeds do pending if Fog.mocking? && !mocks_implemented connection.flavors.get(@identity) end end tests('failure') do if !Fog.mocking? || mocks_implemented invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0') end tests("#get('#{invalid_flavor_identity}')").returns(nil) do pending if Fog.mocking? && !mocks_implemented connection.flavors.get(invalid_flavor_identity) end end end fog-riakcs-0.1.0/tests/helpers/responds_to_helper.rb0000644000175000017500000000037412477055743024074 0ustar balasankarcbalasankarcmodule Shindo class Tests def responds_to(method_names) for method_name in [*method_names] tests("#respond_to?(:#{method_name})").returns(true) do @instance.respond_to?(method_name) end end end end end fog-riakcs-0.1.0/tests/helpers/succeeds_helper.rb0000644000175000017500000000020612477055743023325 0ustar balasankarcbalasankarcmodule Shindo class Tests def succeeds test('succeeds') do !!instance_eval(&Proc.new) end end end end fog-riakcs-0.1.0/tests/helpers/formats_helper_tests.rb0000644000175000017500000000702012477055743024425 0ustar balasankarcbalasankarcShindo.tests('test_helper', 'meta') do tests('comparing welcome data against schema') do data = {:welcome => "Hello" } data_matches_schema(:welcome => String) { data } end tests('#data_matches_schema') do tests('when value matches schema expectation') do data_matches_schema({"key" => String}) { {"key" => "Value"} } end tests('when values within an array all match schema expectation') do data_matches_schema({"key" => [Integer]}) { {"key" => [1, 2]} } end tests('when nested values match schema expectation') do data_matches_schema({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} } end tests('when collection of values all match schema expectation') do data_matches_schema([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] } end tests('when collection is empty although schema covers optional members') do data_matches_schema([{"key" => String}], {:allow_optional_rules => true}) { [] } end tests('when additional keys are passed and not strict') do data_matches_schema({"key" => String}, {:allow_extra_keys => true}) { {"key" => "Value", :extra => "Bonus"} } end tests('when value is nil and schema expects NilClass') do data_matches_schema({"key" => NilClass}) { {"key" => nil} } end tests('when value and schema match as hashes') do data_matches_schema({}) { {} } end tests('when value and schema match as arrays') do data_matches_schema([]) { [] } end tests('when value is a Time') do data_matches_schema({"time" => Time}) { {"time" => Time.now} } end tests('when key is missing but value should be NilClass (#1477)') do data_matches_schema({"key" => NilClass}, {:allow_optional_rules => true}) { {} } end tests('when key is missing but value is nullable (#1477)') do data_matches_schema({"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) { {} } end end tests('#formats backwards compatible changes') do tests('when value matches schema expectation') do formats({"key" => String}) { {"key" => "Value"} } end tests('when values within an array all match schema expectation') do formats({"key" => [Integer]}) { {"key" => [1, 2]} } end tests('when nested values match schema expectation') do formats({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} } end tests('when collection of values all match schema expectation') do formats([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] } end tests('when collection is empty although schema covers optional members') do formats([{"key" => String}]) { [] } end tests('when additional keys are passed and not strict') do formats({"key" => String}, false) { {"key" => "Value", :extra => "Bonus"} } end tests('when value is nil and schema expects NilClass') do formats({"key" => NilClass}) { {"key" => nil} } end tests('when value and schema match as hashes') do formats({}) { {} } end tests('when value and schema match as arrays') do formats([]) { [] } end tests('when value is a Time') do formats({"time" => Time}) { {"time" => Time.now} } end tests('when key is missing but value should be NilClass (#1477)') do formats({"key" => NilClass}) { {} } end tests('when key is missing but value is nullable (#1477)') do formats({"key" => Fog::Nullable::String}) { {} } end end end fog-riakcs-0.1.0/tests/helpers/schema_validator_tests.rb0000644000175000017500000000723112477055743024724 0ustar balasankarcbalasankarcShindo.tests('Fog::Schema::DataValidator', 'meta') do validator = Fog::Schema::DataValidator.new tests('#validate') do tests('returns true') do returns(true, 'when value matches schema expectation') do validator.validate({"key" => "Value"}, {"key" => String}) end returns(true, 'when values within an array all match schema expectation') do validator.validate({"key" => [1, 2]}, {"key" => [Integer]}) end returns(true, 'when nested values match schema expectation') do validator.validate({"key" => {:nested_key => "Value"}}, {"key" => {:nested_key => String}}) end returns(true, 'when collection of values all match schema expectation') do validator.validate([{"key" => "Value"}, {"key" => "Value"}], [{"key" => String}]) end returns(true, 'when collection is empty although schema covers optional members') do validator.validate([], [{"key" => String}]) end returns(true, 'when additional keys are passed and not strict') do validator.validate({"key" => "Value", :extra => "Bonus"}, {"key" => String}, {:allow_extra_keys => true}) end returns(true, 'when value is nil and schema expects NilClass') do validator.validate({"key" => nil}, {"key" => NilClass}) end returns(true, 'when value and schema match as hashes') do validator.validate({}, {}) end returns(true, 'when value and schema match as arrays') do validator.validate([], []) end returns(true, 'when value is a Time') do validator.validate({"time" => Time.now}, {"time" => Time}) end returns(true, 'when key is missing but value should be NilClass (#1477)') do validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => true}) end returns(true, 'when key is missing but value is nullable (#1477)') do validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) end end tests('returns false') do returns(false, 'when value does not match schema expectation') do validator.validate({"key" => nil}, {"key" => String}) end returns(false, 'when key formats do not match') do validator.validate({"key" => "Value"}, {:key => String}) end returns(false, 'when additional keys are passed and strict') do validator.validate({"key" => "Missing"}, {}) end returns(false, 'when some keys do not appear') do validator.validate({}, {"key" => String}) end returns(false, 'when collection contains a member that does not match schema') do validator.validate([{"key" => "Value"}, {"key" => 5}], [{"key" => String}]) end returns(false, 'when collection has multiple schema patterns') do validator.validate([{"key" => "Value"}], [{"key" => Integer}, {"key" => String}]) end returns(false, 'when hash and array are compared') do validator.validate({}, []) end returns(false, 'when array and hash are compared') do validator.validate([], {}) end returns(false, 'when a hash is expected but another data type is found') do validator.validate({"key" => {:nested_key => []}}, {"key" => {:nested_key => {}}}) end returns(false, 'when key is missing but value should be NilClass (#1477)') do validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => false}) end returns(false, 'when key is missing but value is nullable (#1477)') do validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => false}) end end end end fog-riakcs-0.1.0/tests/helpers/formats_helper.rb0000644000175000017500000000705612477055743023214 0ustar balasankarcbalasankarcrequire "fog/schema/data_validator" # format related hackery # allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean) # allows both nil.is_a?(Fog::Nullable::String) and ''.is_a?(Fog::Nullable::String) module Fog module Boolean; end module Nullable module Boolean; end module Integer; end module String; end module Time; end module Float; end module Hash; end module Array; end end end [FalseClass, TrueClass].each {|klass| klass.send(:include, Fog::Boolean)} [FalseClass, TrueClass, NilClass, Fog::Boolean].each {|klass| klass.send(:include, Fog::Nullable::Boolean)} [NilClass, String].each {|klass| klass.send(:include, Fog::Nullable::String)} [NilClass, Time].each {|klass| klass.send(:include, Fog::Nullable::Time)} [Integer, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Integer)} [Float, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Float)} [Hash, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Hash)} [Array, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Array)} module Shindo class Tests # Generates a Shindo test that compares a hash schema to the result # of the passed in block returning true if they match. # # The schema that is passed in is a Hash or Array of hashes that # have Classes in place of values. When checking the schema the # value should match the Class. # # Strict mode will fail if the data has additional keys. Setting # +strict+ to +false+ will allow additional keys to appear. # # @param [Hash] schema A Hash schema # @param [Hash] options Options to change validation rules # @option options [Boolean] :allow_extra_keys # If +true+ does not fail when keys are in the data that are # not specified in the schema. This allows new values to # appear in API output without breaking the check. # @option options [Boolean] :allow_optional_rules # If +true+ does not fail if extra keys are in the schema # that do not match the data. Not recommended! # @yield Data to check with schema # # @example Using in a test # Shindo.tests("comparing welcome data against schema") do # data = {:welcome => "Hello" } # data_matches_schema(:welcome => String) { data } # end # # comparing welcome data against schema # + data matches schema # # @example Example schema # { # "id" => String, # "ram" => Integer, # "disks" => [ # { # "size" => Float # } # ], # "dns_name" => Fog::Nullable::String, # "active" => Fog::Boolean, # "created" => DateTime # } # # @return [Boolean] def data_matches_schema(schema, options = {}) test('data matches schema') do validator = Fog::Schema::DataValidator.new valid = validator.validate(yield, schema, options) @message = validator.message unless valid valid end end # @deprecated #formats is deprecated. Use #data_matches_schema instead def formats(format, strict = true) test('has proper format') do if strict options = {:allow_extra_keys => false, :allow_optional_rules => true} else options = {:allow_extra_keys => true, :allow_optional_rules => true} end validator = Fog::Schema::DataValidator.new valid = validator.validate(yield, format, options) @message = validator.message unless valid valid end end end end fog-riakcs-0.1.0/lib/0000755000175000017500000000000012477055743015607 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/0000755000175000017500000000000012477055743016362 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/bin/0000755000175000017500000000000012477055743017132 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/bin/riakcs.rb0000644000175000017500000000076012477055743020736 0ustar balasankarcbalasankarcclass RiakCS < Fog::Bin class << self def class_for(key) case key when :provisioning Fog::RiakCS::Provisioning when :usage Fog::RiakCS::Usage else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = class_for(key) end @@connections[service] end def services Fog::RiakCS.services end end endfog-riakcs-0.1.0/lib/fog/riakcs/0000755000175000017500000000000012477055743017636 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/riakcs/version.rb0000644000175000017500000000007312477055743021650 0ustar balasankarcbalasankarcmodule Fog module Riakcs VERSION = "0.1.0" end end fog-riakcs-0.1.0/lib/fog/riakcs/utils.rb0000644000175000017500000000062412477055743021325 0ustar balasankarcbalasankarcmodule Fog module RiakCS module Utils def configure_uri_options(options = {}) @host = options[:host] || 'localhost' @persistent = options[:persistent] || true @port = options[:port] || 8080 @scheme = options[:scheme] || 'http' end def riakcs_uri "#{@scheme}://#{@host}:#{@port}" end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning.rb0000644000175000017500000000600712477055743022714 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning < Fog::Service class UserAlreadyExists < Fog::RiakCS::Provisioning::Error; end class ServiceUnavailable < Fog::RiakCS::Provisioning::Error; end requires :riakcs_access_key_id, :riakcs_secret_access_key recognizes :host, :path, :port, :scheme, :persistent, :path_style request_path 'fog/riakcs/provisioning' request :create_user request :update_user request :disable_user request :enable_user request :list_users request :get_user request :regrant_secret class Mock include Fog::RiakCS::Utils def self.data @data ||= Hash.new({}) end def self.reset @data = nil end def initialize(options = {}) configure_uri_options(options) end def data self.class.data[riakcs_uri] end def reset_data self.class.data.delete(riakcs_uri) end end class Real include Fog::RiakCS::Utils def initialize(options = {}) configure_uri_options(options) @riakcs_access_key_id = options[:riakcs_access_key_id] @riakcs_secret_access_key = options[:riakcs_secret_access_key] @connection_options = options[:connection_options] || {} @persistent = options[:persistent] || false @path_style = options[:path_style] || false @raw_connection = Fog::XML::Connection.new(riakcs_uri, @persistent, @connection_options) @s3_connection = Fog::Storage.new( :provider => 'AWS', :aws_access_key_id => @riakcs_access_key_id, :aws_secret_access_key => @riakcs_secret_access_key, :host => @host, :port => @port, :scheme => @scheme, :path_style => @path_style, :connection_options => @connection_options ) end def request(params, parse_response = true, &block) begin response = @raw_connection.request(params.merge({ :host => @host, :path => "#{@path}/#{params[:path]}", }), &block) rescue Excon::Errors::HTTPStatusError => error if match = error.message.match(/(.*?)<\/Code>(?:.*(.*?)<\/Message>)?/m) case match[1] when 'UserAlreadyExists' raise Fog::RiakCS::Provisioning.const_get(match[1]).new when 'ServiceUnavailable' raise Fog::RiakCS::Provisioning.const_get(match[1]).new else raise error end else raise error end end if !response.body.empty? && parse_response response.body = Fog::JSON.decode(response.body) end response end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/multipart_utils.rb0000644000175000017500000000236212477055743023427 0ustar balasankarcbalasankarcmodule Fog module RiakCS module MultipartUtils autoload :Headers, 'fog/riakcs/multipart_utils/headers' def parse(data, boundary) contents = data.match(end_boundary_regex(boundary)).pre_match rescue "" contents.split(inner_boundary_regex(boundary)).reject(&:empty?).map do |part| parse_multipart_section(part) end.compact end def extract_boundary(header_string) $1 if header_string =~ /boundary=([A-Za-z0-9\'()+_,-.\/:=?]+)/ end private def end_boundary_regex(boundary) /\r?\n--#{Regexp.escape(boundary)}--\r?\n?/ end def inner_boundary_regex(boundary) /\r?\n--#{Regexp.escape(boundary)}\r?\n/ end def parse_multipart_section(part) headers = Headers.new if md = part.match(/\r?\n\r?\n/) body = md.post_match md.pre_match.split(/\r?\n/).each do |line| headers.parse(line) end if headers["content-type"] =~ /multipart\/mixed/ boundary = extract_boundary(headers.to_hash["content-type"].first) parse(body, boundary) else {:headers => headers.to_hash, :body => body} end end end end end endfog-riakcs-0.1.0/lib/fog/riakcs/usage/0000755000175000017500000000000012477055743020742 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/riakcs/usage/get_usage.rb0000644000175000017500000000367412477055743023244 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Usage module Utils TYPES_TO_STRING = { :access => 'a', :storage => 'b' } DEFAULT_TYPES = TYPES_TO_STRING.keys DEFAULT_FORMAT = :json def sanitize_and_convert_time(time) time.utc.iso8601.gsub(/[:-]/, '') end def format_and_types_to_path(format, types) format_character = format.to_s.split('').first type_characters = types.map { |t| TYPES_TO_STRING[t] }.compact [type_characters, format_character].flatten.compact.join end def request_uri(access_key_id, options) format = DEFAULT_FORMAT types = options[:types] || DEFAULT_TYPES start_time = options[:start_time] || Time.now.utc - 86400 end_time = options[:end_time] || Time.now.utc [access_key_id, format_and_types_to_path(format, types), sanitize_and_convert_time(start_time), sanitize_and_convert_time(end_time)].join('.') end end class Real include Utils def get_usage(access_key_id, options = {}) response = @connection.get_object('riak-cs', ["usage", request_uri(access_key_id, options)].join("/")) if !response.body.empty? response.body = Fog::JSON.decode(response.body) end response end end class Mock include Utils def get_usage(access_key, options = {}) Excon::Response.new.tap do |response| response.status = 200 response.headers['Content-Type'] = 'application/json' response.body = { 'Access' => { 'Nodes' => [], 'Errors' => [] }, 'Storage' => { 'Samples' => [], 'Errors' => [] } } end end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/0000755000175000017500000000000012477055743022364 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/riakcs/provisioning/enable_user.rb0000644000175000017500000000067212477055743025202 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include UserUtils include MultipartUtils def enable_user(key_id) update_riakcs_user(key_id, { :status => 'enabled' }) end end class Mock include UserUtils def enable_user(key_id) update_mock_user(key_id, { :status => 'enabled' }) end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/create_user.rb0000644000175000017500000000477412477055743025226 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real def create_user(email, name, options = {}) payload = Fog::JSON.encode({ :email => email, :name => name }) headers = { 'Content-Type' => 'application/json' } if(options[:anonymous]) request( :expects => [201], :method => 'POST', :path => 'user', :body => payload, :headers => headers ) else begin response = @s3_connection.put_object('riak-cs', 'user', payload, headers) if !response.body.empty? case response.headers['Content-Type'] when 'application/json' response.body = Fog::JSON.decode(response.body) end end response rescue Excon::Errors::Conflict => e raise Fog::RiakCS::Provisioning::UserAlreadyExists.new rescue Excon::Errors::BadRequest => e raise Fog::RiakCS::Provisioning::ServiceUnavailable.new end end end end class Mock def invalid_email?(email) !email.include?('@') end def user_exists?(email) data.find do |key, value| value[:email] == email end end def create_user(email, name, options = {}) if invalid_email?(email) raise Fog::RiakCS::Provisioning::ServiceUnavailable, "The email address you provided is not a valid." end if user_exists?(email) raise Fog::RiakCS::Provisioning::UserAlreadyExists, "User with email #{email} already exists." end key_id = rand(1000).to_s key_secret = rand(1000).to_s data[key_id] = { :email => email, :name => name, :status => 'enabled', :key_secret => key_secret } Excon::Response.new.tap do |response| response.status = 200 response.headers['Content-Type'] = 'application/json' response.body = { "email" => data[:email], "display_name" => data[:name], "name" => "user123", "key_id" => key_id, "key_secret" => key_secret, "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "status" => "enabled" } end end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/disable_user.rb0000644000175000017500000000067612477055743025363 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include UserUtils include MultipartUtils def disable_user(key_id) update_riakcs_user(key_id, { :status => 'disabled' }) end end class Mock include UserUtils def disable_user(key_id) update_mock_user(key_id, { :status => 'disabled' }) end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/update_user.rb0000644000175000017500000000063612477055743025236 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include UserUtils include MultipartUtils def update_user(key_id, user) update_riakcs_user(key_id, user) end end class Mock include UserUtils def update_user(key_id, user) update_mock_user(key_id, user) end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/list_users.rb0000644000175000017500000000256512477055743025115 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include MultipartUtils def list_users(options = {}) response = @s3_connection.get_object('riak-cs', 'users', { 'Accept' => 'application/json', 'query' => options }) boundary = extract_boundary(response.headers['Content-Type']) parts = parse(response.body, boundary) decoded = parts.map { |part| Fog::JSON.decode(part[:body]) } response.body = decoded.flatten response end end class Mock def list_users(options = {}) filtered_data = options[:status] ? data.select { |key, value| value[:status] == options[:status] } : data Excon::Response.new.tap do |response| response.status = 200 response.body = filtered_data.map do |key, value| { "email" => value[:email], "display_name" => value[:name], "name" => "user123", "key_id" => key, "key_secret" => value[:key_secret], "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "status" => value[:status] } end.compact end end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/get_user.rb0000644000175000017500000000242312477055743024527 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include MultipartUtils def get_user(key_id) response = @s3_connection.get_object('riak-cs', "user/#{key_id}", { 'Accept' => 'application/json' }) response.body = Fog::JSON.decode(response.body) response end end class Mock def get_user(key_id) if user = data[key_id] Excon::Response.new.tap do |response| response.status = 200 response.headers['Content-Type'] = 'application/json' response.body = { "email" => user[:email], "display_name" => user[:name], "name" => "user123", "key_id" => "XXXXXXXXXXXXXXXXXXXX", "key_secret" => user[:key_secret], "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "status" => user[:status] } end else Excon::Response.new.tap do |response| response.status = 404 response.headers['Content-Type'] = 'application/json' end end end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/provisioning/regrant_secret.rb0000644000175000017500000000070612477055743025723 0ustar balasankarcbalasankarcmodule Fog module RiakCS class Provisioning class Real include Utils include UserUtils include MultipartUtils def regrant_secret(key_id) update_riakcs_user(key_id, { :new_key_secret => true }) end end class Mock include UserUtils def regrant_secret(key_id) update_mock_user(key_id, { :new_key_secret => true }) end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/multipart_utils/0000755000175000017500000000000012477055743023077 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/lib/fog/riakcs/multipart_utils/headers.rb0000644000175000017500000000156112477055743025042 0ustar balasankarcbalasankarcrequire 'net/http' module Fog module RiakCS module MultipartUtils class Headers include Net::HTTPHeader def initialize initialize_http_header({}) end # Parse a single header line into its key and value # @param [String] chunk a single header line def self.parse(chunk) line = chunk.strip # thanks Net::HTTPResponse return [nil,nil] if chunk =~ /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in m = /\A([^:]+):\s*/.match(line) [m[1], m.post_match] rescue [nil, nil] end # Parses a header line and adds it to the header collection # @param [String] chunk a single header line def parse(chunk) key, value = self.class.parse(chunk) add_field(key, value) if key && value end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/user_utils.rb0000644000175000017500000000162212477055743022362 0ustar balasankarcbalasankarcmodule Fog module RiakCS module UserUtils def update_riakcs_user(key_id, user) response = @s3_connection.put_object('riak-cs', "user/#{key_id}", Fog::JSON.encode(user), { 'Content-Type' => 'application/json' }) if !response.body.empty? response.body = Fog::JSON.decode(response.body) end response end def update_mock_user(key_id, user) if data[key_id] if status = user[:status] data[key_id][:status] = status end if user[:new_key_secret] data[key_id][:key_secret] = rand(100).to_s end Excon::Response.new.tap do |response| response.status = 200 response.body = data[key_id] end else Excon::Response.new.tap do |response| response.status = 403 end end end end end end fog-riakcs-0.1.0/lib/fog/riakcs/usage.rb0000644000175000017500000000313212477055743021266 0ustar balasankarcbalasankarcrequire 'time' module Fog module RiakCS class Usage < Fog::Service requires :riakcs_access_key_id, :riakcs_secret_access_key recognizes :host, :path, :port, :scheme, :persistent request_path 'fog/riakcs/usage' request :get_usage class Mock include Fog::RiakCS::Utils def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end def self.reset @data = nil end def initialize(options = {}) configure_uri_options(options) end def data self.class.data[riakcs_uri] end def reset_data self.class.data.delete(riakcs_uri) end end class Real include Fog::RiakCS::Utils def initialize(options = {}) configure_uri_options(options) @riakcs_access_key_id = options[:riakcs_access_key_id] @riakcs_secret_access_key = options[:riakcs_secret_access_key] @connection_options = options[:connection_options] || {} @persistent = options[:persistent] || false @connection = Fog::Storage.new( :provider => 'AWS', :aws_access_key_id => @riakcs_access_key_id, :aws_secret_access_key => @riakcs_secret_access_key, :host => @host, :port => @port, :scheme => @scheme, :connection_options => @connection_options ) end end end end end fog-riakcs-0.1.0/lib/fog/riakcs.rb0000644000175000017500000000066212477055743020167 0ustar balasankarcbalasankarcrequire "fog/riakcs/version" require "fog/core" module Fog module RiakCS extend Fog::Provider autoload :MultipartUtils, 'fog/riakcs/multipart_utils' autoload :Provisioning, 'fog/riakcs/provisioning' autoload :Utils, 'fog/riakcs/utils' autoload :UserUtils, 'fog/riakcs/user_utils' autoload :Usage, 'fog/riakcs/usage' service(:provisioning, 'Provisioning') service(:usage, 'Usage') end end fog-riakcs-0.1.0/.ruby-version0000644000175000017500000000000612477055743017502 0ustar balasankarcbalasankarc2.1.5 fog-riakcs-0.1.0/CONTRIBUTING.md0000644000175000017500000000154112477055743017273 0ustar balasankarcbalasankarc## Getting Involved New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another. ### Coding * Pick a task: * Offer feedback on open [pull requests](https://github.com/fog/fog-riakcs/pulls). * Review open [issues](https://github.com/fog/fog-riakcs/issues) for things to help on. * [Create an issue](https://github.com/fog/fog-riakcs/issues/new) to start a discussion on additions or features. * Fork the project, add your changes and tests to cover them in a topic branch. * Commit your changes and rebase against `fog/fog-riakcs` to ensure everything is up to date. * [Submit a pull request](https://github.com/fog/fog-riakcs/compare/) ### Non-Coding * Offer feedback on open [issues](https://github.com/fog/fog-riakcs/issues). * Organize or volunteer at events.fog-riakcs-0.1.0/spec/0000755000175000017500000000000012477055743015773 5ustar balasankarcbalasankarcfog-riakcs-0.1.0/spec/minitest_helper.rb0000644000175000017500000000147612477055743021523 0ustar balasankarcbalasankarcrequire 'minitest/spec' require 'minitest/autorun' require 'turn' Turn.config do |c| # use one of output formats: # :outline - turn's original case/test outline mode [default] # :progress - indicates progress with progress bar # :dotted - test/unit's traditional dot-progress mode # :pretty - new pretty reporter # :marshal - dump output as YAML (normal run mode only) # :cue - interactive testing # c.format = :outline # turn on invoke/execute tracing, enable full backtrace c.trace = 20 # use humanized test names (works only with :outline format) c.natural = true end if ENV['COVERAGE'] require 'coveralls' require 'simplecov' SimpleCov.start do add_filter '/spec/' end end require File.join(File.dirname(__FILE__), '../lib/fog/riakcs') Coveralls.wear! if ENV['COVERAGE'] fog-riakcs-0.1.0/CONTRIBUTORS.md0000644000175000017500000000070512477055743017322 0ustar balasankarcbalasankarc* Brian D. Burns * Christopher Meiklejohn * Derek Richard and Karen Wang * Eric Hodel * Erik Michaels-Ober * Hector Castro * Lance Ivy * Kyle Rames * Paul Thornthwaite * Paulo Henrique Lopes Ribeiro fog-riakcs-0.1.0/.travis.yml0000644000175000017500000000066212477055743017156 0ustar balasankarcbalasankarcmatrix: include: - rvm: 1.8.7 gemfile: gemfiles/Gemfile.1.9.2- - rvm: 1.9.2 gemfile: gemfiles/Gemfile.1.9.2- - rvm: 1.9.3 gemfile: gemfiles/Gemfile.1.9.3+ - rvm: 2.0.0 gemfile: gemfiles/Gemfile.1.9.3+ - rvm: 2.1.4 gemfile: gemfiles/Gemfile.1.9.3+ env: COVERAGE=true - rvm: ree gemfile: gemfiles/Gemfile.1.9.2- - rvm: jruby gemfile: gemfiles/Gemfile.1.9.3+ fog-riakcs-0.1.0/.hound.yml0000644000175000017500000000047412477055743016764 0ustar balasankarcbalasankarcMetrics/LineLength: Enabled: false Style/EachWithObject: Enabled: false Style/Encoding: EnforcedStyle: when_needed Style/FormatString: Enabled: false Style/HashSyntax: EnforcedStyle: hash_rockets Style/SignalException: EnforcedStyle: only_raise Style/StringLiterals: EnforcedStyle: double_quotes fog-riakcs-0.1.0/README.md0000644000175000017500000000235712477055743016327 0ustar balasankarcbalasankarc# Fog::Riakcs ![Gem Version](https://badge.fury.io/rb/fog-riakcs.svg) [![Build Status](https://travis-ci.org/fog/fog-riakcs.svg?branch=master)](https://travis-ci.org/fog/fog-riakcs) [![Dependency Status](https://gemnasium.com/fog/fog-riakcs.svg)](https://gemnasium.com/fog/fog-riakcs) [![Coverage Status](https://img.shields.io/coveralls/fog/fog-riakcs.svg)](https://coveralls.io/r/fog/fog-riakcs?branch=master) [![Code Climate](https://codeclimate.com/github/fog/fog-riakcs.png)](https://codeclimate.com/github/fog/fog-riakcs) Module for the 'fog' gem to support Riakcs ## Help Needed This gem needs a maintainer. If you want to work on it, please contact [@geemus](mailto:geemus@gmail.com) or [@plribeiro3000](mailto:plribeiro3000@gmail.com) ## Installation Add this line to your application's Gemfile: ```ruby gem 'fog-riakcs' ``` And then execute: $ bundle Or install it yourself as: $ gem install fog-riakcs ## Usage TODO: Write usage instructions here ## Contributing 1. Fork it ( https://github.com/fog/fog-riakcs/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request fog-riakcs-0.1.0/fog-riakcs.gemspec0000644000175000017500000000245212477055743020436 0ustar balasankarcbalasankarc# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fog/riakcs/version' Gem::Specification.new do |spec| spec.name = "fog-riakcs" spec.version = Fog::Riakcs::VERSION spec.authors = ["Paulo Henrique Lopes Ribeiro"] spec.email = ["plribeiro3000@gmail.com"] spec.summary = %q{Module for the 'fog' gem to support Riakcs.} spec.description = %q{This library can be used as a module for `fog` or as standalone provider to use the Riakcs in applications.} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "fog-core" spec.add_dependency "fog-json" spec.add_dependency "fog-xml" spec.add_development_dependency "rake" spec.add_development_dependency "minitest" spec.add_development_dependency "shindo" spec.add_development_dependency "turn" spec.add_development_dependency "pry" if RUBY_VERSION.to_f > 1.9 spec.add_development_dependency "coveralls" spec.add_development_dependency "rubocop" end end fog-riakcs-0.1.0/.rubocop.yml0000644000175000017500000000047412477055743017320 0ustar balasankarcbalasankarcMetrics/LineLength: Enabled: false Style/EachWithObject: Enabled: false Style/Encoding: EnforcedStyle: when_needed Style/FormatString: Enabled: false Style/HashSyntax: EnforcedStyle: hash_rockets Style/SignalException: EnforcedStyle: only_raise Style/StringLiterals: EnforcedStyle: double_quotes