secret_service 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.gitignore +18 -0
  2. data/.travis.yml +15 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +22 -0
  5. data/README.md +41 -0
  6. data/Rakefile +57 -0
  7. data/lib/secret_service.rb +13 -0
  8. data/lib/secret_service/database_store.rb +5 -0
  9. data/lib/secret_service/database_store/active_record_store.rb +66 -0
  10. data/lib/secret_service/store.rb +35 -0
  11. data/lib/secret_service/version.rb +3 -0
  12. data/secret_service.gemspec +19 -0
  13. data/spec/rails-2.3/Gemfile +10 -0
  14. data/spec/rails-2.3/Rakefile +11 -0
  15. data/spec/rails-2.3/app_root/config/boot.rb +128 -0
  16. data/spec/rails-2.3/app_root/config/database.yml +6 -0
  17. data/spec/rails-2.3/app_root/config/environment.rb +14 -0
  18. data/spec/rails-2.3/app_root/config/environments/test.rb +0 -0
  19. data/spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb +1 -0
  20. data/spec/rails-2.3/app_root/config/preinitializer.rb +20 -0
  21. data/spec/rails-2.3/app_root/config/routes.rb +13 -0
  22. data/spec/rails-2.3/app_root/log/.gitignore +1 -0
  23. data/spec/rails-2.3/rcov.opts +2 -0
  24. data/spec/rails-2.3/spec.opts +4 -0
  25. data/spec/rails-2.3/spec/spec_helper.rb +20 -0
  26. data/spec/rails-3.0/.rspec +2 -0
  27. data/spec/rails-3.0/Gemfile +10 -0
  28. data/spec/rails-3.0/Rakefile +11 -0
  29. data/spec/rails-3.0/app_root/.gitignore +4 -0
  30. data/spec/rails-3.0/app_root/config/application.rb +31 -0
  31. data/spec/rails-3.0/app_root/config/boot.rb +13 -0
  32. data/spec/rails-3.0/app_root/config/database.yml +6 -0
  33. data/spec/rails-3.0/app_root/config/environment.rb +5 -0
  34. data/spec/rails-3.0/app_root/config/environments/test.rb +35 -0
  35. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +10 -0
  37. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +5 -0
  38. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +7 -0
  39. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +8 -0
  40. data/spec/rails-3.0/app_root/config/routes.rb +3 -0
  41. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  42. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  43. data/spec/rails-3.0/app_root/script/rails +6 -0
  44. data/spec/rails-3.0/rcov.opts +2 -0
  45. data/spec/rails-3.0/spec/spec_helper.rb +18 -0
  46. data/spec/rails-3.2/.rspec +2 -0
  47. data/spec/rails-3.2/Gemfile +9 -0
  48. data/spec/rails-3.2/Rakefile +11 -0
  49. data/spec/rails-3.2/app_root/.gitignore +4 -0
  50. data/spec/rails-3.2/app_root/config/application.rb +31 -0
  51. data/spec/rails-3.2/app_root/config/boot.rb +13 -0
  52. data/spec/rails-3.2/app_root/config/database.yml +6 -0
  53. data/spec/rails-3.2/app_root/config/environment.rb +5 -0
  54. data/spec/rails-3.2/app_root/config/environments/test.rb +35 -0
  55. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +10 -0
  57. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +5 -0
  58. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +7 -0
  59. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +8 -0
  60. data/spec/rails-3.2/app_root/config/routes.rb +3 -0
  61. data/spec/rails-3.2/app_root/log/.gitignore +1 -0
  62. data/spec/rails-3.2/rcov.opts +2 -0
  63. data/spec/rails-3.2/spec/spec_helper.rb +17 -0
  64. data/spec/shared/app_root/app/controllers/application_controller.rb +2 -0
  65. data/spec/shared/app_root/config/database.yml.sample +6 -0
  66. data/spec/shared/app_root/db/consul_test.db +0 -0
  67. data/spec/shared/secret_service/secret_service_spec.rb +24 -0
  68. data/spec/shared/secret_service/store_spec.rb +89 -0
  69. data/spec/shared/support/wipe_store.rb +10 -0
  70. metadata +189 -0
@@ -0,0 +1,6 @@
1
+ test:
2
+ adapter: mysql2
3
+ host: localhost
4
+ username: root
5
+ password: secret
6
+ database: secret_service_test
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), 'boot')
2
+
3
+ Rails::Initializer.run do |config|
4
+ config.cache_classes = false
5
+ config.whiny_nils = true
6
+ config.action_controller.session = { :key => "_myapp_session", :secret => "gwirofjweroijger8924rt2zfwehfuiwehb1378rifowenfoqwphf23" }
7
+ config.plugin_locators.unshift(
8
+ Class.new(Rails::Plugin::Locator) do
9
+ def plugins
10
+ [Rails::Plugin.new(File.expand_path('.'))]
11
+ end
12
+ end
13
+ ) unless defined?(PluginTestHelper::PluginLocator)
14
+ end
@@ -0,0 +1 @@
1
+ MissingSourceFile::REGEXPS.push([/^cannot load such file -- (.+)$/i, 1])
@@ -0,0 +1,20 @@
1
+ begin
2
+ require "rubygems"
3
+ require "bundler"
4
+ rescue LoadError
5
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
6
+ end
7
+
8
+ if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10
+ "Run `gem install bundler` to upgrade."
11
+ end
12
+
13
+ begin
14
+ # Set up load paths for all bundled gems
15
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16
+ Bundler.setup
17
+ rescue Bundler::GemNotFound
18
+ raise RuntimeError, "Bundler couldn't find some gems." +
19
+ "Did you run `bundle install`?"
20
+ end
@@ -0,0 +1,13 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+ map.resource :dashboard, :member => { :error => :post }
4
+
5
+ map.resources :songs
6
+
7
+ map.resources :users
8
+
9
+ map.resources :risks
10
+
11
+ map.resources :cakes, :member => { :custom_action => :get }
12
+
13
+ end
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,20 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ # Set the default environment to sqlite3's in_memory database
4
+ ENV['RAILS_ENV'] = 'test'
5
+
6
+ # Load the Rails environment and testing framework
7
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
8
+ require 'spec/rails'
9
+
10
+ # Undo changes to RAILS_ENV
11
+ silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
12
+
13
+ # Requires supporting files with custom matchers and macros, etc in ./support/ and its subdirectories.
14
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
15
+
16
+
17
+ Spec::Runner.configure do |config|
18
+ config.use_transactional_fixtures = true
19
+ config.use_instantiated_fixtures = false
20
+ end
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~>3.0.17'
4
+ gem 'rspec'
5
+ gem 'rspec-rails'
6
+ gem 'shoulda-matchers'
7
+ gem 'mysql2', '<0.3'
8
+ gem 'ruby-debug', :platforms => :mri_18
9
+
10
+ gem 'secret_service', :path => '../..'
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ t.verbose = false
11
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module SpecApp
10
+ class Application < Rails::Application
11
+ config.encoding = "utf-8"
12
+
13
+ config.cache_classes = true
14
+ config.whiny_nils = true
15
+
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ config.active_support.deprecation = :stderr
26
+
27
+ config.root = File.expand_path('../..', __FILE__)
28
+
29
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,6 @@
1
+ test:
2
+ adapter: mysql2
3
+ host: localhost
4
+ username: root
5
+ password: secret
6
+ database: secret_service_test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ SpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SpecApp::Application.config.session_store :cookie_store, :key => '_app_root_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # HasDefaultSpecApp::Application.config.session_store :active_record_store
@@ -0,0 +1,3 @@
1
+ SpecApp::Application.routes.draw do
2
+ match ':controller(/:action(/:id(.:format)))'
3
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby1.8
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,18 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ # Set the default environment to sqlite3's in_memory database
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ ENV['RAILS_ROOT'] = 'app_root'
6
+
7
+ # Load the Rails environment and testing framework
8
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
9
+ require 'rspec/rails'
10
+
11
+
12
+ # Requires supporting files with custom matchers and macros, etc in ./support/ and its subdirectories.
13
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
14
+
15
+ RSpec.configure do |config|
16
+ config.use_transactional_fixtures = true
17
+ config.use_instantiated_fixtures = false
18
+ end
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~>3.2.0'
4
+ gem 'rspec'
5
+ gem 'rspec-rails'
6
+ gem 'mysql2'
7
+ gem 'ruby-debug', :platforms => :mri_18
8
+
9
+ gem 'secret_service', :path => '../..'
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ t.verbose = false
11
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module SpecApp
10
+ class Application < Rails::Application
11
+ config.encoding = "utf-8"
12
+
13
+ config.cache_classes = true
14
+ config.whiny_nils = true
15
+
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ config.active_support.deprecation = :stderr
26
+
27
+ config.root = File.expand_path('../..', __FILE__)
28
+
29
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,6 @@
1
+ test:
2
+ adapter: mysql2
3
+ host: localhost
4
+ username: root
5
+ password: secret
6
+ database: secret_service_test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end