db_replicator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +38 -0
  6. data/Rakefile +8 -0
  7. data/db_replicator.gemspec +32 -0
  8. data/lib/db_replicator/configuration.rb +12 -0
  9. data/lib/db_replicator/downloader.rb +25 -0
  10. data/lib/db_replicator/importer.rb +62 -0
  11. data/lib/db_replicator/tasks.rb +6 -0
  12. data/lib/db_replicator/version.rb +3 -0
  13. data/lib/db_replicator.rb +50 -0
  14. data/lib/generators/db_replicator/install_generator.rb +25 -0
  15. data/lib/generators/templates/db_replicator.rb +4 -0
  16. data/lib/tasks/dbr.rake +21 -0
  17. data/spec/db_replicator/configuration_spec.rb +13 -0
  18. data/spec/db_replicator_spec.rb +17 -0
  19. data/spec/generators/db_replicator/install_generator_spec.rb +33 -0
  20. data/spec/generators/tmp/.gitignore +1 -0
  21. data/spec/generators/tmp/config/initializers/db_replicator.rb +4 -0
  22. data/spec/rails_app/README.rdoc +28 -0
  23. data/spec/rails_app/Rakefile +6 -0
  24. data/spec/rails_app/app/assets/images/.keep +0 -0
  25. data/spec/rails_app/app/assets/javascripts/application.js +13 -0
  26. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  27. data/spec/rails_app/app/controllers/application_controller.rb +5 -0
  28. data/spec/rails_app/app/controllers/concerns/.keep +0 -0
  29. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  30. data/spec/rails_app/app/mailers/.keep +0 -0
  31. data/spec/rails_app/app/models/.keep +0 -0
  32. data/spec/rails_app/app/models/concerns/.keep +0 -0
  33. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  34. data/spec/rails_app/bin/bundle +3 -0
  35. data/spec/rails_app/bin/rails +4 -0
  36. data/spec/rails_app/bin/rake +4 -0
  37. data/spec/rails_app/config/application.rb +29 -0
  38. data/spec/rails_app/config/boot.rb +5 -0
  39. data/spec/rails_app/config/database.yml +25 -0
  40. data/spec/rails_app/config/environment.rb +5 -0
  41. data/spec/rails_app/config/environments/development.rb +37 -0
  42. data/spec/rails_app/config/environments/production.rb +78 -0
  43. data/spec/rails_app/config/environments/test.rb +39 -0
  44. data/spec/rails_app/config/initializers/assets.rb +8 -0
  45. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  46. data/spec/rails_app/config/initializers/cookies_serializer.rb +3 -0
  47. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  48. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  49. data/spec/rails_app/config/initializers/mime_types.rb +4 -0
  50. data/spec/rails_app/config/initializers/session_store.rb +3 -0
  51. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  52. data/spec/rails_app/config/locales/en.yml +23 -0
  53. data/spec/rails_app/config/routes.rb +56 -0
  54. data/spec/rails_app/config/secrets.yml +22 -0
  55. data/spec/rails_app/config.ru +4 -0
  56. data/spec/rails_app/lib/assets/.keep +0 -0
  57. data/spec/rails_app/log/.keep +0 -0
  58. data/spec/rails_app/public/404.html +67 -0
  59. data/spec/rails_app/public/422.html +67 -0
  60. data/spec/rails_app/public/500.html +66 -0
  61. data/spec/rails_app/public/favicon.ico +0 -0
  62. data/spec/spec_helper.rb +10 -0
  63. data/spec/tmp/.gitignore +1 -0
  64. data/spec/tmp/config/initializers/db_replicator.rb +4 -0
  65. metadata +268 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ef06bcc9e687a964998b09e63bd2bb71aeba5d6d
4
+ data.tar.gz: 1650f534c1e128d84d1d14b5da94a40f9581e18c
5
+ SHA512:
6
+ metadata.gz: 62a47ea6112545a0a5e472f103fb127d3b5b71a24c312224cdfe91c77e780dafa041cc7ca69b0fd8d95aaa12d6de501760ebe6c5084bf352351f998eb26dce15
7
+ data.tar.gz: ec28276dfcfaede3eb2ccbce292d61243e3fc111153231521f0f7059abcc4da99198858f6a14332b1009123e74be9bdc57d83049cc804d89c53460061aa37454
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in db_replicator.gemspec
4
+ gemspec
5
+ gem 'ruby-progressbar'
6
+ gem 'net-ssh'
7
+ gem 'net-scp'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Michael Eatherly
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # DbReplicator
2
+
3
+ This gem allow you to down load and import your production db to test with.
4
+
5
+ As of now I only suport MySQL. I plan to add more adapters in the future. See TODO below.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'db_replicator'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ rails g db_replicator:install
18
+
19
+ ## Usage
20
+
21
+ You can download your production db by running:
22
+
23
+ $ rake dbr:prod_to_local
24
+
25
+
26
+ ## TODO
27
+
28
+ * Allow secure upload of production db to another enviroment. e.g. staging
29
+ * Add more adapters.
30
+
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/[my-github-username]/db_replicator/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new('spec')
6
+
7
+ task :default => :spec
8
+
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'db_replicator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "db_replicator"
8
+ spec.version = DbReplicator::VERSION
9
+ spec.authors = ["Michael Eatherly"]
10
+ spec.email = ["meatherly@gmail.com"]
11
+ spec.summary = ""
12
+ spec.description = ""
13
+ spec.homepage = "https://github.com/meatherly/db_replicator"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "generator_spec"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_runtime_dependency 'sequel', '~> 4.15.0'
26
+ spec.add_runtime_dependency 'ruby-progressbar'
27
+ spec.add_runtime_dependency 'rails', '>= 4'
28
+ spec.add_runtime_dependency 'colorize'
29
+
30
+ spec.required_ruby_version = '~> 2.0'
31
+
32
+ end
@@ -0,0 +1,12 @@
1
+ require 'etc'
2
+
3
+ module DbReplicator
4
+ class Configuration
5
+ attr_accessor :proxy_host, :user
6
+
7
+ def initialize
8
+ @proxy_host = 'example.com'
9
+ @user = Etc.getlogin
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ require 'net/ssh'
2
+ require 'net/scp'
3
+ require 'ruby-progressbar'
4
+ module DbReplicator
5
+ class Downloader
6
+ def self.download_production
7
+ pp DbReplicator.prod_db_configs['database']
8
+ Net::SSH.start(DbReplicator.configuration.proxy_host, DbReplicator.configuration.user) do |session|
9
+ DbReplicator.document_action "Creating MySQL dump file.", "Create complete." do
10
+ session.exec! "mysqldump -u #{DbReplicator.prod_db_configs['user']} --password=#{DbReplicator.prod_db_configs['password']} #{DbReplicator.prod_db_configs['database']} > #{DbReplicator.dump_file_name}"
11
+ end
12
+ DbReplicator.document_action "Downloading MySQL dump file", "Download complete." do
13
+ pb = ProgressBar.create(:format => '%t %B %p%% %a')
14
+ session.scp.download!(DbReplicator.dump_file_name, DbReplicator.dumps_dir) do |ch, name, sent, total|
15
+ pb.total = total
16
+ pb.progress = sent
17
+ end
18
+ end
19
+ DbReplicator.document_action "Deleting MySQL dump file on #{DbReplicator.configuration.proxy_host}", "Delete complete." do
20
+ session.exec! "rm -f #{DbReplicator.dump_file_name}"
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,62 @@
1
+ module DbReplicator
2
+ class Importer
3
+ attr_accessor :to_db_env, :db_env
4
+ def initialize(to_db_env)
5
+ @to_db_env = to_db_env
6
+ @to_db_configs = DbReplicator.db_configs(@to_db_env)
7
+ if @to_db_configs['adapter'] == 'sqlite3'
8
+ @tmp_db_configs = create_tmp_db_configs
9
+ else
10
+ @tmp_db_configs = nil
11
+ end
12
+ end
13
+
14
+ def import_db!
15
+ DbReplicator.document_action "Executing db:drop && db:create to get a fresh database", "Fresh database created." do
16
+ create_fresh_db
17
+ end
18
+ DbReplicator.document_action "Importing mysql dump to #{@to_db_configs['database']} database", "Import complete." do
19
+ pp @tmp_db_configs
20
+ if @tmp_db_configs
21
+ DbReplicator.document_action "Transfering db to sqlite3", "Transfer complete" do
22
+ convert_sql_dump_and_import
23
+ end
24
+ else
25
+ puts "Executing: mysql -u root #{@to_db_configs['database']} < #{DbReplicator.dump_file}"
26
+ exec "mysql -u root #{@to_db_configs['database']} < #{DbReplicator.dump_file}"
27
+ end
28
+ end
29
+ DbReplicator.document_action "Executing db:migrate to update database Just in case their are pending migrations", "Migrate complete." do
30
+ system "bundle exec rake db:migrate"
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def convert_sql_dump_and_import
37
+ DbReplicator.document_action "Creating temp db for transfer #{create_tmp_db_configs['database']}", "Create complete" do
38
+ ActiveRecord::Tasks::DatabaseTasks.create(create_tmp_db_configs)
39
+ end
40
+ DbReplicator.document_action "Importing data to temp db. DB: #{create_tmp_db_configs['database']}; File: #{DbReplicator.dump_file}", "Import complete" do
41
+ puts "Executing: mysql -u root #{create_tmp_db_configs['database']} < #{DbReplicator.dump_file}"
42
+ system "mysql -u root #{create_tmp_db_configs['database']} < #{DbReplicator.dump_file}"
43
+ end
44
+ DbReplicator.document_action "Starting data transfer", "Data transfer complete." do
45
+ puts "Executing: sequel #{DbReplicator.prod_db_configs['adapter']}://localhost/#{create_tmp_db_configs['database']}?user=root -C sqlite://#{@to_db_configs['database']}"
46
+ system "sequel #{DbReplicator.prod_db_configs['adapter']}://localhost/#{create_tmp_db_configs['database']}?user=root -C sqlite://#{@to_db_configs['database']}"
47
+ end
48
+ end
49
+
50
+ def create_tmp_db_configs
51
+ tmp_configs = @to_db_configs.clone
52
+ tmp_configs['database'] = "#{DbReplicator.prod_db_configs['database']}_db_replicator"
53
+ # tmp_configs['host'] = 'localhost'
54
+ tmp_configs.reject!{|k, v| ['password', 'username'].include?(k.to_s) || v.nil? }
55
+ tmp_configs
56
+ end
57
+
58
+ def create_fresh_db
59
+ system "bundle exec rake db:drop db:create"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ # Make tasks visible for Rails also when used as gem.
4
+ Dir[File.join(File.dirname(__FILE__), '..', 'tasks', '**/*.rake')].each { |rake| load rake }
5
+ Dir[File.join(File.dirname(__FILE__), '..', '..', 'tasks', '**/*.rake')].each { |rake| load rake }
6
+
@@ -0,0 +1,3 @@
1
+ module DbReplicator
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,50 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'db_replicator/version'
3
+ require 'db_replicator/tasks'
4
+ require 'db_replicator/configuration'
5
+ require 'db_replicator/downloader'
6
+ require 'db_replicator/importer'
7
+ require 'colorize'
8
+
9
+ module DbReplicator
10
+ class << self
11
+ attr_writer :configuration
12
+
13
+
14
+ end
15
+
16
+ def self.configuration
17
+ @configuration ||= Configuration.new
18
+ end
19
+
20
+ def self.configure
21
+ yield(configuration)
22
+ end
23
+
24
+ def self.document_action(before, after, &block)
25
+ puts before.colorize(:yellow)
26
+ yield block
27
+ puts after.colorize(:green)
28
+ end
29
+
30
+ def self.db_configs(db_env=Rails.env)
31
+ ActiveRecord::Base.configurations[db_env]
32
+ end
33
+
34
+ def self.dump_file_name
35
+ ActiveRecord::Base.configurations['production']['database'] + '.sql'
36
+ end
37
+
38
+ def self.dumps_dir
39
+ File.join Rails.root, '.db_replicator_dumps'
40
+ end
41
+
42
+ def self.dump_file
43
+ File.join(dumps_dir, dump_file_name)
44
+ end
45
+
46
+ def self.prod_db_configs
47
+ @prod_configs ||= DbReplicator.db_configs('production')
48
+ end
49
+
50
+ end
@@ -0,0 +1,25 @@
1
+ module DbReplicator
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../../templates", __FILE__)
4
+ desc "Creates the base config file for DbReplicator, the .db_replicator_dumps directory, and adds .db_replicator_dumps to your .gitignore file."
5
+
6
+ def copy_initializer
7
+ puts destination_root
8
+ template "db_replicator.rb", "config/initializers/db_replicator.rb"
9
+ end
10
+
11
+ def create_dumps_dir
12
+ empty_directory ".db_replicator_dumps"
13
+ end
14
+
15
+ def add_dumps_dir_to_gitignore
16
+ if File.exists?(File.join(destination_root, '.gitignore'))
17
+ append_to_file '.gitignore' do
18
+ '.db_replicator_dumps'
19
+ end
20
+ else
21
+ create_file ".gitignore", ".db_replicator_dumps"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ DbReplicator.configure do |config|
2
+ # The proxy_host is a server that can connect to your production db.
3
+ config.proxy_host = 'www.example.com'
4
+ end
@@ -0,0 +1,21 @@
1
+ db_replicator_lib = File.expand_path(File.dirname(File.dirname(__FILE__)))
2
+ require "#{db_replicator_lib}/db_replicator"
3
+
4
+ namespace :dbr do
5
+ desc "Imports the production db into the current machines environment db"
6
+ task prod_to_local: [:environment, :download_prod_db] do
7
+ importer = DbReplicator::Importer.new('development')
8
+ importer.import_db!
9
+ puts "******* You now have production data in your current database *******"
10
+ end
11
+
12
+ desc "Download the production db dump to ~/mysql_dumps"
13
+ task download_prod_db: :environment do
14
+ DbReplicator::Downloader.download_production
15
+ end
16
+ end
17
+
18
+
19
+
20
+
21
+
@@ -0,0 +1,13 @@
1
+ require 'etc'
2
+ require 'spec_helper'
3
+
4
+ module DbReplicator
5
+ describe Configuration do
6
+ describe "#proxy_host" do
7
+ it 'default values' do
8
+ Configuration.new.proxy_host.should eq 'example.com'
9
+ Configuration.new.user.should eq Etc.getlogin
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+ describe DbReplicator do
3
+
4
+ describe "#configure" do
5
+ before do
6
+ DbReplicator.configure do |config|
7
+ config.proxy_host = 'www.example.com'
8
+ config.user = 'user'
9
+ end
10
+ end
11
+
12
+ it 'returns the custom values' do
13
+ DbReplicator.configuration.proxy_host.should == 'www.example.com'
14
+ DbReplicator.configuration.user.should == 'user'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'generator_spec/test_case'
3
+ require 'generator_spec'
4
+ require 'generators/db_replicator/install_generator'
5
+
6
+ describe DbReplicator::InstallGenerator, type: :generator do
7
+ include GeneratorSpec::TestCase
8
+ destination File.expand_path("../../tmp", __FILE__)
9
+
10
+ before do
11
+ prepare_destination
12
+ run_generator
13
+ end
14
+
15
+ it 'should have created the initializer with the correct contents' do
16
+ assert_file "config/initializers/db_replicator.rb"
17
+ end
18
+
19
+ it 'should create the SQL dumps directory' do
20
+ destination_root.should have_structure {
21
+ directory ".db_replicator_dumps"
22
+ }
23
+ end
24
+
25
+ it 'should add .db_replicator_dumps to the .gitignore file' do
26
+ destination_root.should have_structure {
27
+ file ".gitignore" do
28
+ ".db_replicator_dumps"
29
+ end
30
+ }
31
+ end
32
+
33
+ end
@@ -0,0 +1 @@
1
+ .db_replicator_dumps
@@ -0,0 +1,4 @@
1
+ DbReplicator.configure do |config|
2
+ # The proxy_host is a server that can connect to your production db.
3
+ config.proxy_host = 'www.example.com'
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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/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 vendor/assets/stylesheets of plugins, if any, 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,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
+ 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 "rails_app"
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
+ end
28
+ end
29
+
@@ -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!