active_record_samplooper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +8 -0
  4. data/.travis.yml +23 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +173 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +2 -0
  9. data/Rakefile +4 -0
  10. data/active_record_samplooper.gemspec +31 -0
  11. data/lib/active_record_samplooper/version.rb +3 -0
  12. data/lib/active_record_samplooper.rb +65 -0
  13. data/lib/tasks/active_record_samplooper_tasks.rake +4 -0
  14. data/spec/dummy/README.rdoc +28 -0
  15. data/spec/dummy/Rakefile +6 -0
  16. data/spec/dummy/app/assets/images/.keep +0 -0
  17. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  18. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  20. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  21. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  22. data/spec/dummy/app/mailers/.keep +0 -0
  23. data/spec/dummy/app/models/.keep +0 -0
  24. data/spec/dummy/app/models/concerns/.keep +0 -0
  25. data/spec/dummy/app/models/sample_model.rb +2 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/bin/setup +29 -0
  31. data/spec/dummy/config/application.rb +32 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.def.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +41 -0
  36. data/spec/dummy/config/environments/production.rb +79 -0
  37. data/spec/dummy/config/environments/test.rb +42 -0
  38. data/spec/dummy/config/initializers/assets.rb +11 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/spec/dummy/config/initializers/inflections.rb +16 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  44. data/spec/dummy/config/initializers/session_store.rb +3 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/dummy/config/locales/en.yml +23 -0
  47. data/spec/dummy/config/routes.rb +56 -0
  48. data/spec/dummy/config/secrets.yml +22 -0
  49. data/spec/dummy/config.ru +4 -0
  50. data/spec/dummy/db/migrate/20150624180458_create_sample_models.rb +9 -0
  51. data/spec/dummy/db/schema.rb +22 -0
  52. data/spec/dummy/lib/assets/.keep +0 -0
  53. data/spec/dummy/log/.keep +0 -0
  54. data/spec/dummy/public/404.html +67 -0
  55. data/spec/dummy/public/422.html +67 -0
  56. data/spec/dummy/public/500.html +66 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/factories/sample_models.rb +5 -0
  59. data/spec/models/sample_model_spec.rb +74 -0
  60. data/spec/rails_helper.rb +64 -0
  61. data/spec/spec_helper.rb +95 -0
  62. metadata +230 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 35dfea447fa08cfc82b123c5bc06d6ad2caf5c38
4
+ data.tar.gz: ea450c35639d51348a2cc0a781951f1be61917ed
5
+ SHA512:
6
+ metadata.gz: 609e7bb9a16eeb8f42106f4da8696a3074dfdf3cb52b4ec7dcb6c962294534fc3b731c498258f52630dfffee45fdf8a26ef76996f941edc7724adf1dd5b1000a
7
+ data.tar.gz: 8cd1c674c0a696da9437e7383892ae6a4659d10086acefb406e509dd77e9270131f223a0f83d040f5a11824b356b6f55a40e148074fa7791495fdfd50e4d15cf
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/db/*.sqlite3-journal
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ spec/dummy/.sass-cache
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.5
5
+ - 2.2.2
6
+ env:
7
+ - DB=sqlite
8
+ before_install:
9
+ - gem install bundler -v 1.10.3
10
+ install:
11
+ - bundle install --without production --deployment
12
+ cache:
13
+ directories:
14
+ - vendor/bundle
15
+ before_script:
16
+ - cp spec/dummy/config/database.def.yml spec/dummy/config/database.yml
17
+ script:
18
+ - cd spec/dummy
19
+ - bundle exec rake db:create RAILS_ENV=test
20
+ - bundle exec rake db:migrate RAILS_ENV=test
21
+ - bundle exec rake db:test:prepare
22
+ - cd ../../
23
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in active_record_samplooper.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
15
+
data/Gemfile.lock ADDED
@@ -0,0 +1,173 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ active_record_samplooper (0.0.1)
5
+ rails (~> 4.2.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.2)
11
+ actionpack (= 4.2.2)
12
+ actionview (= 4.2.2)
13
+ activejob (= 4.2.2)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.2)
17
+ actionview (= 4.2.2)
18
+ activesupport (= 4.2.2)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
+ actionview (4.2.2)
24
+ activesupport (= 4.2.2)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
29
+ activejob (4.2.2)
30
+ activesupport (= 4.2.2)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.2)
33
+ activesupport (= 4.2.2)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.2)
36
+ activemodel (= 4.2.2)
37
+ activesupport (= 4.2.2)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.2)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ arel (6.0.0)
46
+ builder (3.2.2)
47
+ coveralls (0.8.2)
48
+ json (~> 1.8)
49
+ rest-client (>= 1.6.8, < 2)
50
+ simplecov (~> 0.10.0)
51
+ term-ansicolor (~> 1.3)
52
+ thor (~> 0.19.1)
53
+ diff-lcs (1.2.5)
54
+ docile (1.1.5)
55
+ domain_name (0.5.24)
56
+ unf (>= 0.0.5, < 1.0.0)
57
+ erubis (2.7.0)
58
+ factory_girl (4.5.0)
59
+ activesupport (>= 3.0.0)
60
+ factory_girl_rails (4.5.0)
61
+ factory_girl (~> 4.5.0)
62
+ railties (>= 3.0.0)
63
+ globalid (0.3.5)
64
+ activesupport (>= 4.1.0)
65
+ http-cookie (1.0.2)
66
+ domain_name (~> 0.5)
67
+ i18n (0.7.0)
68
+ json (1.8.3)
69
+ loofah (2.0.2)
70
+ nokogiri (>= 1.5.9)
71
+ mail (2.6.3)
72
+ mime-types (>= 1.16, < 3)
73
+ mime-types (2.6.1)
74
+ mini_portile (0.6.2)
75
+ minitest (5.7.0)
76
+ netrc (0.10.3)
77
+ nokogiri (1.6.6.2)
78
+ mini_portile (~> 0.6.0)
79
+ rack (1.6.4)
80
+ rack-test (0.6.3)
81
+ rack (>= 1.0)
82
+ rails (4.2.2)
83
+ actionmailer (= 4.2.2)
84
+ actionpack (= 4.2.2)
85
+ actionview (= 4.2.2)
86
+ activejob (= 4.2.2)
87
+ activemodel (= 4.2.2)
88
+ activerecord (= 4.2.2)
89
+ activesupport (= 4.2.2)
90
+ bundler (>= 1.3.0, < 2.0)
91
+ railties (= 4.2.2)
92
+ sprockets-rails
93
+ rails-deprecated_sanitizer (1.0.3)
94
+ activesupport (>= 4.2.0.alpha)
95
+ rails-dom-testing (1.0.6)
96
+ activesupport (>= 4.2.0.beta, < 5.0)
97
+ nokogiri (~> 1.6.0)
98
+ rails-deprecated_sanitizer (>= 1.0.1)
99
+ rails-html-sanitizer (1.0.2)
100
+ loofah (~> 2.0)
101
+ railties (4.2.2)
102
+ actionpack (= 4.2.2)
103
+ activesupport (= 4.2.2)
104
+ rake (>= 0.8.7)
105
+ thor (>= 0.18.1, < 2.0)
106
+ rake (10.4.2)
107
+ rest-client (1.8.0)
108
+ http-cookie (>= 1.0.2, < 2.0)
109
+ mime-types (>= 1.16, < 3.0)
110
+ netrc (~> 0.7)
111
+ rspec (3.3.0)
112
+ rspec-core (~> 3.3.0)
113
+ rspec-expectations (~> 3.3.0)
114
+ rspec-mocks (~> 3.3.0)
115
+ rspec-core (3.3.1)
116
+ rspec-support (~> 3.3.0)
117
+ rspec-expectations (3.3.0)
118
+ diff-lcs (>= 1.2.0, < 2.0)
119
+ rspec-support (~> 3.3.0)
120
+ rspec-html-matchers (0.7.0)
121
+ nokogiri (~> 1)
122
+ rspec (~> 3)
123
+ rspec-mocks (3.3.1)
124
+ diff-lcs (>= 1.2.0, < 2.0)
125
+ rspec-support (~> 3.3.0)
126
+ rspec-rails (3.3.2)
127
+ actionpack (>= 3.0, < 4.3)
128
+ activesupport (>= 3.0, < 4.3)
129
+ railties (>= 3.0, < 4.3)
130
+ rspec-core (~> 3.3.0)
131
+ rspec-expectations (~> 3.3.0)
132
+ rspec-mocks (~> 3.3.0)
133
+ rspec-support (~> 3.3.0)
134
+ rspec-support (3.3.0)
135
+ simplecov (0.10.0)
136
+ docile (~> 1.1.0)
137
+ json (~> 1.8)
138
+ simplecov-html (~> 0.10.0)
139
+ simplecov-html (0.10.0)
140
+ sprockets (3.2.0)
141
+ rack (~> 1.0)
142
+ sprockets-rails (2.3.2)
143
+ actionpack (>= 3.0)
144
+ activesupport (>= 3.0)
145
+ sprockets (>= 2.8, < 4.0)
146
+ sqlite3 (1.3.10)
147
+ term-ansicolor (1.3.2)
148
+ tins (~> 1.0)
149
+ thor (0.19.1)
150
+ thread_safe (0.3.5)
151
+ tins (1.5.4)
152
+ tzinfo (1.2.2)
153
+ thread_safe (~> 0.1)
154
+ unf (0.1.4)
155
+ unf_ext
156
+ unf_ext (0.0.7.1)
157
+
158
+ PLATFORMS
159
+ ruby
160
+
161
+ DEPENDENCIES
162
+ active_record_samplooper!
163
+ bundler (~> 1.10)
164
+ coveralls
165
+ factory_girl_rails
166
+ rake (~> 10.0)
167
+ rspec
168
+ rspec-html-matchers
169
+ rspec-rails
170
+ sqlite3
171
+
172
+ BUNDLED WITH
173
+ 1.10.3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 mmmpa
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,2 @@
1
+ [![Build Status](https://travis-ci.org/mmmpa/active_record_samplooper.svg)](https://travis-ci.org/mmmpa/active_record_samplooper)
2
+ [![Coverage Status](https://coveralls.io/repos/mmmpa/yorisoi/badge.svg?branch=master)](https://coveralls.io/r/mmmpa/active_record_samplooper?branch=master)
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ task :default => :spec
4
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,31 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "active_record_samplooper/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "active_record_samplooper"
9
+ spec.version = ActiveRecordSamplooper::VERSION
10
+ spec.authors = ["mmmpa"]
11
+ spec.email = ["mmmpa.mmmpa@gmail.com"]
12
+ spec.homepage = "http://mmmpa.net"
13
+ spec.summary = "Sample a instance from ActiveRecord directory."
14
+ spec.description = "Sample a instance from ActiveRecord directory."
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split("\n")
18
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+ spec.add_dependency "rails", "~> 4.2.1"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "sqlite3"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "rspec-rails"
28
+ spec.add_development_dependency 'rspec-html-matchers'
29
+ spec.add_development_dependency "factory_girl_rails"
30
+ spec.add_development_dependency "coveralls"
31
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveRecordSamplooper
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,65 @@
1
+ module ActiveRecordSamplooper
2
+ class << self
3
+ def call(*args)
4
+ ready(*args)
5
+ end
6
+
7
+
8
+ def ready(klass)
9
+ Samplooper.new(klass)
10
+ end
11
+ end
12
+
13
+
14
+ class Samplooper
15
+ attr_accessor :klass, :id_store, :rest
16
+
17
+
18
+ def initialize(klass)
19
+ self.klass = klass
20
+ reset!
21
+ end
22
+
23
+
24
+ def sample
25
+ return if rest.blank?
26
+ klass.find(id = rest.shift)
27
+ rescue ActiveRecord::RecordNotFound => e
28
+ raise Gone, id
29
+ end
30
+
31
+
32
+ def loop
33
+ reset! if rest.blank?
34
+ sample
35
+ end
36
+
37
+
38
+ def reset!
39
+ self.id_store = klass.pluck(:id).shuffle!
40
+ self.rest = id_store.dup
41
+ end
42
+ end
43
+
44
+ class Gone < StandardError
45
+ attr_accessor :id
46
+
47
+
48
+ def initialize(id)
49
+ self.id = id
50
+ end
51
+ end
52
+ end
53
+
54
+ class ::ActiveRecord::Base
55
+ class << self
56
+ def sample
57
+ offset(rand(count)).first
58
+ end
59
+
60
+
61
+ def sampler
62
+ ActiveRecordSamplooper.(self)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :active_record_samplooper do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ class SampleModel < ActiveRecord::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "active_record_samplooper"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
30
+ end
31
+ end
32
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,41 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
41
+ end