Skip to content

Commit

Permalink
Use bower-rails instead of rails-assets
Browse files Browse the repository at this point in the history
rails-assets.org is currently down and its future is
somewhat questionable :'(

The main downside is you now have to run `rake bower:install`
at some point in addition to the regular `bundle install`
  • Loading branch information
tjgrathwell committed Jan 18, 2016
1 parent c57b959 commit 03a01bc
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ custom_plan.rb

# Byebug
.byebug_history

# bower-rails
vendor/assets/bower_components
node_modules
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ before_install:
- 'echo ''gem: --no-ri --no-rdoc'' > ~/.gemrc'
- "rvm @global do gem uninstall bundler -x && gem install bundler"
before_script:
- 'npm install -g bower'
- 'bundle exec rake bower:install:development'
- "./config/before-travis.sh"
script: "bundle exec rake && bundle exec rake jasmine:ci"
script:
- "bundle exec rake"
- "bundle exec rake jasmine:ci"

notifications:
email: false
Expand Down
10 changes: 1 addition & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ gem 'icalendar'
gem 'pg' if ENV['FORCE_POSTGRES']
gem 'sprockets-rails', '< 3.0' # https://github.com/leshill/handlebars_assets/issues/145
gem 'rack-mini-profiler'
gem 'bower-rails'

group :production do
gem 'pg'
Expand Down Expand Up @@ -76,12 +77,3 @@ group :test do
# Remove after Rails 5: https://github.com/rails/rails/pull/18458
gem 'test_after_commit'
end

source 'https://rails-assets.org' do
gem 'rails-assets-DataTables'
gem 'rails-assets-select2'

group :test, :development do
gem 'rails-assets-sinonjs'
end
end
11 changes: 2 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
actionmailer (4.2.5)
actionpack (= 4.2.5)
Expand Down Expand Up @@ -60,6 +59,7 @@ GEM
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bower-rails (0.10.0)
builder (3.2.2)
bullet (5.0.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -244,11 +244,6 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5)
sprockets-rails
rails-assets-DataTables (1.10.10)
rails-assets-jquery (>= 1.7.0)
rails-assets-jquery (2.2.0)
rails-assets-select2 (4.0.1)
rails-assets-sinonjs (1.17.1)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
Expand Down Expand Up @@ -350,6 +345,7 @@ DEPENDENCIES
better_errors
binding_of_caller
bootstrap-sass
bower-rails
bullet
byebug
capybara (>= 2.0.1)
Expand Down Expand Up @@ -388,9 +384,6 @@ DEPENDENCIES
rack-mini-profiler
rack-timeout
rails (= 4.2.5)
rails-assets-DataTables!
rails-assets-select2!
rails-assets-sinonjs!
rails_12factor
rb-fsevent
rspec-collection_matchers
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
//= require ./dialogs/base_dialog
//= require_tree ./dialogs
//= require DataTables
//= require DataTables/dataTables.bootstrap
//= require DataTables/media/js/dataTables.bootstrap
//= require_tree .
//= require jquery_nested_form
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
*= require jquery-ui/datepicker
*= require bootstrap_with_overrides
*= require DataTables/dataTables.bootstrap
*= require DataTables/media/css/dataTables.bootstrap
*= require select2
*= require font_awesome_with_extensions
*= require _alerts
Expand Down
11 changes: 11 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ Dir.chdir APP_ROOT do

system "gem install bundler --conservative"
system "bundle check || bundle install --without production"

if `which npm`.empty?
puts <<-EOT
You don't have npm installed, which is needed to install bower.
Install npm by installing node.js from https://nodejs.org
EOT
exit 1
end
system "npm install -g bower"
system "rake bower:install"

if `which phantomjs`.empty?
puts <<-EOT.strip_heredoc
You don't have phantomjs installed, which means you won't be able to run
Expand Down
10 changes: 10 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name" : "bridge troll",
"dependencies": {
"DataTables": "1.10.10",
"select2": "4.0.1"
},
"devDependencies": {
"sinonjs": "1.17.1"
}
}
19 changes: 19 additions & 0 deletions config/initializers/bower_rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
BowerRails.configure do |bower_rails|
# Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
# bower_rails.root_path = Dir.pwd

# Invokes rake bower:install before precompilation. Defaults to false
bower_rails.install_before_precompile = Rails.env.production?

# Invokes rake bower:resolve before precompilation. Defaults to false
# bower_rails.resolve_before_precompile = true

# Invokes rake bower:clean before precompilation. Defaults to false
# bower_rails.clean_before_precompile = true

# Invokes rake bower:install:deployment instead rake bower:install. Defaults to false
# bower_rails.use_bower_install_deployment = true
#
# Invokes rake bower:install and rake bower:install:deployment with -F (force) flag. Defaults to false
# bower_rails.force_install = true
end
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"//": "This package.json currently only exists so Bower will be installed on Heroku",
"name": "bridge_troll",
"version": "0.0.0",
"dependencies": {
"bower": "^1.7.2"
}
}
6 changes: 3 additions & 3 deletions spec/javascripts/support/jasmine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# - dist/**/*.js
#
src_files:
- assets/application.js
- assets/jasmine-jquery.js
- assets/sinonjs.js
- assets/application
- assets/jasmine-jquery
- assets/sinonjs

# stylesheets
#
Expand Down

0 comments on commit 03a01bc

Please sign in to comment.