diff --git a/.gitignore b/.gitignore index 4288db2..fd69015 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ test/tmp test/version_tmp tmp _site +.vscode diff --git a/.ruby-version b/.ruby-version index ec6b00f..73462a5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.1.2 +2.5.1 diff --git a/.travis.yml b/.travis.yml index 4d1ff2e..9323019 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby rvm: - - 2.0.0 - - 2.1.2 + - 2.5 + - 2.4 + - 2.3 diff --git a/Gemfile.lock b/Gemfile.lock index ded9c99..33ae5c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,37 +8,40 @@ PATH GEM remote: https://rubygems.org/ specs: - blankslate (2.1.2.4) - byebug (3.1.2) - columnize (~> 0.8) - debugger-linecache (~> 1.2) - chunky_png (1.2.7) - colorize (0.7.3) - columnize (0.8.9) - commonjs (0.2.6) + byebug (10.0.2) + chunky_png (1.3.11) + colorize (0.8.1) + commonjs (0.2.7) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) - debugger-linecache (1.2.0) + ffi (1.9.25) fssm (0.2.10) - less (2.3.1) - commonjs (~> 0.2.6) - libv8 (3.11.8.17) - m (1.3.1) + less (2.6.0) + commonjs (~> 0.2.7) + libv8 (3.16.14.19) + m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) - method_source (0.8.1) - minitest (2.12.1) - minitest-rg (1.1.0) - parslet (1.6.1) - blankslate (~> 2.0) - rake (10.0.3) - ref (1.0.4) - ruby-prof (0.13.0) - sass (3.2.7) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) + method_source (0.9.2) + minitest (5.11.3) + minitest-rg (5.2.0) + minitest (~> 5.0) + parslet (1.8.2) + rake (12.3.1) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + ref (2.0.0) + ruby-prof (0.17.0) + sass (3.7.2) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) ref PLATFORMS @@ -56,3 +59,6 @@ DEPENDENCIES ruby-prof sass therubyracer + +BUNDLED WITH + 1.16.4 diff --git a/README.md b/README.md index 5367f7e..ea7df7d 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ _Please submit [an issue](https://github.com/zmoazeni/csscss/issues/new) if you I have been asked this a lot, but csscss is intentionally designed this way. Check out [this -post](http://connectionrequired.com/blog/2013/04/why-csscss-doesnt-remove-duplication-for-you/) +post](https://connectionrequired.com/blog/2013/04/why-csscss-doesnt-remove-duplication-for-you) for my reasoning. ## I found bugs ## @@ -87,12 +87,6 @@ If you find any issues, please report them on Please include the smallest CSS snippet to describe the issue and the output you expect to see. -## Who are you? ## - -My name is [Zach Moazeni](https://twitter.com/zmoazeni). I work for [an -awesome company](http://www.getharvest.com/). And [we're -hiring!](http://www.getharvest.com/careers) - ## I'm a dev, I can help ## Awesome! Thanks! Here are the steps I ask: diff --git a/docker-ruby b/docker-ruby new file mode 100755 index 0000000..33ea97f --- /dev/null +++ b/docker-ruby @@ -0,0 +1,3 @@ +#!/bin/bash +VERSION=${VERSION:-latest} +docker run -it --rm -v $(pwd):/app -v csscss_gem_data:/usr/local/bundle -w /app ruby:$VERSION $@ diff --git a/lib/csscss/cli.rb b/lib/csscss/cli.rb index 0adec9e..2b8430d 100644 --- a/lib/csscss/cli.rb +++ b/lib/csscss/cli.rb @@ -64,7 +64,7 @@ def execute end def parse(argv) - opts = OptionParser.new do |opts| + options = OptionParser.new do |opts| opts.banner = "Usage: csscss [files..]" opts.version = Csscss::VERSION @@ -128,11 +128,11 @@ def parse(argv) print_help(opts) end end - opts.parse!(argv) + options.parse!(argv) - print_help(opts) if argv.empty? + print_help(options) if argv.empty? rescue OptionParser::ParseError - print_help(opts) + print_help(options) end def print_help(opts) diff --git a/lib/csscss/types.rb b/lib/csscss/types.rb index 32afd3a..3d01f4d 100644 --- a/lib/csscss/types.rb +++ b/lib/csscss/types.rb @@ -1,9 +1,5 @@ module Csscss - class Declaration < Struct.new(:property, :value, :parents) - def self.from_csspool(dec) - new(dec.property.to_s.downcase, dec.expressions.join(" ").downcase) - end - + Declaration = Struct.new(:property, :value, :parents) do def self.from_parser(property, value, clean = true) value = value.to_s property = property.to_s @@ -79,7 +75,7 @@ def normalize_value(value) end end - class Selector < Struct.new(:selectors) + Selector = Struct.new(:selectors) do def self.from_parser(selectors) new(selectors.to_s.strip) end @@ -97,6 +93,5 @@ def inspect end end - class Ruleset < Struct.new(:selectors, :declarations) - end + Ruleset = Struct.new(:selectors, :declarations) end diff --git a/test/csscss/sass_include_extensions_test.rb b/test/csscss/sass_include_extensions_test.rb index 76ace2e..13f0ea8 100644 --- a/test/csscss/sass_include_extensions_test.rb +++ b/test/csscss/sass_include_extensions_test.rb @@ -61,7 +61,7 @@ module Csscss /* CSSCSS END MIXIN: foo */ } CSS - Sass::Engine.new("@import '#{f.path}'", syntax: :scss, cache: false).render.must_equal(css) + Sass::Engine.new("@import '#{File.basename(f.path)}'", syntax: :scss, cache: false, load_paths: ["/tmp"]).render.must_equal(css) end end end