Merge branch 'rails51'

This commit is contained in:
yafeilee 2017-04-30 19:48:40 +08:00
commit c36f7e5477
25 changed files with 378 additions and 276 deletions

View File

@ -2,9 +2,9 @@ source 'https://rubygems.org'
ruby '2.3.1' ruby '2.3.1'
gem 'rails', '>= 5.0.0', '< 5.1' gem 'rails', '>= 5.1.0', '< 5.2'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0' gem 'coffee-rails'
gem 'uglifier', '>= 2.7.2' gem 'uglifier', '>= 2.7.2'
gem 'jquery-rails' gem 'jquery-rails'
@ -24,7 +24,7 @@ gem 'pg'
gem 'redcarpet' gem 'redcarpet'
gem 'rouge' gem 'rouge'
gem 'slim-rails' gem 'slim-rails'
gem 'simple_form' gem 'simple_form', github: 'christiannelson/simple_form', branch: 'rails-5.1'
gem 'mini_magick' gem 'mini_magick'
gem 'html_truncator' gem 'html_truncator'
gem 'nokogiri' gem 'nokogiri'

View File

@ -1,117 +1,134 @@
GIT GIT
remote: git://github.com/amatsuda/kaminari.git remote: git://github.com/amatsuda/kaminari.git
revision: be3a2c9a2182fae145e7ff88223feb4d55ed539d revision: 6b47d6db2f0738548ee4745ee6aa2ef8a516a3e3
specs: specs:
kaminari (1.0.0.alpha) kaminari (1.0.1)
actionpack (>= 3.0.0) activesupport (>= 4.1.0)
activesupport (>= 3.0.0) kaminari-actionview (= 1.0.1)
kaminari-activerecord (= 1.0.1)
kaminari-core (= 1.0.1)
kaminari-actionview (1.0.1)
actionview
kaminari-core (= 1.0.1)
kaminari-activerecord (1.0.1)
activerecord
kaminari-core (= 1.0.1)
kaminari-core (1.0.1)
GIT
remote: git://github.com/christiannelson/simple_form.git
revision: 87d8e0da7273714e002de685ef202ebaaa627e98
branch: rails-5.1
specs:
simple_form (3.4.0)
actionpack (> 4, < 5.2)
activemodel (> 4, < 5.2)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.0.0) actioncable (5.1.0)
actionpack (= 5.0.0) actionpack (= 5.1.0)
nio4r (~> 1.2) nio4r (~> 2.0)
websocket-driver (~> 0.6.1) websocket-driver (~> 0.6.1)
actionmailer (5.0.0) actionmailer (5.1.0)
actionpack (= 5.0.0) actionpack (= 5.1.0)
actionview (= 5.0.0) actionview (= 5.1.0)
activejob (= 5.0.0) activejob (= 5.1.0)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.0.0) actionpack (5.1.0)
actionview (= 5.0.0) actionview (= 5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
rack (~> 2.0) rack (~> 2.0)
rack-test (~> 0.6.3) rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0) actionview (5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.0) activejob (5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.0.0) activemodel (5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
activerecord (5.0.0) activerecord (5.1.0)
activemodel (= 5.0.0) activemodel (= 5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
arel (~> 7.0) arel (~> 8.0)
activesupport (5.0.0) activesupport (5.1.0)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (~> 0.7)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.4.0) addressable (2.5.1)
arel (7.1.1) public_suffix (~> 2.0, >= 2.0.2)
arel (8.0.0)
babel-source (5.8.35) babel-source (5.8.35)
babel-transpiler (0.7.0) babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6) babel-source (>= 4.0, < 6)
execjs (~> 2.0) execjs (~> 2.0)
browser (2.2.0) browser (2.3.0)
browser_warrior (0.5.0) browser_warrior (0.5.0)
browser browser
rails (~> 5.0) rails (~> 5.0)
sass-rails (~> 5.0) sass-rails (~> 5.0)
builder (3.2.2) builder (3.2.3)
byebug (9.0.5) byebug (9.0.6)
capybara (2.7.1) capybara (2.13.0)
addressable addressable
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
carrierwave (0.11.2) carrierwave (1.1.0)
activemodel (>= 3.2.0) activemodel (>= 4.0.0)
activesupport (>= 3.2.0) activesupport (>= 4.0.0)
json (>= 1.7)
mime-types (>= 1.16) mime-types (>= 1.16)
mimemagic (>= 0.3.0) codeclimate-test-reporter (1.0.8)
codeclimate-test-reporter (0.6.0) simplecov (<= 0.13)
simplecov (>= 0.7.1, < 1.0.0)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.1.1) coffee-rails (4.2.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x) railties (>= 4.0.0, < 5.2.x)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.12.2)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.5)
connection_pool (2.2.0) connection_pool (2.2.1)
database_cleaner (1.5.3) database_cleaner (1.5.3)
diff-lcs (1.2.5) diff-lcs (1.3)
docile (1.1.5) docile (1.1.5)
domain_name (0.5.20160615) domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0) erubi (1.6.0)
execjs (2.7.0) execjs (2.7.0)
factory_girl (4.7.0) factory_girl (4.8.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.7.0) factory_girl_rails (4.8.0)
factory_girl (~> 4.7.0) factory_girl (~> 4.8.0)
railties (>= 3.0.0) railties (>= 3.0.0)
ffi (1.9.14) ffi (1.9.18)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
font-awesome-sass (4.6.2) font-awesome-sass (4.7.0)
sass (>= 3.2) sass (>= 3.2)
formatador (0.2.5) formatador (0.2.5)
foundation-icons-sass-rails (3.0.0) foundation-icons-sass-rails (3.0.0)
railties (>= 3.1.1) railties (>= 3.1.1)
sass-rails (>= 3.1.1) sass-rails (>= 3.1.1)
foundation-rails (6.2.3.0) foundation-rails (6.2.4.0)
railties (>= 3.1.0) railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5) sass (>= 3.3.0, < 3.5)
sprockets-es6 (>= 0.9.0) sprockets-es6 (>= 0.9.0)
globalid (0.3.7) globalid (0.4.0)
activesupport (>= 4.1.0) activesupport (>= 4.2.0)
guard (2.14.0) guard (2.14.1)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
lumberjack (~> 1.0) lumberjack (~> 1.0)
@ -134,119 +151,119 @@ GEM
rspec (>= 2.99.0, < 4.0) rspec (>= 2.99.0, < 4.0)
html_truncator (0.4.1) html_truncator (0.4.1)
nokogiri (~> 1.5) nokogiri (~> 1.5)
http-cookie (1.0.2) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (0.7.0) i18n (0.8.1)
jbuilder (2.6.0) jbuilder (2.6.3)
activesupport (>= 3.0.0, < 5.1) activesupport (>= 3.0.0, < 5.2)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (4.1.1) jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
js_cookie_rails (2.1.2) js_cookie_rails (2.1.4)
railties (>= 3.1) railties (>= 3.1)
json (2.0.2) json (2.1.0)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loofah (2.0.3) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.10) lumberjack (1.0.11)
mail (2.6.4) mail (2.6.5)
mime-types (>= 1.16, < 4) mime-types (>= 1.16, < 4)
method_source (0.8.2) method_source (0.8.2)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mimemagic (0.3.2) mina (1.0.6)
mina (0.3.8)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mina-logs (0.1.0) mina-logs (1.0.1)
mina mina (>= 1.0.2)
mina-multistage (1.0.2) mina-multistage (1.0.3)
mina (>= 0.2.1) mina (~> 1.0)
mina-puma (0.3.1) mina-puma (1.0.1)
mina mina (~> 1.0.0)
puma (>= 2.13) puma (>= 2.13)
mina-sidekiq (0.4.1) mina-sidekiq (1.0.1)
mina mina (>= 1.0.2)
mini_magick (4.5.1) mini_magick (4.7.0)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
minitest (5.9.0) minitest (5.10.1)
multi_json (1.12.1) multi_json (1.12.1)
nenv (0.3.0) nenv (0.3.0)
netrc (0.11.0) netrc (0.11.0)
newrelic_rpm (3.16.0.318) newrelic_rpm (4.1.0.333)
nio4r (1.2.1) nio4r (2.0.0)
nokogiri (1.6.8) nokogiri (1.7.1)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
open4 (1.3.4) open4 (1.3.4)
pg (0.18.4) pg (0.20.0)
pkg-config (1.1.7)
pry (0.10.4) pry (0.10.4)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
puma (3.6.0) public_suffix (2.0.5)
puma (3.8.2)
rack (2.0.1) rack (2.0.1)
rack-cors (0.4.0) rack-cors (0.4.1)
rack-protection (1.5.3)
rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (5.0.0) rails (5.1.0)
actioncable (= 5.0.0) actioncable (= 5.1.0)
actionmailer (= 5.0.0) actionmailer (= 5.1.0)
actionpack (= 5.0.0) actionpack (= 5.1.0)
actionview (= 5.0.0) actionview (= 5.1.0)
activejob (= 5.0.0) activejob (= 5.1.0)
activemodel (= 5.0.0) activemodel (= 5.1.0)
activerecord (= 5.0.0) activerecord (= 5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0) railties (= 5.1.0)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (0.1.1) rails-controller-testing (1.0.1)
actionpack (~> 5.x) actionpack (~> 5.x)
actionview (~> 5.x) actionview (~> 5.x)
activesupport (~> 5.x) activesupport (~> 5.x)
rails-dom-testing (2.0.1) rails-dom-testing (2.0.2)
activesupport (>= 4.2.0, < 6.0) activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.3)
loofah (~> 2.0) loofah (~> 2.0)
rails-i18n (5.0.0) rails-i18n (5.0.3)
i18n (~> 0.7) i18n (~> 0.7)
railties (~> 5.0) railties (~> 5.0)
railties (5.0.0) railties (5.1.0)
actionpack (= 5.0.0) actionpack (= 5.1.0)
activesupport (= 5.0.0) activesupport (= 5.1.0)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (11.2.2) rake (12.0.0)
rb-fsevent (0.9.7) rb-fsevent (0.9.8)
rb-inotify (0.9.7) rb-inotify (0.9.8)
ffi (>= 0.5.0) ffi (>= 0.5.0)
redcarpet (3.3.4) redcarpet (3.4.0)
redis (3.3.1) redis (3.3.3)
redis-namespace (1.5.2) redis-namespace (1.5.3)
redis (~> 3.0, >= 3.0.4) redis (~> 3.0, >= 3.0.4)
rest-client (2.0.0) rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
rouge (2.0.5) rouge (2.0.7)
rspec (3.5.0) rspec (3.5.0)
rspec-core (~> 3.5.0) rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0) rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.5.0)
rspec-core (3.5.2) rspec-core (3.5.4)
rspec-support (~> 3.5.0) rspec-support (~> 3.5.0)
rspec-expectations (3.5.0) rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
@ -254,7 +271,7 @@ GEM
rspec-mocks (3.5.0) rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.5.0)
rspec-rails (3.5.1) rspec-rails (3.5.2)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
railties (>= 3.0) railties (>= 3.0)
@ -262,12 +279,12 @@ GEM
rspec-expectations (~> 3.5.0) rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.5.0)
rspec-sidekiq (2.2.0) rspec-sidekiq (3.0.1)
rspec (~> 3.0, >= 3.0.0) rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0) sidekiq (>= 2.4.0)
rspec-support (3.5.0) rspec-support (3.5.0)
ruby_dep (1.4.0) ruby_dep (1.5.0)
sass (3.4.22) sass (3.4.23)
sass-rails (5.0.6) sass-rails (5.0.6)
railties (>= 4.0.0, < 6) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
@ -275,14 +292,12 @@ GEM
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
shellany (0.0.1) shellany (0.0.1)
sidekiq (4.1.2) sidekiq (5.0.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
redis (~> 3.2, >= 3.2.1) rack-protection (>= 1.5.0)
simple_form (3.2.1) redis (~> 3.3, >= 3.3.3)
actionpack (> 4, < 5.1) simplecov (0.13.0)
activemodel (> 4, < 5.1)
simplecov (0.12.0)
docile (~> 1.1.0) docile (~> 1.1.0)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
@ -290,41 +305,42 @@ GEM
slim (3.0.7) slim (3.0.7)
temple (~> 0.7.6) temple (~> 0.7.6)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
slim-rails (3.1.0) slim-rails (3.1.2)
actionpack (>= 3.1) actionpack (>= 3.1)
railties (>= 3.1) railties (>= 3.1)
slim (~> 3.0) slim (~> 3.0)
slop (3.6.0) slop (3.6.0)
spring (1.7.2) spring (2.0.1)
spring-watcher-listen (2.0.0) activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (~> 1.2) spring (>= 1.2, < 3.0)
sprockets (3.7.0) sprockets (3.7.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-es6 (0.9.1) sprockets-es6 (0.9.2)
babel-source (>= 5.8.11) babel-source (>= 5.8.11)
babel-transpiler babel-transpiler
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sprockets-rails (3.1.1) sprockets-rails (3.2.0)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
temple (0.7.7) temple (0.7.7)
thor (0.19.1) thor (0.19.4)
thread_safe (0.3.5) thread_safe (0.3.6)
tilt (2.0.5) tilt (2.0.7)
turbolinks (5.0.1) turbolinks (5.0.1)
turbolinks-source (~> 5) turbolinks-source (~> 5)
turbolinks-source (5.0.0) turbolinks-source (5.0.0)
tzinfo (1.2.2) tzinfo (1.2.3)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.0.1) uglifier (3.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.4)
websocket-driver (0.6.4) websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.2)
xpath (2.0.0) xpath (2.0.0)
@ -339,7 +355,7 @@ DEPENDENCIES
capybara capybara
carrierwave carrierwave
codeclimate-test-reporter codeclimate-test-reporter
coffee-rails (~> 4.1.0) coffee-rails
database_cleaner database_cleaner
factory_girl_rails factory_girl_rails
figaro figaro
@ -367,7 +383,7 @@ DEPENDENCIES
pg pg
puma puma
rack-cors rack-cors
rails (>= 5.0.0, < 5.1) rails (>= 5.1.0, < 5.2)
rails-controller-testing rails-controller-testing
rails-i18n (~> 5.0.0) rails-i18n (~> 5.0.0)
redcarpet redcarpet
@ -378,7 +394,7 @@ DEPENDENCIES
rspec-sidekiq rspec-sidekiq
sass-rails (~> 5.0) sass-rails (~> 5.0)
sidekiq sidekiq
simple_form simple_form!
slim-rails slim-rails
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
@ -386,7 +402,7 @@ DEPENDENCIES
uglifier (>= 2.7.2) uglifier (>= 2.7.2)
RUBY VERSION RUBY VERSION
ruby 2.2.3p173 ruby 2.3.1p112
BUNDLED WITH BUNDLED WITH
1.12.5 1.14.6

3
bin/bundle Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin APP_PATH = File.expand_path('../config/application', __dir__)
load File.expand_path("../spring", __FILE__) require_relative '../config/boot'
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands' require 'rails/commands'

View File

@ -1,7 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin require_relative '../config/boot'
load File.expand_path("../spring", __FILE__) require 'rake'
rescue LoadError Rake.application.run
end
require 'bundler/setup'
load Gem.bin_path('rake', 'rake')

34
bin/setup Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

29
bin/update Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

View File

@ -1,19 +1,21 @@
require File.expand_path('../boot', __FILE__) require_relative 'boot'
require 'rails/all' require 'rails/all'
Bundler.require(:default, Rails.env) # Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module WBlog module WBlog
class Application < Rails::Application class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.i18n.available_locales = [:en, :'zh-CN'] config.i18n.available_locales = [:en, :'zh-CN']
#I18n.config.enforce_available_locales = true
config.i18n.default_locale = (ENV['LOCALE'] || 'zh-CN').to_sym config.i18n.default_locale = (ENV['LOCALE'] || 'zh-CN').to_sym
config.time_zone = 'Beijing' config.time_zone = 'Beijing'
config.action_controller.action_on_unpermitted_parameters = :log
config.filter_parameters += [ :password ] config.action_controller.action_on_unpermitted_parameters = :log
# generators # generators
config.generators.assets = false config.generators.assets = false

View File

@ -1,4 +1,3 @@
# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) require 'bundler/setup' # Set up gems listed in the Gemfile.

View File

@ -1,5 +1,5 @@
# Load the rails application # Load the Rails application.
require File.expand_path('../application', __FILE__) require_relative 'application'
# Initialize the rails application # Initialize the Rails application.
WBlog::Application.initialize! Rails.application.initialize!

View File

@ -1,4 +1,4 @@
WBlog::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
@ -9,39 +9,46 @@ WBlog::Application.configure do
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
# Show full error reports and disable caching. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large # This option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
config.assets.debug = true config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
config.middleware.insert_before 0, Rack::Cors do # Raises error for missing translations
allow do # config.action_view.raise_on_missing_translations = true
origins '*'
resource '*', :headers => :any, :methods => [:get, :post, :options]
end
end
config.action_mailer.default_url_options = { :host => 'localhost:3000' } # Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.action_mailer.smtp_settings = { # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
address: ENV["MAIL_SERVER"],
port: 25,
domain: ENV["DOMAIN_NAME"],
authentication: "plain",
user_name: ENV["MAIL_USERNAME"],
password: ENV["MAIL_PASSWORD"]
}
# Send email in development mode.
config.action_mailer.perform_deliveries = true
end end

View File

@ -1,11 +1,11 @@
WBlog::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests. # Code is not reloaded between requests.
config.cache_classes = true config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better. # and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance. # Rake tasks automatically ignore this option for performance.
config.eager_load = true config.eager_load = true
@ -14,13 +14,9 @@ WBlog::Application.configure do
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application # Disable serving static files from the `/public` folder by default since
# Add `rack-cache` to your Gemfile before enabling this. # Apache or NGINX already handles this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.public_file_server.enabled = false
# Compress JavaScripts and CSS. # Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier config.assets.js_compressor = :uglifier
@ -29,69 +25,63 @@ WBlog::Application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# Generate digests for assets URLs. # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
config.assets.version = '1.0' # config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
config.action_cable.allowed_request_origins = [ "http://#{ENV['DOMAIN_NAME']}", "https://#{ENV['DOMAIN_NAME']}"]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true # config.force_ssl = true
# Set to :debug to see everything in the log. # Use the lowest log level to ensure availability of diagnostic information
config.log_level = :info # when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
config.log_tags = [ :request_id ] config.log_tags = [ :request_id ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Use a real queuing backend for Active Job (and separate queues per environment)
if ENV['CDN'].present? # config.active_job.queue_adapter = :resque
config.action_controller.asset_host = ENV['CDN'] # config.active_job.queue_name_prefix = "w_blog_#{Rails.env}"
end config.action_mailer.perform_caching = false
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( )
#config.action_cable.url = 'wss://example.com/cable'
config.action_cable.allowed_request_origins = [ "http://#{ENV['DOMAIN_NAME']}", "https://#{ENV['DOMAIN_NAME']}"]
# Ignore bad email addresses and do not raise email delivery errors. # Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found). # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners. # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
config.action_mailer.default_url_options = { :host => ENV["DOMAIN_NAME"] }
config.action_mailer.smtp_settings = {
address: ENV["MAIL_SERVER"],
port: 25,
domain: ENV["DOMAIN_NAME"],
authentication: "plain",
user_name: ENV["MAIL_USERNAME"],
password: ENV["MAIL_PASSWORD"]
}
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed. # Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end end

View File

@ -1,4 +1,4 @@
WBlog::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
@ -12,9 +12,11 @@ WBlog::Application.configure do
# preloads Rails for running tests, you may have to set it to true. # preloads Rails for running tests, you may have to set it to true.
config.eager_load = false config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
@ -25,6 +27,7 @@ WBlog::Application.configure do
# Disable request forgery protection in test environment. # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
@ -33,4 +36,7 @@ WBlog::Application.configure do
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end end

View File

@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )

View File

@ -0,0 +1,11 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View File

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :marshal

View File

@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View File

@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format # Add new inflection rules using the following format. Inflections
# (all these examples are active by default): # are locale specific, and you may define rules for as many different
# ActiveSupport::Inflector.inflections do |inflect| # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people' # inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
#
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym 'RESTful'
# end # end

View File

@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks: # Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View File

@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
WBlog::Application.config.session_store :cookie_store, key: 'wblog_session' Rails.application.config.session_store :cookie_store, key: '_w_blog_session'

View File

@ -1,5 +1,5 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which # This file contains settings for ActionController::ParamsWrapper which
# is enabled by default. # is enabled by default.
@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] wrap_parameters format: [:json]
end end
# Disable root element in JSON by default. # To enable root element in JSON for ActiveRecord objects.
ActiveSupport.on_load(:active_record) do # ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false # self.include_root_in_json = true
end # end

View File

@ -9,23 +9,16 @@ en:
# When using html, text and mark won't be used. # When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>' # html: '<abbr title="required">*</abbr>'
error_notification: error_notification:
default_message: "Please review the problems below:" default_message: "Some errors were found, please take a look:"
# Examples # Labels and hints examples
# labels: # labels:
# defaults:
# password: 'Password' # password: 'Password'
# user: # user:
# new: # new:
# email: 'E-mail to sign in.' # email: 'E-mail para efetuar o sign in.'
# edit: # edit:
# email: 'E-mail.' # email: 'E-mail.'
# hints: # hints:
# defaults:
# username: 'User name to sign in.' # username: 'User name to sign in.'
# password: 'No special characters, please.' # password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'

7
config/spring.rb Normal file
View File

@ -0,0 +1,7 @@
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
config/application.yml
).each { |path| Spring.watch(path) }

View File

@ -1,10 +1,10 @@
= simple_form_for(@<%= singular_table_name %>) do |f| = simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification = f.error_notification
.form-inputs .inputs
<%- attributes.each do |attribute| -%> | <%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%> | <%- end -%>
.form-actions .actions
= f.button :submit = f.button :submit

View File

@ -3,8 +3,6 @@ require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production? abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper' require 'spec_helper'
require 'rspec/rails' require 'rspec/rails'
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
ActiveRecord::Migration.maintain_test_schema! ActiveRecord::Migration.maintain_test_schema!