From cc640c678e5d0b31d91e59d955722a59e8a6b42a Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 15 Oct 2013 12:30:35 -0400 Subject: [PATCH 01/22] Adds section for extensions --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index e835212..b829e1c 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,13 @@ LESS requires an additional javascript runtime. rubies, and [therubyrhino](https://rubygems.org/gems/therubyrhino) on jruby. +## Are there any community extensions? ## + +* [compass-csscss](https://github.com/Comcast/compass-csscss) integrates csscss with compass projects. +* [grunt-csscss](https://github.com/peterkeating/grunt-csscss) a [grunt](http://gruntjs.com/) task to automatically run csscss. + +_Please submit [an issue](https://github.com/zmoazeni/csscss/issues/new) if you know of any others._ + ## Why doesn't csscss automatically remove duplications for me? ## I have been asked this a lot, but csscss is intentionally designed this From 69118a8e6499ba1d60a8dfc8d15c78d03e6cf741 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 15 Oct 2013 12:33:05 -0400 Subject: [PATCH 02/22] Link to compass --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b829e1c..4e51efb 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ jruby. ## Are there any community extensions? ## -* [compass-csscss](https://github.com/Comcast/compass-csscss) integrates csscss with compass projects. +* [compass-csscss](https://github.com/Comcast/compass-csscss) integrates csscss with [compass](http://compass-style.org/) projects. * [grunt-csscss](https://github.com/peterkeating/grunt-csscss) a [grunt](http://gruntjs.com/) task to automatically run csscss. _Please submit [an issue](https://github.com/zmoazeni/csscss/issues/new) if you know of any others._ From f34468d0eb19004f7ac423bdaa82fcc02ceadfe3 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:08:31 -0400 Subject: [PATCH 03/22] Use v2.1.2 for dev --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 95a5ad2..ec6b00f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.0.0-p195 +ruby-2.1.2 From acd9093ad94fbfdc42596760a2813c6e4588f978 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:10:23 -0400 Subject: [PATCH 04/22] Dump debugger for byebug --- Gemfile | 20 ++++++++++---------- Gemfile.lock | 12 +++++------- test/just_parse.rb | 2 +- test/test_helper.rb | 12 ++++++------ 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index 46e2ea9..f34d154 100644 --- a/Gemfile +++ b/Gemfile @@ -4,16 +4,16 @@ source 'https://rubygems.org' gemspec # optional runtime dependencies -gem "sass" -gem "compass" -gem "less" -gem "therubyracer", :platform => :mri +gem 'sass' +gem 'compass' +gem 'less' +gem 'therubyracer', :platform => :mri -gem "rake", :require => false -gem "debugger" +gem 'rake', :require => false +gem 'byebug' -gem "minitest" -gem "m" -gem "minitest-rg" +gem 'minitest' +gem 'm' +gem 'minitest-rg' -gem "ruby-prof" +gem 'ruby-prof' diff --git a/Gemfile.lock b/Gemfile.lock index 62004dd..a790aad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,20 +9,18 @@ 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.5.8) - columnize (0.3.6) + columnize (0.8.9) commonjs (0.2.6) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) - debugger (1.6.0) - columnize (>= 0.3.1) - debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.2.1) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.2.2) fssm (0.2.10) less (2.3.1) commonjs (~> 0.2.6) @@ -47,9 +45,9 @@ PLATFORMS ruby DEPENDENCIES + byebug compass csscss! - debugger less m minitest diff --git a/test/just_parse.rb b/test/just_parse.rb index ef9f1f6..47c7249 100644 --- a/test/just_parse.rb +++ b/test/just_parse.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require "debugger" +require "byebug" require "csscss" raise "need a file name" unless ARGV[0] diff --git a/test/test_helper.rb b/test/test_helper.rb index d0c7ea5..4679d7a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,11 +1,11 @@ -require "rubygems" -require "bundler/setup" +require 'rubygems' +require 'bundler/setup' -require "minitest/autorun" -require "minitest/rg" -require "debugger" +require 'minitest/autorun' +require 'minitest/rg' +require 'byebug' -require "csscss" +require 'csscss' module TypeHelpers def sel(s) From e838aafa8aceb608bc48865363f7f94b49be4da8 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:18:28 -0400 Subject: [PATCH 05/22] Upgrade parslet to at least v1.6.1 It includes the optimization fixes so we don't need to monkey patch it anymore v1.6.1 and my optimization monkey patch do not play well with each other, so lets use at least v1.6.1 and dump it --- Gemfile.lock | 6 +-- csscss.gemspec | 2 +- lib/csscss.rb | 1 - lib/csscss/parslet_optimizations.rb | 77 ----------------------------- 4 files changed, 4 insertions(+), 82 deletions(-) delete mode 100644 lib/csscss/parslet_optimizations.rb diff --git a/Gemfile.lock b/Gemfile.lock index a790aad..9b33215 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: csscss (1.3.2) colorize - parslet (~> 1.5) + parslet (>= 1.6.1, < 2.0) GEM remote: https://rubygems.org/ @@ -13,7 +13,7 @@ GEM columnize (~> 0.8) debugger-linecache (~> 1.2) chunky_png (1.2.7) - colorize (0.5.8) + colorize (0.7.3) columnize (0.8.9) commonjs (0.2.6) compass (0.12.2) @@ -31,7 +31,7 @@ GEM method_source (0.8.1) minitest (2.12.1) minitest-rg (1.1.0) - parslet (1.5.0) + parslet (1.6.1) blankslate (~> 2.0) rake (10.0.3) ref (1.0.4) diff --git a/csscss.gemspec b/csscss.gemspec index 07a2f31..85304e8 100644 --- a/csscss.gemspec +++ b/csscss.gemspec @@ -19,6 +19,6 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 1.9" - gem.add_dependency "parslet", "~> 1.5" + gem.add_dependency "parslet", ">= 1.6.1", "< 2.0" gem.add_dependency "colorize" end diff --git a/lib/csscss.rb b/lib/csscss.rb index 29076ff..62f3d42 100644 --- a/lib/csscss.rb +++ b/lib/csscss.rb @@ -5,7 +5,6 @@ require "colorize" require "parslet" -require "csscss/parslet_optimizations" require "csscss/version" require "csscss/cli" diff --git a/lib/csscss/parslet_optimizations.rb b/lib/csscss/parslet_optimizations.rb deleted file mode 100644 index 32b7130..0000000 --- a/lib/csscss/parslet_optimizations.rb +++ /dev/null @@ -1,77 +0,0 @@ -# These are my multibyte optimizations for parslet. -# More information can be found: -# https://github.com/kschiess/parslet/issues/73 -# https://github.com/kschiess/parslet/pull/74 -# https://github.com/zmoazeni/parslet/tree/optimized-multibyte-parsing - -require 'strscan' -require 'forwardable' - -module Parslet - class Source - extend Forwardable - - def initialize(str) - raise ArgumentError unless str.respond_to?(:to_str) - - @str = StringScanner.new(str) - - @line_cache = LineCache.new - @line_cache.scan_for_line_endings(0, str) - end - - def matches?(pattern) - regexp = pattern.is_a?(String) ? Regexp.new(Regexp.escape(pattern)) : pattern - !@str.match?(regexp).nil? - end - alias match matches? - - def consume(n) - original_pos = @str.pos - slice_str = n.times.map { @str.getch }.join - slice = Parslet::Slice.new( - slice_str, - original_pos, - @line_cache) - - return slice - end - - def chars_left - @str.rest_size - end - - def_delegator :@str, :pos - def pos=(n) - if n > @str.string.bytesize - @str.pos = @str.string.bytesize - else - @str.pos = n - end - end - - - class LineCache - def scan_for_line_endings(start_pos, buf) - return unless buf - - buf = StringScanner.new(buf) - return unless buf.exist?(/\n/) - - ## If we have already read part or all of buf, we already know about - ## line ends in that portion. remove it and correct cur (search index) - if @last_line_end && start_pos < @last_line_end - # Let's not search the range from start_pos to last_line_end again. - buf.pos = @last_line_end - start_pos - end - - ## Scan the string for line endings; store the positions of all endings - ## in @line_ends. - while buf.skip_until(/\n/) - @last_line_end = start_pos + buf.pos - @line_ends << @last_line_end - end - end - end - end -end From affde6e9f6ce5b062c3b04de7eee0ab6943f65e0 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:35:24 -0400 Subject: [PATCH 06/22] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f85cf..4ee940b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## (unreleased) + +* Upgrades parslet dependency to v1.6.1 and drops optimization monkeypatch + ## 1.3.2 - 6/22/2013 ## * Fixes attribute parsing bug that includes comments with braces From 0630d341252dd4e576151f7fa228432655ab92f8 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:39:43 -0400 Subject: [PATCH 07/22] Use correct terminology --- CHANGELOG.md | 1 + lib/csscss/reporter.rb | 2 +- test/csscss/reporter_test.rb | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee940b..39e3e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## (unreleased) * Upgrades parslet dependency to v1.6.1 and drops optimization monkeypatch +* Use correct terminology "declartions" instead of "rules" in the output ## 1.3.2 - 6/22/2013 ## diff --git a/lib/csscss/reporter.rb b/lib/csscss/reporter.rb index 8509872..96f428c 100644 --- a/lib/csscss/reporter.rb +++ b/lib/csscss/reporter.rb @@ -13,7 +13,7 @@ def report(options = {}) selector_groups = selector_groups.map {|selectors| "{#{maybe_color(selectors, :red, should_color)}}" } last_selector = selector_groups.pop count = declarations.size - io.puts %Q(#{selector_groups.join(", ")} AND #{last_selector} share #{maybe_color(count, :red, should_color)} rule#{"s" if count > 1}) + io.puts %Q(#{selector_groups.join(", ")} AND #{last_selector} share #{maybe_color(count, :red, should_color)} declaration#{"s" if count > 1}) if verbose declarations.each {|dec| io.puts(" - #{maybe_color(dec, :yellow, should_color)}") } end diff --git a/test/csscss/reporter_test.rb b/test/csscss/reporter_test.rb index 17d3607..eb8fcbf 100644 --- a/test/csscss/reporter_test.rb +++ b/test/csscss/reporter_test.rb @@ -12,19 +12,19 @@ module Csscss }) expected =<<-EXPECTED -{.foo} AND {.bar} share 2 rules -{h1, h2}, {.foo} AND {.baz} share 1 rule -{h1, h2} AND {.bar} share 1 rule +{.foo} AND {.bar} share 2 declarations +{h1, h2}, {.foo} AND {.baz} share 1 declaration +{h1, h2} AND {.bar} share 1 declaration EXPECTED reporter.report(color:false).must_equal expected expected =<<-EXPECTED -{.foo} AND {.bar} share 2 rules +{.foo} AND {.bar} share 2 declarations - width: 1px - border: black -{h1, h2}, {.foo} AND {.baz} share 1 rule +{h1, h2}, {.foo} AND {.baz} share 1 declaration - display: none -{h1, h2} AND {.bar} share 1 rule +{h1, h2} AND {.bar} share 1 declaration - position: relative EXPECTED reporter.report(verbose:true, color:false).must_equal expected From 10248693b620b366a716318a037a30c3d7e0903c Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:40:34 -0400 Subject: [PATCH 08/22] Bump version for release --- CHANGELOG.md | 2 +- Gemfile.lock | 2 +- lib/csscss/version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e3e4f..024f5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## (unreleased) +## 1.3.3 - 5/30/2014 ## * Upgrades parslet dependency to v1.6.1 and drops optimization monkeypatch * Use correct terminology "declartions" instead of "rules" in the output diff --git a/Gemfile.lock b/Gemfile.lock index 9b33215..ded9c99 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - csscss (1.3.2) + csscss (1.3.3) colorize parslet (>= 1.6.1, < 2.0) diff --git a/lib/csscss/version.rb b/lib/csscss/version.rb index aec9959..7623093 100644 --- a/lib/csscss/version.rb +++ b/lib/csscss/version.rb @@ -1,3 +1,3 @@ module Csscss - VERSION = "1.3.2" + VERSION = "1.3.3" end From f6059f3d0728ff639ef283f4de3798795f392e06 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:41:14 -0400 Subject: [PATCH 09/22] Test against 2.1.2 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 222078e..7f4a405 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,4 @@ language: ruby rvm: - 1.9.3 - 2.0.0 + - 2.1.2 From d88a744f328dea516be0bfbca22ff3851c0b9c23 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 30 May 2014 20:42:03 -0400 Subject: [PATCH 10/22] Stop testing against 1.9.3 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7f4a405..4d1ff2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: ruby rvm: - - 1.9.3 - 2.0.0 - 2.1.2 From 691fe8aceb6e49c7c401fb709a5bedf177b35728 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Fri, 29 Aug 2014 15:50:07 -0400 Subject: [PATCH 11/22] Adds gulp to the list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4e51efb..5367f7e 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ jruby. * [compass-csscss](https://github.com/Comcast/compass-csscss) integrates csscss with [compass](http://compass-style.org/) projects. * [grunt-csscss](https://github.com/peterkeating/grunt-csscss) a [grunt](http://gruntjs.com/) task to automatically run csscss. +* [gulp-csscss](https://www.npmjs.org/package/gulp-csscss/) a [gulp](http://gulpjs.com/) task to automatically run csscss. _Please submit [an issue](https://github.com/zmoazeni/csscss/issues/new) if you know of any others._ From 6d2ac0301335412249c590418dadadae58923a20 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Mon, 26 Nov 2018 14:26:37 -0500 Subject: [PATCH 12/22] A couple Readme tweaks --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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: From 00664a60fcf90646820af13cdee4b609aed2a08d Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Mon, 26 Nov 2018 18:32:23 -0500 Subject: [PATCH 13/22] Relocking the dependencies --- Gemfile.lock | 54 +++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) 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 From 414f7c759a5f54639f14994c8232161e92c9bc96 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Mon, 26 Nov 2018 18:32:56 -0500 Subject: [PATCH 14/22] Fixes test --- test/csscss/sass_include_extensions_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b8b03c35576eb0e409845d8ecd317abcd2a0e7aa Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Mon, 26 Nov 2018 18:35:52 -0500 Subject: [PATCH 15/22] Bump version file --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 37e5e331a4b465ba433a9e4ae1515b8cbe43bc25 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 09:53:49 -0500 Subject: [PATCH 16/22] Use best practice when declaring structs --- lib/csscss/types.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/csscss/types.rb b/lib/csscss/types.rb index 32afd3a..976475b 100644 --- a/lib/csscss/types.rb +++ b/lib/csscss/types.rb @@ -1,5 +1,5 @@ module Csscss - class Declaration < Struct.new(:property, :value, :parents) + Declaration = Struct.new(:property, :value, :parents) do def self.from_csspool(dec) new(dec.property.to_s.downcase, dec.expressions.join(" ").downcase) end @@ -79,7 +79,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 +97,5 @@ def inspect end end - class Ruleset < Struct.new(:selectors, :declarations) - end + Ruleset = Struct.new(:selectors, :declarations) end From 97c0941966434e407e51a9d62ef7c3046e96c733 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 09:58:03 -0500 Subject: [PATCH 17/22] Add docker-ruby command --- docker-ruby | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 docker-ruby diff --git a/docker-ruby b/docker-ruby new file mode 100755 index 0000000..9c06fbd --- /dev/null +++ b/docker-ruby @@ -0,0 +1,2 @@ +#!/bin/bash +docker run -it --rm -v $(pwd):/app -v csscss_gem_data:/usr/local/bundle -w /app ruby $@ From 709fb6aeed31b46177d25adb5aa4f5bc99edd91c Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 09:58:55 -0500 Subject: [PATCH 18/22] Remove unnecessary method --- lib/csscss/types.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/csscss/types.rb b/lib/csscss/types.rb index 976475b..3d01f4d 100644 --- a/lib/csscss/types.rb +++ b/lib/csscss/types.rb @@ -1,9 +1,5 @@ module Csscss Declaration = Struct.new(:property, :value, :parents) do - def self.from_csspool(dec) - new(dec.property.to_s.downcase, dec.expressions.join(" ").downcase) - end - def self.from_parser(property, value, clean = true) value = value.to_s property = property.to_s From a0c0e7e964315c521de7946e2e9f10e876357e9f Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 10:04:01 -0500 Subject: [PATCH 19/22] Use latest ruby version --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d1ff2e..b7360ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ language: ruby rvm: - - 2.0.0 - - 2.1.2 + - 2.5 From 9a503419e895039457c7194e99cfaf720c698c65 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 10:09:07 -0500 Subject: [PATCH 20/22] Allow docker version to be changed Also test other versions in travis --- .travis.yml | 2 ++ docker-ruby | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b7360ae..9323019 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ language: ruby rvm: - 2.5 + - 2.4 + - 2.3 diff --git a/docker-ruby b/docker-ruby index 9c06fbd..33ea97f 100755 --- a/docker-ruby +++ b/docker-ruby @@ -1,2 +1,3 @@ #!/bin/bash -docker run -it --rm -v $(pwd):/app -v csscss_gem_data:/usr/local/bundle -w /app ruby $@ +VERSION=${VERSION:-latest} +docker run -it --rm -v $(pwd):/app -v csscss_gem_data:/usr/local/bundle -w /app ruby:$VERSION $@ From 01eb85320eda32ee4d9e77614d80bb11be45e835 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 10:11:14 -0500 Subject: [PATCH 21/22] Fixes warning about shadowing --- lib/csscss/cli.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) From bac3e424b2deddbeade08677b9958533c52828e6 Mon Sep 17 00:00:00 2001 From: Zach Moazeni Date: Tue, 27 Nov 2018 12:45:07 -0500 Subject: [PATCH 22/22] Ignore vscode settings --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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