New gem group called assets. Close #6

This commit is contained in:
echarp 2015-10-31 17:45:44 +01:00
parent 4b77aa0d96
commit 933eaeadb1
3 changed files with 52 additions and 41 deletions

70
Gemfile
View File

@ -6,28 +6,6 @@ gem 'simple_calendar'
gem 'rails' gem 'rails'
gem 'has_scope' gem 'has_scope'
# Use SASS for stylesheets, this version is required to compile active_admin
# assets, TODO
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application
# faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password # Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7' # gem 'bcrypt', '~> 3.1.7'
@ -38,14 +16,6 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# gem 'capistrano-rails', group: :development # gem 'capistrano-rails', group: :development
gem 'haml-rails' gem 'haml-rails'
gem 'compass-rails', '~> 2.0.4'
gem 'modernizr-rails'
# Patch older browsers so they do understand html5
gem 'webshims-rails'
# Improve the html select element
gem 'select2-rails', '< 4'
gem 'devise' gem 'devise'
gem 'devise-i18n' gem 'devise-i18n'
@ -60,8 +30,6 @@ gem 'strip_attributes'
# Track changes to models' data # Track changes to models' data
gem 'paper_trail', '~> 4.0.0.rc' gem 'paper_trail', '~> 4.0.0.rc'
# A superb font to use as icons
gem 'font-awesome-sass'
# Validate mails submitted # Validate mails submitted
gem 'email_validator' gem 'email_validator'
# Email address obfuscation # Email address obfuscation
@ -127,6 +95,44 @@ group :development, :test do
gem 'spring' gem 'spring'
end end
group :development, :test, :assets do
# Use SASS for stylesheets, this version is required to compile active_admin
# assets, TODO
gem 'sass-rails'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application
# faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'compass-rails', '~> 2.0.4'
gem 'modernizr-rails'
# Patch older browsers so they do understand html5
gem 'webshims-rails'
# Improve the html select element
gem 'select2-rails', '< 4'
# A superb font to use as icons
gem 'font-awesome-sass'
end
group :assets do
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
end
group :production do group :production do
# Use mysql as the database for Active Record # Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18' gem 'mysql2', '~> 0.3.18'

View File

@ -19,10 +19,10 @@ test:
# Do not keep production secrets in the repository, # Do not keep production secrets in the repository,
# instead read values from the environment. # instead read values from the environment.
production: production:
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %> secret_key_base: <%= ENV['SECRET_KEY_BASE'] || 'hello world' %>
production_be: production_be:
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %> secret_key_base: <%= ENV['SECRET_KEY_BASE'] || 'hello world' %>
production_ch: production_ch:
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %> secret_key_base: <%= ENV['SECRET_KEY_BASE'] || 'hello world' %>
production_communs: production_communs:
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %> secret_key_base: <%= ENV['SECRET_KEY_BASE'] || 'hello world' %>

View File

@ -19,20 +19,25 @@ if use_bundler
end end
if File.file? 'Rakefile' if File.file? 'Rakefile'
tasks = []
num_migrations = num_migrations =
`git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate` `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`
.split("\0").size .split("\0").size
# run migrations if new ones have been added # run migrations if new ones have been added
tasks << 'db:migrate' if num_migrations > 0 if num_migrations > 0
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}"
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}_be"
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}_ch"
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}_commun"
end
# precompile assets # precompile assets
changed_assets = `git diff #{oldrev} #{newrev} --name-only -z app/assets` changed_assets = `git diff #{oldrev} #{newrev} --name-only -z app/assets`
.split("\0") .split("\0")
tasks << 'assets:precompile' if changed_assets.size > 0
run "#{rake_cmd} #{tasks.join(' ')} RAILS_ENV=#{RAILS_ENV}" if tasks.any? task = 'assets:precompile'
if changed_assets.size > 0
run "#{rake_cmd} #{task} RAILS_ENV=#{RAILS_ENV} RAILS_GROUPS=assets"
end
end end
# clear cached assets (unversioned/ignored files) # clear cached assets (unversioned/ignored files)