bootstrap-sass 3.1.1.1 → 3.2.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bootstrap-sass might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +6 -2
- data/CHANGELOG.md +19 -0
- data/Gemfile +5 -10
- data/README.md +140 -75
- data/Rakefile +4 -5
- data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.svg +0 -0
- data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/assets/images/.keep +0 -0
- data/assets/javascripts/bootstrap-sprockets.js +12 -0
- data/assets/javascripts/bootstrap.js +2107 -0
- data/{vendor/assets → assets}/javascripts/bootstrap/affix.js +18 -11
- data/{vendor/assets → assets}/javascripts/bootstrap/alert.js +10 -6
- data/{vendor/assets → assets}/javascripts/bootstrap/button.js +11 -8
- data/{vendor/assets → assets}/javascripts/bootstrap/carousel.js +49 -31
- data/{vendor/assets → assets}/javascripts/bootstrap/collapse.js +19 -24
- data/{vendor/assets → assets}/javascripts/bootstrap/dropdown.js +9 -5
- data/{vendor/assets → assets}/javascripts/bootstrap/modal.js +25 -16
- data/{vendor/assets → assets}/javascripts/bootstrap/popover.js +9 -6
- data/{vendor/assets → assets}/javascripts/bootstrap/scrollspy.js +37 -21
- data/{vendor/assets → assets}/javascripts/bootstrap/tab.js +11 -8
- data/{vendor/assets → assets}/javascripts/bootstrap/tooltip.js +52 -17
- data/{vendor/assets → assets}/javascripts/bootstrap/transition.js +14 -3
- data/assets/stylesheets/_bootstrap-compass.scss +7 -0
- data/{vendor/assets → assets}/stylesheets/_bootstrap-mincer.scss +0 -0
- data/assets/stylesheets/_bootstrap-sprockets.scss +7 -0
- data/{vendor/assets/stylesheets/bootstrap.scss → assets/stylesheets/_bootstrap.scss} +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_alerts.scss +4 -3
- data/{vendor/assets → assets}/stylesheets/bootstrap/_badges.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_breadcrumbs.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_button-groups.scss +5 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_buttons.scss +0 -2
- data/{vendor/assets → assets}/stylesheets/bootstrap/_carousel.scss +3 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_close.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_code.scss +6 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_component-animations.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_dropdowns.scss +1 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_forms.scss +82 -22
- data/{vendor/assets → assets}/stylesheets/bootstrap/_glyphicons.scss +4 -4
- data/{vendor/assets → assets}/stylesheets/bootstrap/_grid.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_input-groups.scss +6 -2
- data/{vendor/assets → assets}/stylesheets/bootstrap/_jumbotron.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_labels.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_list-group.scss +3 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_media.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_mixins.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_modals.scss +7 -4
- data/{vendor/assets → assets}/stylesheets/bootstrap/_navbar.scss +1 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_navs.scss +1 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_normalize.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_pager.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_pagination.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_panels.scss +6 -3
- data/{vendor/assets → assets}/stylesheets/bootstrap/_popovers.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_print.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_progress-bars.scss +18 -2
- data/{vendor/assets → assets}/stylesheets/bootstrap/_responsive-embed.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_responsive-utilities.scss +2 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_scaffolding.scss +1 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/_tables.scss +2 -2
- data/{vendor/assets → assets}/stylesheets/bootstrap/_theme.scss +11 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_thumbnails.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_tooltip.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_type.scss +16 -6
- data/{vendor/assets → assets}/stylesheets/bootstrap/_utilities.scss +1 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/_variables.scss +25 -20
- data/{vendor/assets → assets}/stylesheets/bootstrap/_wells.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_alerts.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_background-variant.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_border-radius.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_buttons.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_center-block.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_clearfix.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_forms.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_grid-framework.scss +2 -8
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_grid.scss +3 -3
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_hide-text.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_image.scss +1 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_labels.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_list-group.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_opacity.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_pagination.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_panels.scss +4 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_progress-bar.scss +2 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_reset-filter.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_resize.scss +1 -1
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_responsive-visibility.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_size.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_tab-focus.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_table-row.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_text-overflow.scss +0 -0
- data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +5 -10
- data/bootstrap-sass.gemspec +11 -6
- data/bower.json +22 -90
- data/composer.json +1 -1
- data/lib/bootstrap-sass.rb +3 -2
- data/lib/bootstrap-sass/engine.rb +4 -1
- data/lib/bootstrap-sass/version.rb +2 -2
- data/package.json +6 -1
- data/sache.json +5 -0
- data/tasks/bower.rake +6 -5
- data/tasks/converter.rb +3 -3
- data/tasks/converter/js_conversion.rb +11 -5
- data/tasks/converter/less_conversion.rb +30 -21
- data/tasks/converter/logger.rb +1 -0
- data/tasks/converter/network.rb +14 -16
- data/templates/project/{_variables.sass.erb → _bootstrap-variables.sass.erb} +0 -2
- data/templates/project/manifest.rb +17 -16
- data/templates/project/styles.sass +2 -2
- data/test/compass_test.rb +5 -4
- data/test/compilation_test.rb +10 -9
- data/test/dummy_node_mincer/manifest.js +2 -2
- data/test/dummy_rails/README.rdoc +1 -1
- data/test/dummy_rails/app/assets/javascripts/application.js +1 -1
- data/test/dummy_rails/app/assets/stylesheets/application.css.sass +2 -1
- data/test/dummy_rails/app/views/pages/root.html.slim +1 -1
- data/test/dummy_rails/config/application.rb +19 -3
- data/test/dummy_sass_only/compile.rb +4 -4
- data/test/gemfiles/sass_3_2.gemfile +1 -11
- data/test/gemfiles/sass_3_3.gemfile +2 -13
- data/test/gemfiles/sass_3_4.gemfile +7 -0
- data/test/gemfiles/sass_head.gemfile +2 -13
- data/test/node_mincer_test.rb +6 -5
- data/test/node_sass_test.rb +7 -6
- data/test/pages_test.rb +3 -3
- data/test/sass_test.rb +9 -6
- data/test/sprockets_rails_test.rb +11 -5
- data/test/support/dummy_rails_integration.rb +22 -0
- data/test/support/integration_test.rb +4 -11
- data/test/support/reporting.rb +17 -0
- data/test/test_helper.rb +22 -18
- data/test/test_helper_rails.rb +6 -0
- metadata +231 -151
- data/lib/bootstrap-sass/sass_functions.rb +0 -50
- data/vendor/assets/javascripts/bootstrap.js +0 -12
- data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +0 -50
@@ -3,23 +3,24 @@ description 'Bootstrap for Sass'
|
|
3
3
|
# Stylesheet importing bootstrap
|
4
4
|
stylesheet 'styles.sass'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
assets = "../../vendor/assets"
|
6
|
+
manifest = Pathname.new(File.dirname(__FILE__))
|
7
|
+
assets = File.expand_path('../../assets', manifest)
|
9
8
|
|
9
|
+
# Provide variables files
|
10
10
|
bs_stylesheets = "#{assets}/stylesheets/bootstrap"
|
11
|
-
stylesheet '
|
12
|
-
:
|
13
|
-
|
14
|
-
#
|
15
|
-
bs_javascripts = "#{assets}/javascripts/bootstrap"
|
16
|
-
Dir.glob File.expand_path("#{bs_javascripts}/*.js", File.dirname(__FILE__)) do |path|
|
17
|
-
file = File.basename(path)
|
18
|
-
javascript "#{bs_javascripts}/#{file}", :to => "bootstrap/#{file}"
|
19
|
-
end
|
11
|
+
stylesheet '_bootstrap-variables.sass.erb',
|
12
|
+
:erb => true,
|
13
|
+
:to => '_bootstrap-variables.sass',
|
14
|
+
:bs_variables_path => File.expand_path("#{bs_stylesheets}/_variables.scss", manifest)
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
# Copy JS and fonts
|
17
|
+
{:javascript => 'javascripts',
|
18
|
+
:font => 'fonts'
|
19
|
+
}.each do |method, dir|
|
20
|
+
root = Pathname.new(assets).join(dir)
|
21
|
+
Dir.glob root.join('**', '*.*') do |path|
|
22
|
+
path = Pathname.new(path)
|
23
|
+
send method, path.relative_path_from(manifest).to_s,
|
24
|
+
:to => path.relative_path_from(root).to_s
|
25
|
+
end
|
25
26
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
@import "variables"
|
1
|
+
@import "bootstrap-compass"
|
2
|
+
@import "bootstrap-variables"
|
3
3
|
@import "bootstrap"
|
data/test/compass_test.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class CompassTest < Test
|
4
|
-
def
|
5
|
-
command = 'compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
|
6
|
-
|
3
|
+
class CompassTest < Minitest::Test
|
4
|
+
def test_create_project
|
5
|
+
command = 'rm -rf tmp/new-compass-project; bundle exec compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
|
6
|
+
success = silence_stdout_if(!ENV['VERBOSE']) { system(command) }
|
7
|
+
assert success, 'Compass project creation failed!'
|
7
8
|
end
|
8
9
|
end
|
data/test/compilation_test.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'sass'
|
3
4
|
|
4
|
-
class CompilationTest < Test
|
5
|
+
class CompilationTest < Minitest::Test
|
5
6
|
def test_compilation
|
6
|
-
path = '
|
7
|
-
%w(
|
7
|
+
path = 'assets/stylesheets'
|
8
|
+
%w(_bootstrap bootstrap/_theme).each do |file|
|
9
|
+
FileUtils.rm_rf('.sass-cache', secure: true)
|
8
10
|
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
FileUtils.mkdir_p("tmp/#{File.dirname(file)}")
|
12
|
+
File.open("tmp/#{file}.css", 'w') { |f|
|
13
|
+
f.write engine.render
|
14
|
+
}
|
15
|
+
assert true # nothing was raised
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -39,10 +39,10 @@ var environment = new Mincer.Environment(process.cwd());
|
|
39
39
|
|
40
40
|
// Include bootstrap scss load path
|
41
41
|
var bootstrapPath = '../../';
|
42
|
-
environment.appendPath(bootstrapPath + '
|
42
|
+
environment.appendPath(bootstrapPath + 'assets/stylesheets');
|
43
43
|
|
44
44
|
// Include fonts load path
|
45
|
-
environment.appendPath(bootstrapPath + '
|
45
|
+
environment.appendPath(bootstrapPath + 'assets/fonts');
|
46
46
|
|
47
47
|
// Include dir with assets, root just for test
|
48
48
|
environment.appendPath('./');
|
@@ -1,2 +1,2 @@
|
|
1
1
|
//= require jquery
|
2
|
-
//= require bootstrap
|
2
|
+
//= require bootstrap-sprockets
|
@@ -1 +1,2 @@
|
|
1
|
-
@import
|
1
|
+
@import 'bootstrap-sprockets'
|
2
|
+
@import 'bootstrap'
|
@@ -1,14 +1,30 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
|
-
require 'rails
|
4
|
-
|
5
|
-
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
%w(
|
6
|
+
action_controller
|
7
|
+
action_view
|
8
|
+
sprockets
|
9
|
+
).each do |framework|
|
10
|
+
require "#{framework}/railtie"
|
11
|
+
end
|
12
|
+
|
6
13
|
require 'slim-rails'
|
7
14
|
require 'jquery-rails'
|
15
|
+
require 'compass'
|
16
|
+
require 'bootstrap-sass'
|
17
|
+
require 'uglifier'
|
8
18
|
|
9
19
|
module Dummy
|
10
20
|
class Application < Rails::Application
|
11
21
|
config.assets.enabled = true if config.assets.respond_to?(:enabled)
|
22
|
+
config.to_prepare do
|
23
|
+
if ENV['VERBOSE']
|
24
|
+
STDERR.puts "Loaded Rails #{Rails::VERSION::STRING}, Sprockets #{Sprockets::VERSION}",
|
25
|
+
"Asset paths: #{Rails.application.config.assets.paths}"
|
26
|
+
end
|
27
|
+
end
|
12
28
|
end
|
13
29
|
end
|
14
30
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'sass'
|
2
2
|
require 'bootstrap-sass'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
:syntax => 'sass'
|
7
|
-
)
|
5
|
+
scss_path = File.expand_path('./import_all.sass', File.dirname(__FILE__))
|
6
|
+
css = Sass.compile File.read(scss_path), syntax: 'sass'
|
8
7
|
|
9
8
|
if ARGV[0]
|
9
|
+
FileUtils.mkdir_p File.dirname(ARGV[0])
|
10
10
|
File.open(ARGV[0], 'w') { |f| f.write css }
|
11
11
|
else
|
12
12
|
puts css
|
@@ -1,16 +1,6 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gem 'sass', '~> 3.2.0'
|
4
|
-
|
5
|
-
platform :rbx do
|
6
|
-
gem 'rubysl', '~> 2.0'
|
7
|
-
gem 'rubysl-test-unit', '~> 2.0'
|
8
|
-
gem 'json', '>= 1.8.1'
|
9
|
-
gem 'racc'
|
10
|
-
end
|
11
|
-
|
12
|
-
platform :jruby do
|
13
|
-
gem 'test-unit'
|
14
|
-
end
|
4
|
+
gem 'compass', require: false
|
15
5
|
|
16
6
|
gemspec path: '../../'
|
@@ -1,17 +1,6 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem 'sass', '~> 3.3.
|
4
|
-
gem 'compass', '~> 1.0.
|
5
|
-
|
6
|
-
platform :rbx do
|
7
|
-
gem 'rubysl', '~> 2.0'
|
8
|
-
gem 'rubysl-test-unit', '~> 2.0'
|
9
|
-
gem 'json', '>= 1.8.1'
|
10
|
-
gem 'racc'
|
11
|
-
end
|
12
|
-
|
13
|
-
platform :jruby do
|
14
|
-
gem 'test-unit'
|
15
|
-
end
|
3
|
+
gem 'sass', '~> 3.3.14'
|
4
|
+
gem 'compass', '~> 1.0.1', require: false
|
16
5
|
|
17
6
|
gemspec path: '../../'
|
@@ -1,17 +1,6 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem 'sass', git: 'https://github.com/nex3/sass'
|
4
|
-
gem 'compass', git: 'https://github.com/chriseppstein/compass', branch: 'master'
|
5
|
-
|
6
|
-
platform :rbx do
|
7
|
-
gem 'rubysl', '~> 2.0'
|
8
|
-
gem 'rubysl-test-unit', '~> 2.0'
|
9
|
-
gem 'json', '>= 1.8.1'
|
10
|
-
gem 'racc'
|
11
|
-
end
|
12
|
-
|
13
|
-
platform :jruby do
|
14
|
-
gem 'test-unit'
|
15
|
-
end
|
3
|
+
gem 'sass', git: 'https://github.com/nex3/sass', branch: 'stable' # master is not compatible with Compass master
|
4
|
+
gem 'compass', git: 'https://github.com/chriseppstein/compass', branch: 'master', require: false
|
16
5
|
|
17
6
|
gemspec path: '../../'
|
data/test/node_mincer_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
class NodeMincerTest < Test
|
4
|
+
class NodeMincerTest < Minitest::Test
|
5
5
|
DUMMY_PATH = 'test/dummy_node_mincer'
|
6
6
|
|
7
7
|
def test_font_helper_without_suffix
|
@@ -21,13 +21,14 @@ class NodeMincerTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def setup
|
24
|
-
tmp_dir = File.join
|
24
|
+
tmp_dir = File.join GEM_PATH, 'tmp/node-mincer'
|
25
25
|
command = "node manifest.js #{tmp_dir}"
|
26
|
-
Dir.chdir DUMMY_PATH do
|
27
|
-
|
26
|
+
success = Dir.chdir DUMMY_PATH do
|
27
|
+
silence_stdout_if !ENV['VERBOSE'] do
|
28
28
|
system(command)
|
29
|
-
|
29
|
+
end
|
30
30
|
end
|
31
|
+
assert success, 'Node.js Mincer compilation failed'
|
31
32
|
manifest = JSON.parse(File.read("#{tmp_dir}/manifest.json"))
|
32
33
|
css_name = manifest["assets"]["application.css"]
|
33
34
|
@css = File.read("#{tmp_dir}/#{css_name}")
|
data/test/node_sass_test.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
-
class NodeSassTest < Test
|
4
|
+
class NodeSassTest < Minitest::Test
|
5
5
|
def test_node_sass_compilation
|
6
|
-
path = '
|
6
|
+
path = 'assets/stylesheets'
|
7
7
|
%w(bootstrap bootstrap/_theme).each do |file|
|
8
|
-
FileUtils.mkdir_p
|
8
|
+
FileUtils.mkdir_p 'tmp/node-sass'
|
9
9
|
command = "node-sass #{path}/#{file} -o tmp/node-sass/#{File.basename file}.css"
|
10
|
-
|
11
|
-
system
|
12
|
-
|
10
|
+
success = silence_stderr_if !ENV['VERBOSE'] do
|
11
|
+
system command
|
12
|
+
end
|
13
|
+
assert success, 'node-sass compilation failed'
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
data/test/pages_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper_rails'
|
2
2
|
|
3
3
|
class PagesTest < ActionDispatch::IntegrationTest
|
4
|
-
include ::
|
4
|
+
include ::DummyRailsIntegration
|
5
5
|
|
6
6
|
def test_visit_root
|
7
7
|
visit root_path
|
@@ -11,4 +11,4 @@ class PagesTest < ActionDispatch::IntegrationTest
|
|
11
11
|
|
12
12
|
screenshot!
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
data/test/sass_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'shellwords'
|
2
3
|
|
3
|
-
class SassTest < Test
|
4
|
+
class SassTest < Minitest::Test
|
4
5
|
DUMMY_PATH = 'test/dummy_sass_only'
|
5
6
|
|
6
7
|
def test_font_helper
|
@@ -9,15 +10,17 @@ class SassTest < Test::Unit::TestCase
|
|
9
10
|
|
10
11
|
def setup
|
11
12
|
Dir.chdir DUMMY_PATH do
|
13
|
+
%x[rm -rf .sass-cache/]
|
12
14
|
%x[bundle]
|
13
15
|
end
|
14
|
-
css_path = File.join
|
15
|
-
command
|
16
|
-
Dir.chdir DUMMY_PATH do
|
17
|
-
|
16
|
+
css_path = File.join GEM_PATH, 'tmp/bootstrap-sass-only.css'
|
17
|
+
command = "bundle exec ruby compile.rb #{Shellwords.escape css_path}"
|
18
|
+
success = Dir.chdir DUMMY_PATH do
|
19
|
+
silence_stdout_if !ENV['VERBOSE'] do
|
18
20
|
system(command)
|
19
|
-
|
21
|
+
end
|
20
22
|
end
|
23
|
+
assert success, 'Sass-only compilation failed'
|
21
24
|
@css = File.read(css_path)
|
22
25
|
end
|
23
26
|
end
|
@@ -3,12 +3,18 @@ require 'fileutils'
|
|
3
3
|
require 'find'
|
4
4
|
require 'shellwords'
|
5
5
|
|
6
|
-
class SprocketsRailsTest <
|
6
|
+
class SprocketsRailsTest < Minitest::Test
|
7
7
|
|
8
8
|
def test_sprockets_digest_asset_refs
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
root = 'test/dummy_rails'
|
10
|
+
command = "bundle exec rake assets:precompile GEMFILE=#{GEM_PATH}/Gemfile RAILS_ENV=production"
|
11
|
+
compiled = Dir.chdir root do
|
12
|
+
silence_stderr_if !ENV['VERBOSE'] do
|
13
|
+
system(command)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
assert compiled, 'Could not precompile assets'
|
17
|
+
Dir.glob(File.join(root, 'public', 'assets', 'app*.{css,js}')) do |path|
|
12
18
|
File.open(path, 'r') do |f|
|
13
19
|
f.read.scan /url\("?[^"]+\.(?:jpg|png|eot|woff|ttf|svg)[^"]*"?\)/ do |m|
|
14
20
|
assert_match /-[0-9a-f]{12,}\./, m
|
@@ -16,6 +22,6 @@ class SprocketsRailsTest < ActiveSupport::TestCase
|
|
16
22
|
end
|
17
23
|
end
|
18
24
|
ensure
|
19
|
-
|
25
|
+
FileUtils.rm_rf %W(#{root}/public/assets/ #{root}/tmp/cache/), secure: true
|
20
26
|
end
|
21
27
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'capybara'
|
2
|
+
require 'fileutils'
|
3
|
+
module DummyRailsIntegration
|
4
|
+
include Capybara::DSL
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
FileUtils.rm_rf('test/dummy_rails/tmp/cache', secure: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
super
|
13
|
+
Capybara.reset_sessions!
|
14
|
+
Capybara.use_default_driver
|
15
|
+
end
|
16
|
+
|
17
|
+
def screenshot!
|
18
|
+
path = "tmp/#{name}.png"
|
19
|
+
page.driver.render(File.join(GEM_PATH, path), full: true)
|
20
|
+
STDERR.puts "Screenshot saved to #{path}"
|
21
|
+
end
|
22
|
+
end
|
@@ -4,7 +4,7 @@ module IntegrationTest
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
super
|
7
|
-
%x[rm -rf test/
|
7
|
+
%x[rm -rf test/dummy_rails/tmp/cache]
|
8
8
|
end
|
9
9
|
|
10
10
|
def teardown
|
@@ -13,17 +13,10 @@ module IntegrationTest
|
|
13
13
|
Capybara.use_default_driver
|
14
14
|
end
|
15
15
|
|
16
|
-
def after_teardown
|
17
|
-
if @passed.blank?
|
18
|
-
screenshot!
|
19
|
-
puts "Failed at: #{current_url}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
16
|
def screenshot!
|
24
17
|
screenshot_dir = File.expand_path('../../tmp/', File.dirname(__FILE__))
|
25
|
-
page.driver.render(File.join(screenshot_dir, "#{
|
18
|
+
page.driver.render(File.join(screenshot_dir, "#{name}.png"), :full => true)
|
26
19
|
source = page.evaluate_script("document.getElementsByTagName('html')[0].outerHTML") rescue nil
|
27
|
-
File.open(File.join(screenshot_dir, "#{
|
20
|
+
File.open(File.join(screenshot_dir, "#{name}.html"), 'w') { |f| f.write(source) } if source
|
28
21
|
end
|
29
|
-
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Kernel
|
2
|
+
def silence_stdout_if(cond, &run)
|
3
|
+
silence_stream_if(cond, STDOUT, &run)
|
4
|
+
end
|
5
|
+
|
6
|
+
def silence_stderr_if(cond, &run)
|
7
|
+
silence_stream_if(cond, STDERR, &run)
|
8
|
+
end
|
9
|
+
|
10
|
+
def silence_stream_if(cond, stream, &run)
|
11
|
+
if cond
|
12
|
+
silence_stream(stream, &run)
|
13
|
+
else
|
14
|
+
run.call
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|