compass-csscss 0.0.1

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 (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/compass-csscss.rb +206 -0
  3. metadata +76 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmE0N2U1MzFkNmU1MzdiZDc1NTRjNWQ0MTIwMzVmODNmYzAxYzA3Yw==
5
+ data.tar.gz: !binary |-
6
+ OTc1NmUwOTgxMDUzY2JkYjRkNzM5Zjk1ZDE0YTIyNzBhNTc0NmZjYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YzE4YzlhYzRlZmY1NTA0NmE5ZDUzY2JjZTE5OTUzNmZjOTg5YzUxM2YzZWFk
10
+ Y2QzOTgwNjY2NmUzMTdkMWI1YzZjZjA5MGEzZjU3MDdlNjNjMzA3ZWMxNjY2
11
+ Y2JhMzNmMzU2OTE5ODY2MmNiOTgyYzQzMjIzMDFiZjA4MGI5Njk=
12
+ data.tar.gz: !binary |-
13
+ NGE1NDYzYzlmYWFhNmZkMWIyMzUxZGE2ZjEwYzZiY2Q3N2ExZGZlODRkMjcz
14
+ ZjQ5YjYxODIyNWU3OTNhNzE5ZDI0ZGY4ZTllM2Q0Mjk0MGE2OTJlN2I3ZWIw
15
+ NWRjZTM1ZDgxMDUyOWZiZjFhYjBhZjc2ZDZjNWM4MDcwOTU3MDk=
@@ -0,0 +1,206 @@
1
+ require 'compass'
2
+ require 'compass/commands/registry'
3
+ require 'compass/commands/project_base'
4
+ require 'compass/commands/update_project'
5
+
6
+ module Compass
7
+ module Commands
8
+ module CsscssOptionsParser
9
+ def set_options(opts)
10
+ opts.banner = %Q{
11
+ Usage: compass csscss [options]* [path/to/project]*
12
+
13
+ Description:
14
+ Compile project at the path specified or the current
15
+ directory if not specified and then run csscss
16
+ against the generated CSS.
17
+
18
+ Options:
19
+ }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n")
20
+
21
+ opts.on("-v", "--[no-]verbose", "Display each rule") do |verbose|
22
+ self.options[:verbose] = verbose
23
+ end
24
+
25
+ opts.on("--[no-]color", "Colorize output", "(default is true)") do |color|
26
+ self.options[:color] = color
27
+ end
28
+
29
+ opts.on("-n", "--num N", "Print matches with at least this many rules.", "(default is 3)") do |num|
30
+ self.options[:num] = num
31
+ end
32
+
33
+ opts.on("--[no-]match-shorthand", "Expand shorthand rules and matches on explicit rules", "(default is true)") do |match_shorthand|
34
+ self.options[:match_shorthand] = match_shorthand
35
+ end
36
+
37
+ opts.on("-j", "--[no-]json", "Output results in JSON") do |json|
38
+ self.options[:json] = json
39
+ end
40
+
41
+ opts.on("-S", "--src", "--sass", "--scss", "Parse your sass/scss source files instead of your generated CSS") do |sass|
42
+ self.options[:sass] = sass
43
+ end
44
+
45
+ opts.on("--ignore-sass-mixins", "EXPERIMENTAL: Ignore matches that come from including sass/scss mixins",
46
+ "This is an experimental feature and may not be included in future releases",
47
+ "(default is false)") do |ignore_sass_mixins|
48
+ self.options[:ignore_sass_mixins] = ignore_sass_mixins
49
+ end
50
+
51
+ opts.on("--require file.rb", "Load ruby file before running csscss.", "Great for bootstrapping requires/configurations") do |file|
52
+ self.options[:file] = file
53
+ end
54
+
55
+ opts.on("--ignore-properties property1,property2,...", "Ignore these properties when finding matches") do |ignored_properties|
56
+ self.options[:ignored_properties] = ignored_properties
57
+ end
58
+
59
+ opts.on('--ignore-selectors "selector1","selector2",...', "Ignore these selectors when finding matches") do |ignored_selectors|
60
+ self.options[:ignored_selectors] = ignored_selectors
61
+ end
62
+
63
+ opts.on("--show-parser-errors", "Print verbose parser errors") do |show_parser_errors|
64
+ self.options[:show_parser_errors] = show_parser_errors
65
+ end
66
+
67
+ opts.on("-V", "--version", "Show version of csscss") do
68
+ self.options[:version] = true
69
+ self.options[:nocompile] = true
70
+ end
71
+
72
+ opts.on("-?", "-h", "--help", "Show this message\n\n") do
73
+ puts opts
74
+ exit
75
+ end
76
+
77
+ super
78
+ end
79
+ end
80
+ class CsscssProject < ProjectBase
81
+
82
+ require 'csscss'
83
+ include Csscss
84
+
85
+ register :csscss
86
+
87
+ def initialize(working_path, options)
88
+ super
89
+ assert_project_directory_exists!
90
+ end
91
+
92
+ def perform
93
+ @args = []
94
+
95
+ if !options[:verbose].nil?
96
+ @args << '--' + (options[:verbose] ? '' : 'no-') + 'verbose'
97
+ end
98
+
99
+ if !options[:color].nil?
100
+ @args << '--' + (options[:color] ? '' : 'no-') + 'color'
101
+ end
102
+
103
+ if options[:num]
104
+ @args << '--num'
105
+ @args << options[:num]
106
+ end
107
+
108
+ if !options[:match_shorthand].nil?
109
+ @args << '--' + (options[:match_shorthand] ? '' : 'no-') + 'match-shorthand'
110
+ end
111
+
112
+ if !options[:json].nil?
113
+ @args << '--' + (options[:json] ? '' : 'no-') + 'json'
114
+ end
115
+
116
+ if options[:ignore_sass_mixins]
117
+ @args << '--ignore-sass-mixins'
118
+ end
119
+
120
+ if options[:file]
121
+ @args << '--require'
122
+ @args << options[:file]
123
+ end
124
+
125
+ if options[:ignored_properties]
126
+ @args << '--ignore-properties'
127
+ @args << options[:ignored_properties]
128
+ end
129
+
130
+ if options[:ignored_selectors]
131
+ @args << '--ignore-selectors'
132
+ @args << options[:ignored_selectors]
133
+ end
134
+
135
+ if options[:show_parser_errors]
136
+ @args << '--show-parser-errors'
137
+ end
138
+
139
+ if options[:version]
140
+ @args << '--version'
141
+ end
142
+
143
+ if not(options[:nocompile] || options[:sass])
144
+ UpdateProject.new(working_path, options).perform
145
+ end
146
+
147
+ Dir.chdir Compass.configuration.project_path do
148
+
149
+ if options[:sass]
150
+
151
+ if Compass.configuration.inherited_data.name.nil?
152
+ @args << '--compass'
153
+ else
154
+ @args << '--compass-with-config'
155
+ @args << Compass.configuration.inherited_data.name
156
+ end
157
+
158
+ @args << Dir.glob(project_src_subdirectory+"/**/*.s{a,c}ss")
159
+
160
+ elsif not(options[:nocompile])
161
+
162
+ @args << Dir.glob(project_css_subdirectory+"/**/*.css")
163
+
164
+ end
165
+
166
+ Csscss::CLI.run(@args.flatten)
167
+
168
+ end
169
+ end
170
+
171
+ class << self
172
+
173
+ def option_parser(arguments)
174
+ parser = Compass::Exec::CommandOptionParser.new(arguments)
175
+ parser.extend(Compass::Exec::ProjectOptionsParser)
176
+ parser.extend(CsscssOptionsParser)
177
+ end
178
+
179
+ def usage
180
+ option_parser([]).to_s
181
+ end
182
+
183
+ def description(command)
184
+ "Run csscss against your sass or generated css."
185
+ end
186
+
187
+ def parse!(arguments)
188
+ parser = option_parser(arguments)
189
+ parser.parse!
190
+ parse_arguments!(parser, arguments)
191
+ parser.options
192
+ end
193
+
194
+ def parse_arguments!(parser, arguments)
195
+ if arguments.size == 1
196
+ parser.options[:project_name] = arguments.shift
197
+ elsif arguments.size == 0
198
+ # default to the current directory.
199
+ else
200
+ raise Compass::Error, "Too many arguments were specified."
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-csscss
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Riviello
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: compass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: csscss
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Easily integrate csscss into your projects that use the Compass CSS Framework
42
+ email:
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ./lib/compass-csscss.rb
48
+ homepage: https://github.com/Comcast/compass-csscss
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message: ! "---------------------------------------------------------------------------------------------------\n
53
+ \ Thank you for installing csscss for Sass & Compass!\n Please note there is
54
+ currently a bug in Compass that prevents this from working out of the box.\n A
55
+ custom version of Compass is required to run this & other command line extensions.\n
56
+ \ See https://github.com/Comcast/compass-csscss for further details.\n---------------------------------------------------------------------------------------------------\n"
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.0.3
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Runs csscss against the CSS that Sass/Compass generates
76
+ test_files: []