rabl 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +2 -1
  5. data/Rakefile +2 -2
  6. data/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl +1 -0
  7. data/fixtures/padrino_test/app/views +1 -0
  8. data/fixtures/padrino_test/db/migrate +1 -0
  9. data/fixtures/padrino_test/models +1 -0
  10. data/fixtures/padrino_test/test/app/controllers/posts_controller_test.rb +1 -0
  11. data/fixtures/padrino_test/test/app/controllers/users_controller_test.rb +1 -0
  12. data/fixtures/rails2/app/models +1 -0
  13. data/fixtures/rails2/app/views +1 -0
  14. data/fixtures/rails2/db/migrate +1 -0
  15. data/fixtures/rails2/test/functionals/posts_controller_test.rb +1 -0
  16. data/fixtures/rails2/test/functionals/users_controller_test.rb +1 -0
  17. data/fixtures/rails3/app/models +1 -0
  18. data/fixtures/rails3/app/views +1 -0
  19. data/fixtures/rails3/db/migrate +1 -0
  20. data/fixtures/rails3/test/functional/posts_controller_test.rb +1 -0
  21. data/fixtures/rails3/test/functional/users_controller_test.rb +1 -0
  22. data/fixtures/rails3_2/app/models +1 -0
  23. data/fixtures/rails3_2/app/views +1 -0
  24. data/fixtures/rails3_2/db/migrate +1 -0
  25. data/fixtures/rails3_2/test/functional/posts_controller_test.rb +1 -0
  26. data/fixtures/rails3_2/test/functional/users_controller_test.rb +1 -0
  27. data/fixtures/rails4/app/models +1 -0
  28. data/fixtures/rails4/app/views +1 -0
  29. data/fixtures/rails4/db/migrate +1 -0
  30. data/fixtures/rails4/test/functional/posts_controller_test.rb +1 -0
  31. data/fixtures/rails4/test/functional/users_controller_test.rb +1 -0
  32. data/fixtures/rails5/.gitignore +21 -0
  33. data/fixtures/rails5/Gemfile +52 -0
  34. data/fixtures/rails5/README.md +24 -0
  35. data/fixtures/rails5/Rakefile +13 -0
  36. data/fixtures/rails5/app/assets/config/manifest.js +3 -0
  37. data/fixtures/rails5/app/assets/images/.keep +0 -0
  38. data/fixtures/rails5/app/assets/javascripts/application.js +16 -0
  39. data/fixtures/rails5/app/assets/javascripts/cable.js +13 -0
  40. data/fixtures/rails5/app/assets/javascripts/channels/.keep +0 -0
  41. data/fixtures/rails5/app/assets/stylesheets/application.css +15 -0
  42. data/fixtures/rails5/app/channels/application_cable/channel.rb +4 -0
  43. data/fixtures/rails5/app/channels/application_cable/connection.rb +4 -0
  44. data/fixtures/rails5/app/controllers/application_controller.rb +3 -0
  45. data/fixtures/rails5/app/controllers/concerns/.keep +0 -0
  46. data/fixtures/rails5/app/controllers/posts_controller.rb +17 -0
  47. data/fixtures/rails5/app/controllers/users_controller.rb +11 -0
  48. data/fixtures/rails5/app/helpers/application_helper.rb +5 -0
  49. data/fixtures/rails5/app/jobs/application_job.rb +2 -0
  50. data/fixtures/rails5/app/mailers/application_mailer.rb +4 -0
  51. data/fixtures/rails5/app/models +1 -0
  52. data/fixtures/rails5/app/views +1 -0
  53. data/fixtures/rails5/bin/bundle +3 -0
  54. data/fixtures/rails5/bin/rails +9 -0
  55. data/fixtures/rails5/bin/rake +9 -0
  56. data/fixtures/rails5/bin/setup +34 -0
  57. data/fixtures/rails5/bin/spring +15 -0
  58. data/fixtures/rails5/bin/update +29 -0
  59. data/fixtures/rails5/config.ru +5 -0
  60. data/fixtures/rails5/config/application.rb +15 -0
  61. data/fixtures/rails5/config/boot.rb +3 -0
  62. data/fixtures/rails5/config/cable.yml +9 -0
  63. data/fixtures/rails5/config/database.yml +25 -0
  64. data/fixtures/rails5/config/environment.rb +5 -0
  65. data/fixtures/rails5/config/environments/development.rb +54 -0
  66. data/fixtures/rails5/config/environments/production.rb +86 -0
  67. data/fixtures/rails5/config/environments/test.rb +42 -0
  68. data/fixtures/rails5/config/initializers/application_controller_renderer.rb +6 -0
  69. data/fixtures/rails5/config/initializers/assets.rb +11 -0
  70. data/fixtures/rails5/config/initializers/backtrace_silencers.rb +7 -0
  71. data/fixtures/rails5/config/initializers/cookies_serializer.rb +5 -0
  72. data/fixtures/rails5/config/initializers/filter_parameter_logging.rb +4 -0
  73. data/fixtures/rails5/config/initializers/inflections.rb +16 -0
  74. data/fixtures/rails5/config/initializers/mime_types.rb +4 -0
  75. data/fixtures/rails5/config/initializers/new_framework_defaults.rb +24 -0
  76. data/fixtures/rails5/config/initializers/session_store.rb +3 -0
  77. data/fixtures/rails5/config/initializers/wrap_parameters.rb +14 -0
  78. data/fixtures/rails5/config/locales/en.yml +23 -0
  79. data/fixtures/rails5/config/puma.rb +47 -0
  80. data/fixtures/rails5/config/routes.rb +8 -0
  81. data/fixtures/rails5/config/secrets.yml +22 -0
  82. data/fixtures/rails5/config/spring.rb +6 -0
  83. data/fixtures/rails5/db/migrate +1 -0
  84. data/fixtures/rails5/db/schema.rb +41 -0
  85. data/fixtures/rails5/db/seeds.rb +7 -0
  86. data/fixtures/rails5/lib/assets/.keep +0 -0
  87. data/fixtures/rails5/lib/tasks/.keep +0 -0
  88. data/fixtures/rails5/log/.keep +0 -0
  89. data/fixtures/rails5/public/404.html +67 -0
  90. data/fixtures/rails5/public/422.html +67 -0
  91. data/fixtures/rails5/public/500.html +66 -0
  92. data/fixtures/rails5/public/apple-touch-icon-precomposed.png +0 -0
  93. data/fixtures/rails5/public/apple-touch-icon.png +0 -0
  94. data/fixtures/rails5/public/favicon.ico +0 -0
  95. data/fixtures/rails5/public/robots.txt +5 -0
  96. data/fixtures/rails5/test/controllers/.keep +0 -0
  97. data/fixtures/rails5/test/fixtures/.keep +0 -0
  98. data/fixtures/rails5/test/fixtures/files/.keep +0 -0
  99. data/fixtures/rails5/test/helpers/.keep +0 -0
  100. data/fixtures/rails5/test/integration/.keep +0 -0
  101. data/fixtures/rails5/test/mailers/.keep +0 -0
  102. data/fixtures/rails5/test/models/.keep +0 -0
  103. data/fixtures/rails5/test/test_helper.rb +26 -0
  104. data/fixtures/rails5/tmp/.keep +0 -0
  105. data/fixtures/rails5/vendor/assets/javascripts/.keep +0 -0
  106. data/fixtures/rails5/vendor/assets/stylesheets/.keep +0 -0
  107. data/fixtures/sinatra_test/db/migrate +1 -0
  108. data/fixtures/sinatra_test/models +1 -0
  109. data/fixtures/sinatra_test/test/functional/posts_controller_test.rb +1 -0
  110. data/fixtures/sinatra_test/test/functional/users_controller_test.rb +1 -0
  111. data/fixtures/sinatra_test/views +1 -0
  112. data/lib/rabl.rb +1 -1
  113. data/lib/rabl/configuration.rb +1 -1
  114. data/lib/rabl/digestor.rb +3 -37
  115. data/lib/rabl/digestor/rails3.rb +10 -0
  116. data/lib/rabl/digestor/rails41.rb +10 -0
  117. data/lib/rabl/digestor/rails5.rb +4 -0
  118. data/lib/rabl/engine.rb +1 -1
  119. data/lib/rabl/version.rb +1 -1
  120. metadata +99 -3
  121. data/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl +0 -8
  122. data/fixtures/padrino_test/test/app/controllers/posts_controller_test.rb +0 -108
  123. data/fixtures/padrino_test/test/app/controllers/users_controller_test.rb +0 -87
  124. data/fixtures/rails2/test/functionals/posts_controller_test.rb +0 -108
  125. data/fixtures/rails2/test/functionals/users_controller_test.rb +0 -87
  126. data/fixtures/rails3/test/functional/posts_controller_test.rb +0 -108
  127. data/fixtures/rails3/test/functional/users_controller_test.rb +0 -87
  128. data/fixtures/rails3_2/test/functional/posts_controller_test.rb +0 -263
  129. data/fixtures/rails3_2/test/functional/users_controller_test.rb +0 -87
  130. data/fixtures/rails4/test/functional/posts_controller_test.rb +0 -248
  131. data/fixtures/rails4/test/functional/users_controller_test.rb +0 -87
  132. data/fixtures/sinatra_test/test/functional/posts_controller_test.rb +0 -108
  133. data/fixtures/sinatra_test/test/functional/users_controller_test.rb +0 -87
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9181c1a232aab327e58bd686eb3cf14403e6aac9
4
- data.tar.gz: 3e2f0d536f6752cb575e5843709be0b40f8bd09a
3
+ metadata.gz: 69b64e79c938fa56b79fa08d95a97f92c4f1fff8
4
+ data.tar.gz: 92afd63714dd8aae58385ed097682baab04c81ab
5
5
  SHA512:
6
- metadata.gz: 8ea05c8211d750c882c4b0fa6e29a20b56e4ebfcff23e12a2af18e0f50302b191be374a76eace11ed46a787ae702cb7ff5eb7ef659a6d7096db2823451c5b6d1
7
- data.tar.gz: c8634ea3cfbbc11e131b484e598326888c81f15f2a304caf06ec786f8a3ab5d72cfb77f88fc47b4fd34d1dc595c3468ef5c460d44effc949c352dd6ca23d7398
6
+ metadata.gz: 7721e7744da0a52bd67aea61d060a1db815cb926b9f4b7e019519ad581ba35ab1a0af5eefe4dfe9fc9cc22fff3e24c3479f2e54a66810180047ca6d93c993363
7
+ data.tar.gz: 95df50736a71777c09a731eb9cc3e9752a7282e3a22bf93ebd1da7c1a024fd1d6771351e2d84b8097bef872580c43d6556a37d4c0a75c891f730bed46e45cc3d
@@ -5,7 +5,7 @@ rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
7
  - 2.1
8
- - 2.2
8
+ - 2.2.5
9
9
  - 2.3.1
10
10
  notifications:
11
11
  recipients:
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.13.1 (October 21st, 2016)
4
+
5
+ * Further compatibility with Rails 5
6
+
3
7
  ## 0.13.0 (July 15th, 2016)
4
8
 
5
9
  * Compatibility with Rails 5
data/Gemfile CHANGED
@@ -14,9 +14,10 @@ group :test do
14
14
  # RABL TEST
15
15
  gem 'builder'
16
16
 
17
+ rails_version = RUBY_VERSION =~ /\A(1|2.[01])/ ? '~> 4.0' : '>= 4.0'
17
18
  # FIXTURES
18
19
  gem 'rack-test', :require => 'rack/test'
19
- gem 'activerecord', :require => 'active_record'
20
+ gem 'activerecord', rails_version, :require => 'active_record'
20
21
  gem 'sqlite3'
21
22
  gem 'sinatra', '>= 1.2.0'
22
23
  gem 'hashie'
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ end
17
17
  # rake test:setup
18
18
  # rake test:full
19
19
 
20
- fixture_list = "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4}"
20
+ fixture_list = "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4,rails5}"
21
21
 
22
22
  desc "Clean up the fixtures being tested by cleaning and installing dependencies"
23
23
  task "test:clean" do
@@ -51,4 +51,4 @@ end
51
51
  task "test:full" => [:test, "test:fixtures"]
52
52
 
53
53
  desc "Run tests for rabl"
54
- task :default => :test
54
+ task :default => :test
@@ -0,0 +1 @@
1
+ fixtures/ashared/views_rails_3/users/phone_number.json.rabl
@@ -0,0 +1 @@
1
+ fixtures/padrino_test/app/../../ashared/views/
@@ -0,0 +1 @@
1
+ fixtures/padrino_test/db/../../ashared/migrate
@@ -0,0 +1 @@
1
+ fixtures/padrino_test/../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/padrino_test/test/app/controllers/../../../../../test/integration/posts_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/padrino_test/test/app/controllers/../../../../../test/integration/users_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails2/app/../../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/rails2/app/../../ashared/views/
@@ -0,0 +1 @@
1
+ fixtures/rails2/db/../../ashared/migrate
@@ -0,0 +1 @@
1
+ fixtures/rails2/test/functionals/../../../../test/integration/posts_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails2/test/functionals/../../../../test/integration/users_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails3/app/../../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/rails3/app/../../ashared/views/
@@ -0,0 +1 @@
1
+ fixtures/rails3/db/../../ashared/migrate
@@ -0,0 +1 @@
1
+ fixtures/rails3/test/functional/../../../../test/integration/posts_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails3/test/functional/../../../../test/integration/users_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails3_2/app/../../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/rails3_2/app/../../ashared/views_rails_3/
@@ -0,0 +1 @@
1
+ fixtures/rails3_2/db/../../ashared/migrate
@@ -0,0 +1 @@
1
+ fixtures/rails3_2/test/functional/../../../../test/integration/rails3_2/posts_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails3_2/test/functional/../../../../test/integration/rails3_2/users_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails4/app/../../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/rails4/app/../../ashared/views_rails_3
@@ -0,0 +1 @@
1
+ fixtures/rails4/db/../../ashared/migrate
@@ -0,0 +1 @@
1
+ fixtures/rails4/test/functional/../../../../test/integration/rails4/posts_controller_test.rb
@@ -0,0 +1 @@
1
+ fixtures/rails4/test/functional/../../../../test/integration/rails4/users_controller_test.rb
@@ -0,0 +1,21 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore Byebug command history file.
21
+ .byebug_history
@@ -0,0 +1,52 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '~> 5.0.0'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+ # Use Puma as the app server
9
+ gem 'puma', '~> 3.0'
10
+ # Use SCSS for stylesheets
11
+ gem 'sass-rails', '~> 5.0'
12
+ # Use Uglifier as compressor for JavaScript assets
13
+ gem 'uglifier', '>= 1.3.0'
14
+ # Use CoffeeScript for .coffee assets and views
15
+ gem 'coffee-rails', '~> 4.2'
16
+ # See https://github.com/rails/execjs#readme for more supported runtimes
17
+ # gem 'therubyracer', platforms: :ruby
18
+
19
+ # Use jquery as the JavaScript library
20
+ gem 'jquery-rails'
21
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22
+ gem 'turbolinks', '~> 5'
23
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24
+ gem 'jbuilder', '~> 2.5'
25
+ # Use Redis adapter to run Action Cable in production
26
+ # gem 'redis', '~> 3.0'
27
+ # Use ActiveModel has_secure_password
28
+ # gem 'bcrypt', '~> 3.1.7'
29
+
30
+ # Use Capistrano for deployment
31
+ # gem 'capistrano-rails', group: :development
32
+
33
+ group :development, :test do
34
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
35
+ gem 'byebug', platform: :mri
36
+ end
37
+
38
+ group :development do
39
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
40
+ gem 'web-console'
41
+ gem 'listen', '~> 3.0.5'
42
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
43
+ gem 'spring'
44
+ gem 'spring-watcher-listen', '~> 2.0.0'
45
+ end
46
+
47
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
48
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
49
+
50
+ gem 'rabl', :path => File.expand_path(File.dirname(__FILE__) + "/../../")
51
+ gem 'riot', :group => "test"
52
+ gem 'responders', '~> 2.0'
@@ -0,0 +1,24 @@
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
+ * ...
@@ -0,0 +1,13 @@
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_relative 'config/application'
5
+ require 'rake/testtask'
6
+
7
+ Rails.application.load_tasks
8
+
9
+ Rake::TestTask.new("test:rabl") do |test|
10
+ test.pattern = "test/controllers/**/*_test.rb"
11
+ test.verbose = true
12
+ test.warning = false
13
+ end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,16 @@
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. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -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 other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,17 @@
1
+ class PostsController < ApplicationController
2
+
3
+ respond_to :json, :xml, :html, :rabl_test_v1
4
+
5
+ def index
6
+ @posts = Post.order('id ASC').load
7
+ end
8
+
9
+ def show
10
+ @post = Post.find(params[:id])
11
+ end
12
+
13
+ def renderer
14
+ post = Post.find(params[:id])
15
+ render json: Rabl.render(post, 'posts/renderer', view_path: 'app/views', format: :json, scope: view_context)
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ class UsersController < ApplicationController
2
+ respond_to :json
3
+
4
+ def index
5
+ @users = User.order('username ASC').load
6
+ end
7
+
8
+ def show
9
+ @user = User.find(params[:id])
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module ApplicationHelper
2
+ def helper_foo
3
+ "BAR!"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1 @@
1
+ fixtures/rails5/app/../../ashared/models
@@ -0,0 +1 @@
1
+ fixtures/rails5/app/../../ashared/views_rails_3/
@@ -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,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ APP_PATH = File.expand_path('../config/application', __dir__)
8
+ require_relative '../config/boot'
9
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ require_relative '../config/boot'
8
+ require 'rake'
9
+ Rake.application.run
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end