styler-sass 0.1.4 → 0.1.5.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +17 -2
  4. data/README.md +1 -2
  5. data/bin/styler +13 -3
  6. data/{app/assets/images/.keep → features/support/env.rb} +0 -0
  7. data/lib/styler/generator.rb +8 -1
  8. data/lib/styler/version.rb +1 -1
  9. data/lib/styler.rb +2 -6
  10. data/spec/bourbon/addons/border_color_spec.rb +51 -0
  11. data/spec/bourbon/addons/border_radius_spec.rb +25 -0
  12. data/spec/bourbon/addons/border_style_spec.rb +51 -0
  13. data/spec/bourbon/addons/border_width_spec.rb +51 -0
  14. data/spec/bourbon/addons/buttons_spec.rb +53 -0
  15. data/spec/bourbon/addons/clearfix_spec.rb +18 -0
  16. data/spec/bourbon/addons/ellipsis_spec.rb +20 -0
  17. data/spec/bourbon/addons/font_stacks_spec.rb +25 -0
  18. data/spec/bourbon/addons/hide_text_spec.rb +17 -0
  19. data/spec/bourbon/addons/margin_spec.rb +51 -0
  20. data/spec/bourbon/addons/padding_spec.rb +51 -0
  21. data/spec/bourbon/addons/position_spec.rb +67 -0
  22. data/spec/bourbon/addons/retina_image_spec.rb +57 -0
  23. data/spec/bourbon/addons/size_spec.rb +31 -0
  24. data/spec/bourbon/addons/text_inputs_spec.rb +65 -0
  25. data/spec/bourbon/addons/triangle_spec.rb +32 -0
  26. data/spec/bourbon/addons/word_wrap_spec.rb +29 -0
  27. data/spec/bourbon/css3/font_face_spec.rb +45 -0
  28. data/spec/bourbon/css3/hidpi_media_query_spec.rb +23 -0
  29. data/spec/bourbon/functions/assign_inputs_spec.rb +50 -0
  30. data/spec/bourbon/functions/contains_spec.rb +27 -0
  31. data/spec/bourbon/functions/is_length_spec.rb +49 -0
  32. data/spec/bourbon/functions/is_light_spec.rb +37 -0
  33. data/spec/bourbon/functions/is_number_spec.rb +43 -0
  34. data/spec/bourbon/functions/is_size_spec.rb +43 -0
  35. data/spec/bourbon/functions/modular_scale_spec.rb +43 -0
  36. data/spec/bourbon/functions/px_to_em_spec.rb +31 -0
  37. data/spec/bourbon/functions/px_to_rem_spec.rb +25 -0
  38. data/spec/bourbon/functions/shade_spec.rb +31 -0
  39. data/spec/bourbon/functions/strip_units_spec.rb +31 -0
  40. data/spec/bourbon/functions/tint_spec.rb +31 -0
  41. data/spec/bourbon/functions/unpack_spec.rb +32 -0
  42. data/spec/bourbon/helpers/convert_units_spec.rb +31 -0
  43. data/spec/bourbon/helpers/directional_values_spec.rb +39 -0
  44. data/spec/bourbon/helpers/font_source_declaration_spec.rb +29 -0
  45. data/spec/bourbon/helpers/str_to_num_spec.rb +25 -0
  46. data/spec/fixtures/_setup.scss +1 -0
  47. data/spec/fixtures/addons/border-color.scss +26 -0
  48. data/spec/fixtures/addons/border-radius.scss +17 -0
  49. data/spec/fixtures/addons/border-style.scss +21 -0
  50. data/spec/fixtures/addons/border-width.scss +21 -0
  51. data/spec/fixtures/addons/buttons.scss +17 -0
  52. data/spec/fixtures/addons/clearfix.scss +5 -0
  53. data/spec/fixtures/addons/ellipsis.scss +5 -0
  54. data/spec/fixtures/addons/font-stacks.scss +21 -0
  55. data/spec/fixtures/addons/hide-text.scss +5 -0
  56. data/spec/fixtures/addons/margin.scss +21 -0
  57. data/spec/fixtures/addons/padding.scss +21 -0
  58. data/spec/fixtures/addons/position.scss +25 -0
  59. data/spec/fixtures/addons/retina-image.scss +21 -0
  60. data/spec/fixtures/addons/size.scss +13 -0
  61. data/spec/fixtures/addons/text-inputs.scss +17 -0
  62. data/spec/fixtures/addons/triangle.scss +9 -0
  63. data/spec/fixtures/addons/word-wrap.scss +9 -0
  64. data/spec/fixtures/css3/font-face.scss +6 -0
  65. data/spec/fixtures/css3/hidpi-media-query.scss +13 -0
  66. data/spec/fixtures/functions/assign-inputs.scss +19 -0
  67. data/spec/fixtures/functions/contains.scss +28 -0
  68. data/spec/fixtures/functions/is-length.scss +35 -0
  69. data/spec/fixtures/functions/is-light.scss +29 -0
  70. data/spec/fixtures/functions/is-number.scss +31 -0
  71. data/spec/fixtures/functions/is-size.scss +31 -0
  72. data/spec/fixtures/functions/modular-scale.scss +29 -0
  73. data/spec/fixtures/functions/px-to-em.scss +17 -0
  74. data/spec/fixtures/functions/px-to-rem.scss +15 -0
  75. data/spec/fixtures/functions/shade.scss +17 -0
  76. data/spec/fixtures/functions/strip-units.scss +17 -0
  77. data/spec/fixtures/functions/tint.scss +17 -0
  78. data/spec/fixtures/functions/unpack.scss +17 -0
  79. data/spec/fixtures/helpers/convert-units.scss +17 -0
  80. data/spec/fixtures/helpers/directional-values.scss +29 -0
  81. data/spec/fixtures/helpers/font-source-declaration.scss +10 -0
  82. data/spec/fixtures/helpers/str-to-num.scss +13 -0
  83. data/spec/spec_helper.rb +22 -0
  84. data/spec/styler_spec.rb.bak +11 -0
  85. data/spec/support/matchers/be_contained_in.rb +10 -0
  86. data/spec/support/matchers/have_rule.rb +35 -0
  87. data/spec/support/matchers/have_ruleset.rb +20 -0
  88. data/spec/support/matchers/have_value.rb +17 -0
  89. data/spec/support/parser_support.rb +16 -0
  90. data/spec/support/sass_support.rb +10 -0
  91. data/styler.gemspec +10 -5
  92. data/{app/assets/fonts/awesome → vendor/assets/fonts}/FontAwesome.otf +0 -0
  93. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.eot +0 -0
  94. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.svg +0 -0
  95. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.ttf +0 -0
  96. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff +0 -0
  97. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff2 +0 -0
  98. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.eot +0 -0
  99. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.svg +0 -0
  100. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.ttf +0 -0
  101. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff +0 -0
  102. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff2 +0 -0
  103. data/{app → vendor}/assets/javascripts/bootstrap/affix.js +0 -0
  104. data/{app → vendor}/assets/javascripts/bootstrap/alert.js +0 -0
  105. data/{app → vendor}/assets/javascripts/bootstrap/button.js +0 -0
  106. data/{app → vendor}/assets/javascripts/bootstrap/carousel.js +0 -0
  107. data/{app → vendor}/assets/javascripts/bootstrap/collapse.js +0 -0
  108. data/{app → vendor}/assets/javascripts/bootstrap/dropdown.js +0 -0
  109. data/{app → vendor}/assets/javascripts/bootstrap/modal.js +0 -0
  110. data/{app → vendor}/assets/javascripts/bootstrap/popover.js +0 -0
  111. data/{app → vendor}/assets/javascripts/bootstrap/scrollspy.js +0 -0
  112. data/{app → vendor}/assets/javascripts/bootstrap/tab.js +0 -0
  113. data/{app → vendor}/assets/javascripts/bootstrap/tooltip.js +0 -0
  114. data/{app → vendor}/assets/javascripts/bootstrap/transition.js +0 -0
  115. data/{app → vendor}/assets/javascripts/bootstrap-sprockets.js +0 -0
  116. data/{app → vendor}/assets/javascripts/bootstrap.js +0 -0
  117. data/{app → vendor}/assets/javascripts/bootstrap.min.js +0 -0
  118. metadata +198 -36
  119. data/bin/console +0 -14
  120. data/bin/setup +0 -7
@@ -0,0 +1,29 @@
1
+ @import "setup";
2
+
3
+ .one {
4
+ &-base-two {
5
+ font-size: modular-scale(1, $value: 2em);
6
+ }
7
+
8
+ &-base-three {
9
+ font-size: modular-scale(1, $value: 3em);
10
+ }
11
+
12
+ &-double-value {
13
+ font-size: modular-scale(1, $value: 1em 2em);
14
+ }
15
+
16
+ &-golden-ratio {
17
+ font-size: modular-scale(1, $ratio: $golden);
18
+ }
19
+ }
20
+
21
+ .two {
22
+ &-base-one {
23
+ font-size: modular-scale(2, $value: 1em);
24
+ }
25
+
26
+ &-double-value {
27
+ font-size: modular-scale(2, $value: 2em);
28
+ }
29
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .unitless {
4
+ font-size: em(12);
5
+ }
6
+
7
+ .unitless-with-base {
8
+ font-size: em(10, 15);
9
+ }
10
+
11
+ .px {
12
+ font-size: em(16px);
13
+ }
14
+
15
+ .px-with-base {
16
+ font-size: em(15px, 10px);
17
+ }
@@ -0,0 +1,15 @@
1
+ @import "setup";
2
+
3
+ .unitless {
4
+ font-size: rem(12);
5
+ }
6
+
7
+ .px {
8
+ font-size: rem(16px);
9
+ }
10
+
11
+ $em-base: 20px;
12
+
13
+ .px-with-modified-base {
14
+ font-size: rem(20);
15
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .shade-white {
4
+ color: shade(#fff, 75%);
5
+ }
6
+
7
+ .shade-black {
8
+ color: shade(#000, 50%);
9
+ }
10
+
11
+ .shade-red {
12
+ color: shade(#ff0000, 25%);
13
+ }
14
+
15
+ .shade-gray {
16
+ color: shade(#222, 33%);
17
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .px {
4
+ width: strip-units(10px);
5
+ }
6
+
7
+ .em {
8
+ width: strip-units(2em);
9
+ }
10
+
11
+ .rem {
12
+ width: strip-units(1.5rem);
13
+ }
14
+
15
+ .percent {
16
+ width: strip-units(20%);
17
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .tint-white {
4
+ color: tint(#fff, 75%);
5
+ }
6
+
7
+ .tint-black {
8
+ color: tint(#000, 50%);
9
+ }
10
+
11
+ .tint-red {
12
+ color: tint(#ff0000, 25%);
13
+ }
14
+
15
+ .tint-gray {
16
+ color: tint(#aaa, 33%);
17
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .single {
4
+ padding: unpack(10px);
5
+ }
6
+
7
+ .double {
8
+ padding: unpack(1em 2em);
9
+ }
10
+
11
+ .triple {
12
+ padding: unpack(10px 20px 0);
13
+ }
14
+
15
+ .quadruple {
16
+ padding: unpack(0 calc(1em + 10px) 20px 50px);
17
+ }
@@ -0,0 +1,17 @@
1
+ @import "setup";
2
+
3
+ .px {
4
+ height: _convert-units(12, "px");
5
+ }
6
+
7
+ .pt {
8
+ font-size: _convert-units(16, "pt");
9
+ }
10
+
11
+ .deg {
12
+ transform: rotate(_convert-units(180, "deg"));
13
+ }
14
+
15
+ .string {
16
+ padding-top: _convert-units(stringy, "px");
17
+ }
@@ -0,0 +1,29 @@
1
+ @import "setup";
2
+
3
+ .four {
4
+ padding: collapse-directionals(10px 20px 30px 40px);
5
+ }
6
+
7
+ .three {
8
+ padding: collapse-directionals(5px 10px 5px 20px);
9
+ }
10
+
11
+ .two {
12
+ padding: collapse-directionals(50px 100px 50px 100px);
13
+ }
14
+
15
+ .one {
16
+ padding: collapse-directionals(10px 10px 10px 10px);
17
+ }
18
+
19
+ .border-all {
20
+ @include directional-property(border, width, 2px 5px 8px 12px);
21
+ }
22
+
23
+ .border-top {
24
+ @include directional-property(border, top, 10px);
25
+ }
26
+
27
+ .border-color {
28
+ @include directional-property(border, color, #ffffff #000000);
29
+ }
@@ -0,0 +1,10 @@
1
+ @import "setup";
2
+ $file-formats: eot woff2 woff ttf svg;
3
+
4
+ .has-pipeline {
5
+ src: font-source-declaration("a", "b", true, $file-formats, "/c");
6
+ }
7
+
8
+ .no-pipeline {
9
+ src: font-source-declaration("a", "b", false, $file-formats, "/c");
10
+ }
@@ -0,0 +1,13 @@
1
+ @import "setup";
2
+
3
+ .string-to-integer {
4
+ height: _str-to-num("10");
5
+ }
6
+
7
+ .string-to-px {
8
+ height: _str-to-num("15px");
9
+ }
10
+
11
+ .string-to-negative-px {
12
+ height: _str-to-num("-25px");
13
+ }
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require "rspec"
4
+ require "styler"
5
+ require "aruba/api"
6
+ require "css_parser"
7
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
8
+
9
+ RSpec.configure do |config|
10
+ config.include SassSupport
11
+ config.include CssParser
12
+ config.include ParserSupport
13
+ config.include Aruba::Api
14
+
15
+ config.before(:all) do
16
+ generate_css
17
+ end
18
+
19
+ config.after(:all) do
20
+ clean_up
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Styler do
4
+ it 'has a version number' do
5
+ expect(Styler::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ RSpec::Matchers.define :be_contained_in do |expected|
2
+ match do |actual|
3
+ @query = ParserSupport.parser.find_by_selector(actual, expected)
4
+ @query.any?
5
+ end
6
+
7
+ failure_message_for_should do |actual|
8
+ %{expected selector #{actual} to be container in #{expected}}
9
+ end
10
+ end
@@ -0,0 +1,35 @@
1
+ RSpec::Matchers.define :have_rule do |expected|
2
+ match do |selector|
3
+ @rules = rules_from_selector(selector)
4
+ @rules.include? expected
5
+ end
6
+
7
+ failure_message do |selector|
8
+ if @rules.empty?
9
+ %{no CSS for selector #{selector} were found}
10
+ else
11
+ rules = @rules.join("; ")
12
+ %{Expected selector #{selector} to have CSS rule "#{expected}".
13
+ Had "#{rules}".}
14
+ end
15
+ end
16
+
17
+ def rules_from_selector(selector)
18
+ rulesets = ParserSupport.parser.find_by_selector(selector)
19
+ if rulesets.empty?
20
+ []
21
+ else
22
+ rules(rulesets)
23
+ end
24
+ end
25
+
26
+ def rules(rulesets)
27
+ rules = []
28
+ rulesets.map do |ruleset|
29
+ ruleset.split(";").each do |rule|
30
+ rules << rule.strip
31
+ end
32
+ end
33
+ rules
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ RSpec::Matchers.define :have_ruleset do |expected|
2
+ match do |selector|
3
+ @ruleset = rules_from_selector(selector)
4
+ @ruleset.join("; ") == expected
5
+ end
6
+
7
+ failure_message do |selector|
8
+ if @ruleset.empty?
9
+ %{no CSS for selector #{selector} were found}
10
+ else
11
+ ruleset = @ruleset.join("; ")
12
+ %{Expected selector #{selector} to have CSS rule "#{expected}".
13
+ Had "#{ruleset}".}
14
+ end
15
+ end
16
+
17
+ def rules_from_selector(selector)
18
+ ParserSupport.parser.find_by_selector(selector)
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ RSpec::Matchers.define :have_value do |expected|
2
+ match do |variable|
3
+ selector_class = variable.sub("$", ".")
4
+ @value_attribute = ParserSupport.parser.find_by_selector(selector_class)[0]
5
+
6
+ unless @value_attribute.nil?
7
+ actual_value = @value_attribute.split(":")[1].strip.sub(";", "")
8
+ actual_value == expected
9
+ end
10
+ end
11
+
12
+ failure_message_for_should do |variable_name|
13
+ value_attribute = @value_attribute.to_s
14
+ %{Expected variable #{variable_name} to have value "#{expected}".
15
+ Had "#{value_attribute}".}
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ module ParserSupport
2
+ def self.parser
3
+ @parser ||= CssParser::Parser.new
4
+ end
5
+
6
+ def self.parse_file(identifier)
7
+ parser.load_file!("tmp/#{identifier}.css")
8
+ end
9
+
10
+ def self.show_contents(identifier)
11
+ css_file_contents = File.open("tmp/#{identifier}.css").read
12
+ css_file_contents.each_line do |line|
13
+ puts line
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module SassSupport
2
+ def generate_css
3
+ _mkdir("tmp")
4
+ `sass -I . --update spec/fixtures:tmp --quiet`
5
+ end
6
+
7
+ def clean_up
8
+ FileUtils.rm_rf("tmp")
9
+ end
10
+ end
data/styler.gemspec CHANGED
@@ -1,6 +1,8 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
+ #lib = File.expand_path('../lib', __FILE__)
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+
5
+ #$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'styler/version'
5
7
 
6
8
  Gem::Specification.new do |spec|
@@ -22,10 +24,13 @@ Gem::Specification.new do |spec|
22
24
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
25
  end
24
26
 
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.files = `git ls-files`.split("\n")
28
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ spec.bindir = "bin"
30
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
28
31
  spec.require_paths = ["lib"]
32
+ #spec.executables = "styler"
33
+ #spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
34
 
30
35
  spec.add_development_dependency "bundler", "~> 1.10"
31
36
  spec.add_development_dependency "rake", "~> 10.0"
File without changes
File without changes
File without changes