bsherman-compass 0.5.2
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.
- data/Manifest +178 -0
- data/README.markdown +17 -0
- data/Rakefile +98 -0
- data/VERSION +1 -0
- data/bin/compass +8 -0
- data/compass.gemspec +37 -0
- data/examples/blueprint_default/index.html +73 -0
- data/examples/blueprint_default/parts/elements.html +246 -0
- data/examples/blueprint_default/parts/forms.html +100 -0
- data/examples/blueprint_default/parts/grid.html +206 -0
- data/examples/blueprint_default/parts/test-small.jpg +0 -0
- data/examples/blueprint_default/parts/test.jpg +0 -0
- data/examples/blueprint_default/parts/valid.png +0 -0
- data/examples/blueprint_plugins/index.html +60 -0
- data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
- data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
- data/examples/blueprint_plugins/parts/test.jpg +0 -0
- data/examples/blueprint_plugins/parts/valid.png +0 -0
- data/examples/blueprint_semantic/index.html +68 -0
- data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
- data/examples/blueprint_semantic/parts/liquid.html +84 -0
- data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
- data/examples/blueprint_semantic/parts/test.jpg +0 -0
- data/examples/blueprint_semantic/parts/valid.png +0 -0
- data/examples/compass/compass.html +19 -0
- data/examples/compass/sticky_footer.html.haml +14 -0
- data/examples/compass/utilities.html.haml +141 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/index.html.haml +19 -0
- data/examples/yui/sub_divisions.html.haml +169 -0
- data/examples/yui/templates.html.haml +54 -0
- data/examples/yui/test.jpg +0 -0
- data/examples/yui/typography.html.haml +132 -0
- data/frameworks/blueprint.rb +2 -0
- data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
- data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
- data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +49 -0
- data/frameworks/blueprint/stylesheets/blueprint/_print.sass +82 -0
- data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +30 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +81 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +141 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +137 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +46 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +154 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +3 -0
- data/frameworks/blueprint/templates/project/manifest.rb +5 -0
- data/frameworks/blueprint/templates/project/print.sass +3 -0
- data/frameworks/blueprint/templates/project/screen.sass +8 -0
- data/frameworks/compass.rb +2 -0
- data/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
- data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +56 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
- data/frameworks/compass/templates/project/ie.sass +6 -0
- data/frameworks/compass/templates/project/manifest.rb +3 -0
- data/frameworks/compass/templates/project/print.sass +6 -0
- data/frameworks/compass/templates/project/screen.sass +7 -0
- data/frameworks/yui.rb +2 -0
- data/frameworks/yui/COPYRIGHT +15 -0
- data/frameworks/yui/stylesheets/_yui.sass +7 -0
- data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
- data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
- data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
- data/frameworks/yui/templates/project/manifest.rb +1 -0
- data/frameworks/yui/templates/project/screen.sass +4 -0
- data/lib/compass.rb +39 -0
- data/lib/compass/actions.rb +92 -0
- data/lib/compass/commands/base.rb +29 -0
- data/lib/compass/commands/create_project.rb +41 -0
- data/lib/compass/commands/list_frameworks.rb +16 -0
- data/lib/compass/commands/print_version.rb +23 -0
- data/lib/compass/commands/project_base.rb +82 -0
- data/lib/compass/commands/update_project.rb +25 -0
- data/lib/compass/commands/watch_project.rb +53 -0
- data/lib/compass/commands/write_configuration.rb +37 -0
- data/lib/compass/compiler.rb +40 -0
- data/lib/compass/configuration.rb +167 -0
- data/lib/compass/core_ext.rb +12 -0
- data/lib/compass/errors.rb +7 -0
- data/lib/compass/exec.rb +184 -0
- data/lib/compass/frameworks.rb +29 -0
- data/lib/compass/installers.rb +5 -0
- data/lib/compass/installers/base.rb +135 -0
- data/lib/compass/installers/manifest.rb +57 -0
- data/lib/compass/installers/rails.rb +118 -0
- data/lib/compass/installers/stand_alone.rb +76 -0
- data/lib/compass/logger.rb +34 -0
- data/lib/compass/merb.rb +43 -0
- data/lib/compass/test_case.rb +37 -0
- data/lib/compass/validate.rb +13 -0
- data/lib/compass/validate/COPYRIGHT.html +93 -0
- data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
- data/lib/compass/validate/README.html +83 -0
- data/lib/compass/validate/XERCES_COPYING.txt +56 -0
- data/lib/compass/validate/css-validator-javadoc.jar +0 -0
- data/lib/compass/validate/css-validator.jar +0 -0
- data/lib/compass/validate/jigsaw.jar +0 -0
- data/lib/compass/validate/xerces.jar +0 -0
- data/lib/compass/validator.rb +59 -0
- data/lib/compass/version.rb +66 -0
- data/lib/sass_extensions.rb +13 -0
- data/test/command_line_test.rb +147 -0
- data/test/compass_test.rb +148 -0
- data/test/configuration_test.rb +29 -0
- data/test/fixtures/stylesheets/blueprint/css/typography.css +159 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
- data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +14 -0
- data/test/fixtures/stylesheets/compass/css/print.css +19 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +66 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +23 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +1 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.sass +5 -0
- data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
- data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
- data/test/sass_extensions_test.rb +26 -0
- data/test/test_helper.rb +47 -0
- metadata +295 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
class Compiler
|
|
3
|
+
|
|
4
|
+
include Actions
|
|
5
|
+
|
|
6
|
+
attr_accessor :working_path, :from, :to, :options
|
|
7
|
+
|
|
8
|
+
def initialize(working_path, from, to, options)
|
|
9
|
+
self.working_path = working_path
|
|
10
|
+
self.from, self.to = from, to
|
|
11
|
+
self.logger = options.delete(:logger)
|
|
12
|
+
self.options = options
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def sass_files
|
|
16
|
+
@sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass"))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def stylesheet_name(sass_file)
|
|
20
|
+
sass_file[("#{from}/".length)..-6]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def css_files
|
|
24
|
+
@css_files || sass_files.map{|sass_file| "#{to}/#{stylesheet_name(sass_file)}.css"}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def target_directories
|
|
28
|
+
css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def run
|
|
32
|
+
target_directories.each do |dir|
|
|
33
|
+
directory dir
|
|
34
|
+
end
|
|
35
|
+
sass_files.zip(css_files).each do |sass_filename, css_filename|
|
|
36
|
+
compile sass_filename, css_filename, options
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
require 'singleton'
|
|
2
|
+
|
|
3
|
+
module Compass
|
|
4
|
+
class Configuration
|
|
5
|
+
include Singleton
|
|
6
|
+
|
|
7
|
+
ATTRIBUTES = [
|
|
8
|
+
:project_path,
|
|
9
|
+
:css_dir,
|
|
10
|
+
:sass_dir,
|
|
11
|
+
:images_dir,
|
|
12
|
+
:javascripts_dir,
|
|
13
|
+
:output_style,
|
|
14
|
+
:environment
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
attr_accessor *ATTRIBUTES
|
|
18
|
+
|
|
19
|
+
attr_accessor :required_libraries
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
self.required_libraries = []
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# parses a manifest file which is a ruby script
|
|
26
|
+
# evaluated in a Manifest instance context
|
|
27
|
+
def parse(config_file)
|
|
28
|
+
open(config_file) do |f|
|
|
29
|
+
parse_string(f.read, config_file)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def parse_string(contents, filename)
|
|
34
|
+
eval(contents, binding, filename)
|
|
35
|
+
ATTRIBUTES.each do |prop|
|
|
36
|
+
value = eval(prop.to_s, binding) rescue nil
|
|
37
|
+
self.send("#{prop}=", value) if value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def set_all(options)
|
|
42
|
+
ATTRIBUTES.each do |a|
|
|
43
|
+
self.send("#{a}=", options[a]) if options.has_key?(a)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def set_maybe(options)
|
|
48
|
+
ATTRIBUTES.each do |a|
|
|
49
|
+
self.send("#{a}=", options[a]) if options[a]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def default_all(options)
|
|
54
|
+
ATTRIBUTES.each do |a|
|
|
55
|
+
self.send("#{a}=", options[a]) unless self.send(a)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def set_defaults!
|
|
60
|
+
default_all(ATTRIBUTES.inject({}){|m, a| m[a] = default_for(a); m})
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def default_for(attribute)
|
|
64
|
+
method = "default_#{attribute}".to_sym
|
|
65
|
+
self.send(method) if respond_to?(method)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def default_sass_dir
|
|
69
|
+
"src"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def default_css_dir
|
|
73
|
+
"stylesheets"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def default_output_style
|
|
77
|
+
if environment == :development
|
|
78
|
+
:expanded
|
|
79
|
+
else
|
|
80
|
+
:compact
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def serialize
|
|
85
|
+
contents = ""
|
|
86
|
+
required_libraries.each do |lib|
|
|
87
|
+
contents << %Q{require '#{lib}'\n}
|
|
88
|
+
end
|
|
89
|
+
contents << "# Require any additional compass plugins here.\n"
|
|
90
|
+
contents << "\n" if required_libraries.any?
|
|
91
|
+
ATTRIBUTES.each do |prop|
|
|
92
|
+
value = send(prop)
|
|
93
|
+
unless value.nil?
|
|
94
|
+
contents << %Q(#{prop} = #{value.inspect}\n)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
contents
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def to_sass_plugin_options
|
|
101
|
+
if project_path && sass_dir && css_dir
|
|
102
|
+
proj_sass_path = File.join(project_path, sass_dir)
|
|
103
|
+
proj_css_path = File.join(project_path, css_dir)
|
|
104
|
+
locations = {proj_sass_path => proj_css_path}
|
|
105
|
+
else
|
|
106
|
+
locations = {}
|
|
107
|
+
end
|
|
108
|
+
Compass::Frameworks::ALL.each do |framework|
|
|
109
|
+
locations[framework.stylesheets_directory] = proj_css_path || css_dir || "."
|
|
110
|
+
end
|
|
111
|
+
plugin_opts = {:template_location => locations}
|
|
112
|
+
plugin_opts[:style] = output_style if output_style
|
|
113
|
+
plugin_opts
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def to_sass_engine_options
|
|
117
|
+
load_paths = []
|
|
118
|
+
if project_path && sass_dir
|
|
119
|
+
load_paths << File.join(project_path, sass_dir)
|
|
120
|
+
end
|
|
121
|
+
Compass::Frameworks::ALL.each do |framework|
|
|
122
|
+
load_paths << framework.stylesheets_directory
|
|
123
|
+
end
|
|
124
|
+
engine_opts = {:load_paths => load_paths}
|
|
125
|
+
engine_opts[:style] = output_style if output_style
|
|
126
|
+
engine_opts
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Support for testing.
|
|
130
|
+
def reset!
|
|
131
|
+
ATTRIBUTES.each do |attr|
|
|
132
|
+
send("#{attr}=", nil)
|
|
133
|
+
end
|
|
134
|
+
self.required_libraries = []
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def require(lib)
|
|
138
|
+
required_libraries << lib
|
|
139
|
+
super
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
module ConfigHelpers
|
|
145
|
+
def configuration
|
|
146
|
+
if block_given?
|
|
147
|
+
yield Configuration.instance
|
|
148
|
+
end
|
|
149
|
+
Configuration.instance
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def sass_plugin_configuration
|
|
153
|
+
configuration.to_sass_plugin_options
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def configure_sass_plugin!
|
|
157
|
+
Sass::Plugin.options.merge!(sass_plugin_configuration)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def sass_engine_options
|
|
161
|
+
configuration.to_sass_engine_options
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
extend ConfigHelpers
|
|
166
|
+
|
|
167
|
+
end
|
data/lib/compass/exec.rb
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'haml'
|
|
4
|
+
require File.join(Compass.lib_directory, 'compass', 'logger')
|
|
5
|
+
require File.join(Compass.lib_directory, 'compass', 'errors')
|
|
6
|
+
require File.join(Compass.lib_directory, 'compass', 'actions')
|
|
7
|
+
|
|
8
|
+
module Compass
|
|
9
|
+
module Exec
|
|
10
|
+
|
|
11
|
+
def report_error(e, options)
|
|
12
|
+
$stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}"
|
|
13
|
+
if options[:trace]
|
|
14
|
+
e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" }
|
|
15
|
+
else
|
|
16
|
+
$stderr.puts "Run with --trace to see the full backtrace"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get_file(exception)
|
|
21
|
+
exception.backtrace[0].split(/:/, 2)[0]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def get_line(exception)
|
|
25
|
+
# SyntaxErrors have weird line reporting
|
|
26
|
+
# when there's trailing whitespace,
|
|
27
|
+
# which there is for Haml documents.
|
|
28
|
+
return exception.message.scan(/:(\d+)/)[0] if exception.is_a?(::Haml::SyntaxError)
|
|
29
|
+
exception.backtrace[0].scan(/:(\d+)/)[0]
|
|
30
|
+
end
|
|
31
|
+
module_function :report_error, :get_file, :get_line
|
|
32
|
+
|
|
33
|
+
class Compass
|
|
34
|
+
|
|
35
|
+
attr_accessor :args, :options, :opts
|
|
36
|
+
|
|
37
|
+
def initialize(args)
|
|
38
|
+
self.args = args
|
|
39
|
+
self.options = {}
|
|
40
|
+
parse!
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def run!
|
|
44
|
+
begin
|
|
45
|
+
perform!
|
|
46
|
+
rescue Exception => e
|
|
47
|
+
raise e if e.is_a? SystemExit
|
|
48
|
+
if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError)
|
|
49
|
+
$stderr.puts e.message
|
|
50
|
+
else
|
|
51
|
+
::Compass::Exec.report_error(e, @options)
|
|
52
|
+
end
|
|
53
|
+
return 1
|
|
54
|
+
end
|
|
55
|
+
return 0
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
protected
|
|
59
|
+
|
|
60
|
+
def perform!
|
|
61
|
+
if options[:command]
|
|
62
|
+
do_command(options[:command])
|
|
63
|
+
else
|
|
64
|
+
puts self.opts
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def parse!
|
|
69
|
+
self.opts = OptionParser.new(&method(:set_opts))
|
|
70
|
+
self.opts.parse!(self.args)
|
|
71
|
+
if self.args.size > 0
|
|
72
|
+
self.options[:project_name] = trim_trailing_separator(self.args.shift)
|
|
73
|
+
end
|
|
74
|
+
self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project
|
|
75
|
+
self.options[:environment] ||= :production
|
|
76
|
+
self.options[:framework] ||= :compass
|
|
77
|
+
self.options[:project_type] ||= :stand_alone
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def trim_trailing_separator(path)
|
|
81
|
+
path[-1..-1] == File::SEPARATOR ? path[0..-2] : path
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def set_opts(opts)
|
|
85
|
+
opts.banner = <<END
|
|
86
|
+
Usage: compass [options] [project]
|
|
87
|
+
|
|
88
|
+
Description:
|
|
89
|
+
When project is given, generates a new project of that name as a subdirectory of
|
|
90
|
+
the current directory.
|
|
91
|
+
|
|
92
|
+
If you change any source files, you can update your project using --update.
|
|
93
|
+
|
|
94
|
+
Options:
|
|
95
|
+
END
|
|
96
|
+
opts.on('-u', '--update', :NONE, 'Update the current project') do
|
|
97
|
+
self.options[:command] = :update_project
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
opts.on('-w', '--watch', :NONE, 'Monitor the current project for changes and update') do
|
|
101
|
+
self.options[:command] = :watch_project
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir|
|
|
105
|
+
self.options[:sass_dir] = sass_dir
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir|
|
|
109
|
+
self.options[:css_dir] = css_dir
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
opts.on('--list-frameworks', "List compass frameworks available to use.") do
|
|
113
|
+
self.options[:command] = :list_frameworks
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
opts.on('-c', '--write-configuration', "Write the current configuration to the configuration file.") do
|
|
117
|
+
self.options[:command] = :write_configuration
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
opts.on('-f FRAMEWORK', '--framework FRAMEWORK', 'Set up a new project using the specified framework.') do |framework|
|
|
121
|
+
self.options[:framework] = framework
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment: development, production (default)') do |env|
|
|
125
|
+
self.options[:environment] = env
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode (nested, expanded, compact, compressed)') do |style|
|
|
129
|
+
self.options[:output_style] = style
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
opts.on('-r LIBRARY', '--require LIBRARY', "Require LIBRARY before running commands. This is used to access compass plugins.") do |library|
|
|
133
|
+
require library
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
opts.on('--rails', "Sets the project type to a rails project.") do
|
|
137
|
+
self.options[:project_type] = :rails
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do
|
|
141
|
+
self.options[:quiet] = true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do
|
|
145
|
+
self.options[:dry_run] = true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
opts.on('--trace', :NONE, 'Show a full stacktrace on error') do
|
|
149
|
+
self.options[:trace] = true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
opts.on('--force', :NONE, 'Force. Allows some commands to succeed when they would otherwise fail.') do
|
|
153
|
+
self.options[:force] = true
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
opts.on('--imports', :NONE, 'Emit an import path suitable for use with the Sass command-line tool.') do
|
|
157
|
+
#XXX cross platform support?
|
|
158
|
+
print ::Compass::Frameworks::ALL.map{|f| "-I #{f.stylesheets_directory}"}.join(' ')
|
|
159
|
+
exit
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
opts.on_tail("-?", "-h", "--help", "Show this message") do
|
|
163
|
+
puts opts
|
|
164
|
+
exit
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
opts.on_tail("-v", "--version", "Print version") do
|
|
168
|
+
self.options[:command] = :print_version
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def do_command(command)
|
|
173
|
+
command_class_name = command.to_s.split(/_/).map{|p| p.capitalize}.join('')
|
|
174
|
+
command_class = eval("::Compass::Commands::#{command_class_name}")
|
|
175
|
+
command_class.new(Dir.getwd, options).perform
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'commands', "*.rb")).each do |file|
|
|
183
|
+
require file
|
|
184
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Frameworks
|
|
3
|
+
ALL = []
|
|
4
|
+
class Framework
|
|
5
|
+
attr_accessor :name
|
|
6
|
+
attr_accessor :templates_directory, :stylesheets_directory
|
|
7
|
+
def initialize(name, *arguments)
|
|
8
|
+
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
|
|
9
|
+
path = options[:path] || arguments.shift
|
|
10
|
+
@name = name
|
|
11
|
+
@templates_directory = options[:templates_directory] || File.join(path, 'templates')
|
|
12
|
+
@stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
def register(name, *arguments)
|
|
16
|
+
ALL << Framework.new(name, *arguments)
|
|
17
|
+
end
|
|
18
|
+
def [](name)
|
|
19
|
+
ALL.detect{|f| f.name.to_s == name.to_s}
|
|
20
|
+
end
|
|
21
|
+
module_function :register, :[]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Import all of the default frameworks.
|
|
26
|
+
default_frameworks_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'frameworks'))
|
|
27
|
+
Dir.glob(File.join(default_frameworks_directory, "*.rb")).each do |framework|
|
|
28
|
+
require framework
|
|
29
|
+
end
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'installers', 'manifest')
|
|
2
|
+
require File.join(File.dirname(__FILE__), 'installers', 'base')
|
|
3
|
+
require File.join(File.dirname(__FILE__), 'installers', 'stand_alone')
|
|
4
|
+
require File.join(File.dirname(__FILE__), 'installers', 'rails')
|
|
5
|
+
|