Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d16ea45

Browse files
committedAug 31, 2015
Update and fix rake dummy_rails
* Fix the task * Rename to `rake rails_server` * Add tether as a development dependency
1 parent 5e44c6e commit d16ea45

File tree

7 files changed

+31
-17
lines changed

7 files changed

+31
-17
lines changed
 

‎Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ gem 'compass', require: false
77

88
group :development do
99
gem 'term-ansicolor'
10+
source 'https://rails-assets.org' do
11+
gem 'rails-assets-tether', '>= 1.1.0'
12+
end
1013
end
1114

1215
group :debug do

‎Rakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
lib_path = File.join(File.dirname(__FILE__), 'lib')
22
$:.unshift(lib_path) unless $:.include?(lib_path)
33

4-
require './lib/bootstrap'
54
require 'rake/testtask'
65
Rake::TestTask.new do |t|
76
t.libs << 'test'
@@ -12,10 +11,14 @@ end
1211
desc 'Dumps output to a CSS file for testing'
1312
task :debug do
1413
require 'sass'
14+
require './lib/bootstrap'
15+
require 'term/ansicolor'
1516
path = Bootstrap.stylesheets_path
1617
%w(_bootstrap _bootstrap-flex _bootstrap-reboot _bootstrap-grid).each do |file|
1718
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
18-
File.open("./tmp/#{file}.css", 'w') { |f| f.write(engine.render) }
19+
out = File.join('tmp', "#{file[1..-1]}.css")
20+
File.write(out, engine.render)
21+
$stderr.puts Term::ANSIColor.green "Compiled #{out}"
1922
end
2023
end
2124

@@ -25,8 +28,8 @@ task :update, :branch do |t, args|
2528
Updater.new(branch: args[:branch]).update_bootstrap
2629
end
2730

28-
desc 'Start a dummy (test) Rails app server'
29-
task :dummy_rails do
31+
desc 'Start a dummy Rails app server'
32+
task :rails_server do
3033
require 'rack'
3134
require 'term/ansicolor'
3235
port = ENV['PORT'] || 9292

‎lib/bootstrap/engine.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Bootstrap
22
module Rails
33
class Engine < ::Rails::Engine
4-
initializer 'bootstrap.assets.precompile' do |app|
4+
initializer 'bootstrap.assets' do |app|
55
%w(stylesheets javascripts).each do |sub|
66
app.config.assets.paths << root.join('assets', sub).to_s
77
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
//= require jquery
2+
//= require tether
23
//= require bootstrap-sprockets
4+
5+
jQuery(function ($) {
6+
$('[data-toggle="tooltip"]').tooltip()
7+
});

‎test/dummy_rails/app/views/pages/root.html.slim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@
4343
.col-sm-6
4444
h2 6 columns
4545
.row
46-
.col-xs-4.col-xs-push-4
47-
h6 This is col-xs-4 col-xs-push-4
46+
.col-xs-4.col-xs-push-4: .card: .card-block
47+
.card-text data-toggle="tooltip" title="hi"
48+
h6 This is col-xs-4 col-xs-push-4.<br><small>Hover for tooltip.</small>
4849

49-
form.form-inline
50+
.card: .card-block: form.form-inline
5051
.form-group
5152
label.sr-only for="exampleInputEmail2" Email address
5253
input.form-control#exampleInputEmail2 type="email" placeholder="Enter email"

‎test/dummy_rails/config/application.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
require "#{framework}/railtie"
1111
end
1212

13-
require 'bootstrap'
1413
require 'compass'
15-
require 'jquery-rails'
1614
require 'slim-rails'
1715
require 'uglifier'
1816

17+
require 'bootstrap'
18+
require 'jquery-rails'
19+
require 'rails-assets-tether'
20+
1921
module Dummy
2022
class Application < Rails::Application
2123
config.assets.enabled = true if config.assets.respond_to?(:enabled)

‎test/test_helper.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
app,
2121
# inspector: '/Applications/Chromium.app/Contents/MacOS/Chromium', # open in inspector: page.driver.debug
2222
window_size: [1280, 1024],
23-
timeout: 90,
24-
js_errors: true
23+
timeout: 90,
24+
js_errors: true
2525
)
2626
end
2727

2828
Capybara.configure do |config|
29-
config.app_host = 'http://localhost:7000'
30-
config.default_driver = :poltergeist
31-
config.javascript_driver = :poltergeist
32-
config.server_port = 7000
33-
config.default_wait_time = 10
29+
config.app_host = 'http://localhost:7000'
30+
config.default_driver = :poltergeist
31+
config.javascript_driver = :poltergeist
32+
config.server_port = 7000
33+
config.default_max_wait_time = 10
3434
end
3535

0 commit comments

Comments
 (0)
Please sign in to comment.