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.

Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +6 -2
  4. data/CHANGELOG.md +19 -0
  5. data/Gemfile +5 -10
  6. data/README.md +140 -75
  7. data/Rakefile +4 -5
  8. data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  9. data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.svg +0 -0
  10. data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  11. data/{vendor/assets → assets}/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  12. data/assets/images/.keep +0 -0
  13. data/assets/javascripts/bootstrap-sprockets.js +12 -0
  14. data/assets/javascripts/bootstrap.js +2107 -0
  15. data/{vendor/assets → assets}/javascripts/bootstrap/affix.js +18 -11
  16. data/{vendor/assets → assets}/javascripts/bootstrap/alert.js +10 -6
  17. data/{vendor/assets → assets}/javascripts/bootstrap/button.js +11 -8
  18. data/{vendor/assets → assets}/javascripts/bootstrap/carousel.js +49 -31
  19. data/{vendor/assets → assets}/javascripts/bootstrap/collapse.js +19 -24
  20. data/{vendor/assets → assets}/javascripts/bootstrap/dropdown.js +9 -5
  21. data/{vendor/assets → assets}/javascripts/bootstrap/modal.js +25 -16
  22. data/{vendor/assets → assets}/javascripts/bootstrap/popover.js +9 -6
  23. data/{vendor/assets → assets}/javascripts/bootstrap/scrollspy.js +37 -21
  24. data/{vendor/assets → assets}/javascripts/bootstrap/tab.js +11 -8
  25. data/{vendor/assets → assets}/javascripts/bootstrap/tooltip.js +52 -17
  26. data/{vendor/assets → assets}/javascripts/bootstrap/transition.js +14 -3
  27. data/assets/stylesheets/_bootstrap-compass.scss +7 -0
  28. data/{vendor/assets → assets}/stylesheets/_bootstrap-mincer.scss +0 -0
  29. data/assets/stylesheets/_bootstrap-sprockets.scss +7 -0
  30. data/{vendor/assets/stylesheets/bootstrap.scss → assets/stylesheets/_bootstrap.scss} +0 -0
  31. data/{vendor/assets → assets}/stylesheets/bootstrap/_alerts.scss +4 -3
  32. data/{vendor/assets → assets}/stylesheets/bootstrap/_badges.scss +0 -0
  33. data/{vendor/assets → assets}/stylesheets/bootstrap/_breadcrumbs.scss +0 -0
  34. data/{vendor/assets → assets}/stylesheets/bootstrap/_button-groups.scss +5 -1
  35. data/{vendor/assets → assets}/stylesheets/bootstrap/_buttons.scss +0 -2
  36. data/{vendor/assets → assets}/stylesheets/bootstrap/_carousel.scss +3 -1
  37. data/{vendor/assets → assets}/stylesheets/bootstrap/_close.scss +0 -0
  38. data/{vendor/assets → assets}/stylesheets/bootstrap/_code.scss +6 -0
  39. data/{vendor/assets → assets}/stylesheets/bootstrap/_component-animations.scss +0 -0
  40. data/{vendor/assets → assets}/stylesheets/bootstrap/_dropdowns.scss +1 -0
  41. data/{vendor/assets → assets}/stylesheets/bootstrap/_forms.scss +82 -22
  42. data/{vendor/assets → assets}/stylesheets/bootstrap/_glyphicons.scss +4 -4
  43. data/{vendor/assets → assets}/stylesheets/bootstrap/_grid.scss +0 -0
  44. data/{vendor/assets → assets}/stylesheets/bootstrap/_input-groups.scss +6 -2
  45. data/{vendor/assets → assets}/stylesheets/bootstrap/_jumbotron.scss +0 -0
  46. data/{vendor/assets → assets}/stylesheets/bootstrap/_labels.scss +0 -0
  47. data/{vendor/assets → assets}/stylesheets/bootstrap/_list-group.scss +3 -1
  48. data/{vendor/assets → assets}/stylesheets/bootstrap/_media.scss +0 -0
  49. data/{vendor/assets → assets}/stylesheets/bootstrap/_mixins.scss +0 -0
  50. data/{vendor/assets → assets}/stylesheets/bootstrap/_modals.scss +7 -4
  51. data/{vendor/assets → assets}/stylesheets/bootstrap/_navbar.scss +1 -0
  52. data/{vendor/assets → assets}/stylesheets/bootstrap/_navs.scss +1 -1
  53. data/{vendor/assets → assets}/stylesheets/bootstrap/_normalize.scss +0 -0
  54. data/{vendor/assets → assets}/stylesheets/bootstrap/_pager.scss +0 -0
  55. data/{vendor/assets → assets}/stylesheets/bootstrap/_pagination.scss +0 -0
  56. data/{vendor/assets → assets}/stylesheets/bootstrap/_panels.scss +6 -3
  57. data/{vendor/assets → assets}/stylesheets/bootstrap/_popovers.scss +0 -0
  58. data/{vendor/assets → assets}/stylesheets/bootstrap/_print.scss +0 -0
  59. data/{vendor/assets → assets}/stylesheets/bootstrap/_progress-bars.scss +18 -2
  60. data/{vendor/assets → assets}/stylesheets/bootstrap/_responsive-embed.scss +0 -0
  61. data/{vendor/assets → assets}/stylesheets/bootstrap/_responsive-utilities.scss +2 -1
  62. data/{vendor/assets → assets}/stylesheets/bootstrap/_scaffolding.scss +1 -1
  63. data/{vendor/assets → assets}/stylesheets/bootstrap/_tables.scss +2 -2
  64. data/{vendor/assets → assets}/stylesheets/bootstrap/_theme.scss +11 -0
  65. data/{vendor/assets → assets}/stylesheets/bootstrap/_thumbnails.scss +0 -0
  66. data/{vendor/assets → assets}/stylesheets/bootstrap/_tooltip.scss +0 -0
  67. data/{vendor/assets → assets}/stylesheets/bootstrap/_type.scss +16 -6
  68. data/{vendor/assets → assets}/stylesheets/bootstrap/_utilities.scss +1 -0
  69. data/{vendor/assets → assets}/stylesheets/bootstrap/_variables.scss +25 -20
  70. data/{vendor/assets → assets}/stylesheets/bootstrap/_wells.scss +0 -0
  71. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_alerts.scss +0 -0
  72. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_background-variant.scss +0 -0
  73. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_border-radius.scss +0 -0
  74. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_buttons.scss +0 -0
  75. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_center-block.scss +0 -0
  76. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_clearfix.scss +0 -0
  77. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_forms.scss +0 -0
  78. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  79. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_grid-framework.scss +2 -8
  80. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_grid.scss +3 -3
  81. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_hide-text.scss +0 -0
  82. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_image.scss +1 -0
  83. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_labels.scss +0 -0
  84. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_list-group.scss +0 -0
  85. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -0
  86. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +0 -0
  87. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_opacity.scss +0 -0
  88. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_pagination.scss +0 -0
  89. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_panels.scss +4 -0
  90. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_progress-bar.scss +2 -0
  91. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_reset-filter.scss +0 -0
  92. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_resize.scss +1 -1
  93. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_responsive-visibility.scss +0 -0
  94. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_size.scss +0 -0
  95. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_tab-focus.scss +0 -0
  96. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_table-row.scss +0 -0
  97. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -0
  98. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_text-overflow.scss +0 -0
  99. data/{vendor/assets → assets}/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +5 -10
  100. data/bootstrap-sass.gemspec +11 -6
  101. data/bower.json +22 -90
  102. data/composer.json +1 -1
  103. data/lib/bootstrap-sass.rb +3 -2
  104. data/lib/bootstrap-sass/engine.rb +4 -1
  105. data/lib/bootstrap-sass/version.rb +2 -2
  106. data/package.json +6 -1
  107. data/sache.json +5 -0
  108. data/tasks/bower.rake +6 -5
  109. data/tasks/converter.rb +3 -3
  110. data/tasks/converter/js_conversion.rb +11 -5
  111. data/tasks/converter/less_conversion.rb +30 -21
  112. data/tasks/converter/logger.rb +1 -0
  113. data/tasks/converter/network.rb +14 -16
  114. data/templates/project/{_variables.sass.erb → _bootstrap-variables.sass.erb} +0 -2
  115. data/templates/project/manifest.rb +17 -16
  116. data/templates/project/styles.sass +2 -2
  117. data/test/compass_test.rb +5 -4
  118. data/test/compilation_test.rb +10 -9
  119. data/test/dummy_node_mincer/manifest.js +2 -2
  120. data/test/dummy_rails/README.rdoc +1 -1
  121. data/test/dummy_rails/app/assets/javascripts/application.js +1 -1
  122. data/test/dummy_rails/app/assets/stylesheets/application.css.sass +2 -1
  123. data/test/dummy_rails/app/views/pages/root.html.slim +1 -1
  124. data/test/dummy_rails/config/application.rb +19 -3
  125. data/test/dummy_sass_only/compile.rb +4 -4
  126. data/test/gemfiles/sass_3_2.gemfile +1 -11
  127. data/test/gemfiles/sass_3_3.gemfile +2 -13
  128. data/test/gemfiles/sass_3_4.gemfile +7 -0
  129. data/test/gemfiles/sass_head.gemfile +2 -13
  130. data/test/node_mincer_test.rb +6 -5
  131. data/test/node_sass_test.rb +7 -6
  132. data/test/pages_test.rb +3 -3
  133. data/test/sass_test.rb +9 -6
  134. data/test/sprockets_rails_test.rb +11 -5
  135. data/test/support/dummy_rails_integration.rb +22 -0
  136. data/test/support/integration_test.rb +4 -11
  137. data/test/support/reporting.rb +17 -0
  138. data/test/test_helper.rb +22 -18
  139. data/test/test_helper_rails.rb +6 -0
  140. metadata +231 -151
  141. data/lib/bootstrap-sass/sass_functions.rb +0 -50
  142. data/vendor/assets/javascripts/bootstrap.js +0 -12
  143. data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +0 -50
@@ -1,5 +1,3 @@
1
- @import "bootstrap/variables"
2
-
3
1
  <% require 'bootstrap-sass/version' %>
4
2
  // Override Bootstrap variables here (defaults from bootstrap-sass v<%= Bootstrap::VERSION %>):
5
3
 
@@ -3,23 +3,24 @@ description 'Bootstrap for Sass'
3
3
  # Stylesheet importing bootstrap
4
4
  stylesheet 'styles.sass'
5
5
 
6
- # SCSS:
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 '_variables.sass.erb', :to => '_variables.sass', :erb => true,
12
- :bs_variables_path => File.expand_path("#{bs_stylesheets}/_variables.scss", File.dirname(__FILE__))
13
-
14
- # JS:
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
- bs_fonts = "#{assets}/fonts/bootstrap"
22
- Dir.glob File.expand_path("#{bs_fonts}/*", File.dirname(__FILE__)) do |path|
23
- file = File.basename(path)
24
- font "#{bs_fonts}/#{file}", :to => "bootstrap/#{file}"
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
- // customize bootstrap variables here:
2
- @import "variables"
1
+ @import "bootstrap-compass"
2
+ @import "bootstrap-variables"
3
3
  @import "bootstrap"
@@ -1,8 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
- class CompassTest < Test::Unit::TestCase
4
- def test_create_project_with_boostrap
5
- command = 'compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
6
- assert silence_stream(STDOUT) { system(command) }, 'Compass project creation failed!'
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
@@ -1,17 +1,18 @@
1
1
  require 'test_helper'
2
2
  require 'fileutils'
3
+ require 'sass'
3
4
 
4
- class CompilationTest < Test::Unit::TestCase
5
+ class CompilationTest < Minitest::Test
5
6
  def test_compilation
6
- path = 'vendor/assets/stylesheets'
7
- %w(bootstrap bootstrap/_theme).each do |file|
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
- assert_nothing_raised do
10
- FileUtils.mkdir_p("tmp/#{File.dirname(file)}")
11
- File.open("tmp/#{file}.css", 'w') { |f|
12
- f.write engine.render
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 + 'vendor/assets/stylesheets');
42
+ environment.appendPath(bootstrapPath + 'assets/stylesheets');
43
43
 
44
44
  // Include fonts load path
45
- environment.appendPath(bootstrapPath + 'vendor/assets/fonts');
45
+ environment.appendPath(bootstrapPath + 'assets/fonts');
46
46
 
47
47
  // Include dir with assets, root just for test
48
48
  environment.appendPath('./');
@@ -1,3 +1,3 @@
1
1
  == README
2
2
 
3
- This is a dummy app for testing REP
3
+ This is a minimal Rails app for testing
@@ -1,2 +1,2 @@
1
1
  //= require jquery
2
- //= require bootstrap
2
+ //= require bootstrap-sprockets
@@ -1 +1,2 @@
1
- @import "bootstrap"
1
+ @import 'bootstrap-sprockets'
2
+ @import 'bootstrap'
@@ -32,7 +32,7 @@
32
32
 
33
33
  form.form-inline
34
34
  .form-group
35
- input.sr-only for="exampleInputEmail2" Email address
35
+ label.sr-only for="exampleInputEmail2" Email address
36
36
  input.form-control#exampleInputEmail2 type="email" placeholder="Enter email"
37
37
  .checkbox
38
38
  label
@@ -1,14 +1,30 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
4
- Bundler.require(*Rails.groups)
5
- require 'bootstrap-sass'
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
- css = Sass.compile(
5
- File.read(File.expand_path('./import_all.sass', File.dirname(__FILE__))),
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'
4
- gem 'compass', '~> 1.0.0.alpha.19'
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: '../../'
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'sass', '~> 3.4.1'
4
+ gem 'compass', '~> 1.0.1', require: false
5
+
6
+ gemspec path: '../../'
7
+
@@ -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: '../../'
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'json'
3
3
 
4
- class NodeMincerTest < Test::Unit::TestCase
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 Bootstrap.gem_path, 'tmp/node-mincer'
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
- assert silence_stream(STDOUT) {
26
+ success = Dir.chdir DUMMY_PATH do
27
+ silence_stdout_if !ENV['VERBOSE'] do
28
28
  system(command)
29
- }, 'Node.js Mincer compilation failed'
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}")
@@ -1,15 +1,16 @@
1
1
  require 'test_helper'
2
2
  require 'fileutils'
3
3
 
4
- class NodeSassTest < Test::Unit::TestCase
4
+ class NodeSassTest < Minitest::Test
5
5
  def test_node_sass_compilation
6
- path = 'vendor/assets/stylesheets'
6
+ path = 'assets/stylesheets'
7
7
  %w(bootstrap bootstrap/_theme).each do |file|
8
- FileUtils.mkdir_p "tmp/node-sass"
8
+ FileUtils.mkdir_p 'tmp/node-sass'
9
9
  command = "node-sass #{path}/#{file} -o tmp/node-sass/#{File.basename file}.css"
10
- assert silence_stream(STDOUT) {
11
- system(command)
12
- }, 'node-sass compilation failed'
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
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'test_helper_rails'
2
2
 
3
3
  class PagesTest < ActionDispatch::IntegrationTest
4
- include ::IntegrationTest
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
@@ -1,6 +1,7 @@
1
1
  require 'test_helper'
2
+ require 'shellwords'
2
3
 
3
- class SassTest < Test::Unit::TestCase
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 Bootstrap.gem_path, 'tmp/bootstrap-sass-only.css'
15
- command = "bundle exec ruby compile.rb #{css_path}"
16
- Dir.chdir DUMMY_PATH do
17
- assert silence_stream(STDOUT) {
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
- }, 'Sass-only compilation failed'
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 < ActiveSupport::TestCase
6
+ class SprocketsRailsTest < Minitest::Test
7
7
 
8
8
  def test_sprockets_digest_asset_refs
9
- system "cd #{Shellwords.escape Rails.root.to_s} && bundle exec rake assets:precompile GEMFILE=#{Bootstrap.gem_path}/Gemfile RAILS_ENV=production"
10
- Dir.glob(Rails.root.join('public', 'assets', 'app*.*')) do |path|
11
- next unless path =~ /\.(css|js)$/
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
- system "rm -rf #{Rails.root}/public/assets/ #{Rails.root}/tmp/cache/"
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/dummy/tmp/cache]
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, "#{@__name__}.png"), :full => true)
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, "#{@__name__}.html"), 'w') { |f| f.write(source) } if source
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