rabl 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -1
- data/Rakefile +2 -2
- data/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl +1 -0
- data/fixtures/padrino_test/app/views +1 -0
- data/fixtures/padrino_test/db/migrate +1 -0
- data/fixtures/padrino_test/models +1 -0
- data/fixtures/padrino_test/test/app/controllers/posts_controller_test.rb +1 -0
- data/fixtures/padrino_test/test/app/controllers/users_controller_test.rb +1 -0
- data/fixtures/rails2/app/models +1 -0
- data/fixtures/rails2/app/views +1 -0
- data/fixtures/rails2/db/migrate +1 -0
- data/fixtures/rails2/test/functionals/posts_controller_test.rb +1 -0
- data/fixtures/rails2/test/functionals/users_controller_test.rb +1 -0
- data/fixtures/rails3/app/models +1 -0
- data/fixtures/rails3/app/views +1 -0
- data/fixtures/rails3/db/migrate +1 -0
- data/fixtures/rails3/test/functional/posts_controller_test.rb +1 -0
- data/fixtures/rails3/test/functional/users_controller_test.rb +1 -0
- data/fixtures/rails3_2/app/models +1 -0
- data/fixtures/rails3_2/app/views +1 -0
- data/fixtures/rails3_2/db/migrate +1 -0
- data/fixtures/rails3_2/test/functional/posts_controller_test.rb +1 -0
- data/fixtures/rails3_2/test/functional/users_controller_test.rb +1 -0
- data/fixtures/rails4/app/models +1 -0
- data/fixtures/rails4/app/views +1 -0
- data/fixtures/rails4/db/migrate +1 -0
- data/fixtures/rails4/test/functional/posts_controller_test.rb +1 -0
- data/fixtures/rails4/test/functional/users_controller_test.rb +1 -0
- data/fixtures/rails5/.gitignore +21 -0
- data/fixtures/rails5/Gemfile +52 -0
- data/fixtures/rails5/README.md +24 -0
- data/fixtures/rails5/Rakefile +13 -0
- data/fixtures/rails5/app/assets/config/manifest.js +3 -0
- data/fixtures/rails5/app/assets/images/.keep +0 -0
- data/fixtures/rails5/app/assets/javascripts/application.js +16 -0
- data/fixtures/rails5/app/assets/javascripts/cable.js +13 -0
- data/fixtures/rails5/app/assets/javascripts/channels/.keep +0 -0
- data/fixtures/rails5/app/assets/stylesheets/application.css +15 -0
- data/fixtures/rails5/app/channels/application_cable/channel.rb +4 -0
- data/fixtures/rails5/app/channels/application_cable/connection.rb +4 -0
- data/fixtures/rails5/app/controllers/application_controller.rb +3 -0
- data/fixtures/rails5/app/controllers/concerns/.keep +0 -0
- data/fixtures/rails5/app/controllers/posts_controller.rb +17 -0
- data/fixtures/rails5/app/controllers/users_controller.rb +11 -0
- data/fixtures/rails5/app/helpers/application_helper.rb +5 -0
- data/fixtures/rails5/app/jobs/application_job.rb +2 -0
- data/fixtures/rails5/app/mailers/application_mailer.rb +4 -0
- data/fixtures/rails5/app/models +1 -0
- data/fixtures/rails5/app/views +1 -0
- data/fixtures/rails5/bin/bundle +3 -0
- data/fixtures/rails5/bin/rails +9 -0
- data/fixtures/rails5/bin/rake +9 -0
- data/fixtures/rails5/bin/setup +34 -0
- data/fixtures/rails5/bin/spring +15 -0
- data/fixtures/rails5/bin/update +29 -0
- data/fixtures/rails5/config.ru +5 -0
- data/fixtures/rails5/config/application.rb +15 -0
- data/fixtures/rails5/config/boot.rb +3 -0
- data/fixtures/rails5/config/cable.yml +9 -0
- data/fixtures/rails5/config/database.yml +25 -0
- data/fixtures/rails5/config/environment.rb +5 -0
- data/fixtures/rails5/config/environments/development.rb +54 -0
- data/fixtures/rails5/config/environments/production.rb +86 -0
- data/fixtures/rails5/config/environments/test.rb +42 -0
- data/fixtures/rails5/config/initializers/application_controller_renderer.rb +6 -0
- data/fixtures/rails5/config/initializers/assets.rb +11 -0
- data/fixtures/rails5/config/initializers/backtrace_silencers.rb +7 -0
- data/fixtures/rails5/config/initializers/cookies_serializer.rb +5 -0
- data/fixtures/rails5/config/initializers/filter_parameter_logging.rb +4 -0
- data/fixtures/rails5/config/initializers/inflections.rb +16 -0
- data/fixtures/rails5/config/initializers/mime_types.rb +4 -0
- data/fixtures/rails5/config/initializers/new_framework_defaults.rb +24 -0
- data/fixtures/rails5/config/initializers/session_store.rb +3 -0
- data/fixtures/rails5/config/initializers/wrap_parameters.rb +14 -0
- data/fixtures/rails5/config/locales/en.yml +23 -0
- data/fixtures/rails5/config/puma.rb +47 -0
- data/fixtures/rails5/config/routes.rb +8 -0
- data/fixtures/rails5/config/secrets.yml +22 -0
- data/fixtures/rails5/config/spring.rb +6 -0
- data/fixtures/rails5/db/migrate +1 -0
- data/fixtures/rails5/db/schema.rb +41 -0
- data/fixtures/rails5/db/seeds.rb +7 -0
- data/fixtures/rails5/lib/assets/.keep +0 -0
- data/fixtures/rails5/lib/tasks/.keep +0 -0
- data/fixtures/rails5/log/.keep +0 -0
- data/fixtures/rails5/public/404.html +67 -0
- data/fixtures/rails5/public/422.html +67 -0
- data/fixtures/rails5/public/500.html +66 -0
- data/fixtures/rails5/public/apple-touch-icon-precomposed.png +0 -0
- data/fixtures/rails5/public/apple-touch-icon.png +0 -0
- data/fixtures/rails5/public/favicon.ico +0 -0
- data/fixtures/rails5/public/robots.txt +5 -0
- data/fixtures/rails5/test/controllers/.keep +0 -0
- data/fixtures/rails5/test/fixtures/.keep +0 -0
- data/fixtures/rails5/test/fixtures/files/.keep +0 -0
- data/fixtures/rails5/test/helpers/.keep +0 -0
- data/fixtures/rails5/test/integration/.keep +0 -0
- data/fixtures/rails5/test/mailers/.keep +0 -0
- data/fixtures/rails5/test/models/.keep +0 -0
- data/fixtures/rails5/test/test_helper.rb +26 -0
- data/fixtures/rails5/tmp/.keep +0 -0
- data/fixtures/rails5/vendor/assets/javascripts/.keep +0 -0
- data/fixtures/rails5/vendor/assets/stylesheets/.keep +0 -0
- data/fixtures/sinatra_test/db/migrate +1 -0
- data/fixtures/sinatra_test/models +1 -0
- data/fixtures/sinatra_test/test/functional/posts_controller_test.rb +1 -0
- data/fixtures/sinatra_test/test/functional/users_controller_test.rb +1 -0
- data/fixtures/sinatra_test/views +1 -0
- data/lib/rabl.rb +1 -1
- data/lib/rabl/configuration.rb +1 -1
- data/lib/rabl/digestor.rb +3 -37
- data/lib/rabl/digestor/rails3.rb +10 -0
- data/lib/rabl/digestor/rails41.rb +10 -0
- data/lib/rabl/digestor/rails5.rb +4 -0
- data/lib/rabl/engine.rb +1 -1
- data/lib/rabl/version.rb +1 -1
- metadata +99 -3
- data/fixtures/ashared/views_rails_3/users/phone_number.xml.rabl +0 -8
- data/fixtures/padrino_test/test/app/controllers/posts_controller_test.rb +0 -108
- data/fixtures/padrino_test/test/app/controllers/users_controller_test.rb +0 -87
- data/fixtures/rails2/test/functionals/posts_controller_test.rb +0 -108
- data/fixtures/rails2/test/functionals/users_controller_test.rb +0 -87
- data/fixtures/rails3/test/functional/posts_controller_test.rb +0 -108
- data/fixtures/rails3/test/functional/users_controller_test.rb +0 -87
- data/fixtures/rails3_2/test/functional/posts_controller_test.rb +0 -263
- data/fixtures/rails3_2/test/functional/users_controller_test.rb +0 -87
- data/fixtures/rails4/test/functional/posts_controller_test.rb +0 -248
- data/fixtures/rails4/test/functional/users_controller_test.rb +0 -87
- data/fixtures/sinatra_test/test/functional/posts_controller_test.rb +0 -108
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69b64e79c938fa56b79fa08d95a97f92c4f1fff8
|
4
|
+
data.tar.gz: 92afd63714dd8aae58385ed097682baab04c81ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7721e7744da0a52bd67aea61d060a1db815cb926b9f4b7e019519ad581ba35ab1a0af5eefe4dfe9fc9cc22fff3e24c3479f2e54a66810180047ca6d93c993363
|
7
|
+
data.tar.gz: 95df50736a71777c09a731eb9cc3e9752a7282e3a22bf93ebd1da7c1a024fd1d6771351e2d84b8097bef872580c43d6556a37d4c0a75c891f730bed46e45cc3d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
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
|
File without changes
|
@@ -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);
|
File without changes
|
@@ -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
|
+
*/
|
File without changes
|
@@ -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 @@
|
|
1
|
+
fixtures/rails5/app/../../ashared/models
|
@@ -0,0 +1 @@
|
|
1
|
+
fixtures/rails5/app/../../ashared/views_rails_3/
|
@@ -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,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
|