compass 0.11.alpha.3 → 0.11.alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/compass +1 -2
- data/lib/compass/actions.rb +4 -3
- data/lib/compass/commands.rb +1 -1
- data/lib/compass/commands/default.rb +50 -0
- data/lib/compass/commands/help.rb +4 -0
- data/lib/compass/commands/print_version.rb +2 -0
- data/lib/compass/commands/registry.rb +3 -0
- data/lib/compass/commands/update_project.rb +4 -0
- data/lib/compass/commands/watch_project.rb +1 -0
- data/lib/compass/compiler.rb +29 -9
- data/lib/compass/exec.rb +1 -1
- data/lib/compass/exec/helpers.rb +0 -12
- data/lib/compass/exec/sub_command_ui.rb +6 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +3 -2
- data/lib/vendor/fssm/fssm/backends/inotify.rb +5 -2
- data/lib/vendor/fssm/fssm/pathname.rb +149 -175
- data/lib/vendor/fssm/fssm/support.rb +5 -2
- data/test/command_line_helper.rb +1 -2
- data/test/command_line_test.rb +5 -5
- data/test/compass_test.rb +7 -3
- data/test/rails_helper.rb +1 -0
- data/test/rails_integration_test.rb +1 -1
- metadata +4 -8
data/VERSION.yml
CHANGED
data/bin/compass
CHANGED
@@ -22,8 +22,7 @@ fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
runner = Proc.new do
|
25
|
-
|
26
|
-
command_line_class.new(ARGV).run!
|
25
|
+
Compass::Exec::SubCommandUI.new(ARGV).run!
|
27
26
|
end
|
28
27
|
|
29
28
|
if ARGV.delete("--profile")
|
data/lib/compass/actions.rb
CHANGED
@@ -33,19 +33,20 @@ module Compass
|
|
33
33
|
options ||= self.options if self.respond_to?(:options)
|
34
34
|
skip_write = options[:dry_run]
|
35
35
|
contents = process_erb(contents, options[:erb]) if options[:erb]
|
36
|
+
extra = options[:extra] || ""
|
36
37
|
if File.exists?(file_name)
|
37
38
|
existing_contents = IO.read(file_name)
|
38
39
|
if existing_contents == contents
|
39
|
-
logger.record :identical, basename(file_name)
|
40
|
+
logger.record :identical, basename(file_name), extra
|
40
41
|
skip_write = true
|
41
42
|
elsif options[:force]
|
42
|
-
logger.record :overwrite, basename(file_name)
|
43
|
+
logger.record :overwrite, basename(file_name), extra
|
43
44
|
else
|
44
45
|
msg = "File #{basename(file_name)} already exists. Run with --force to force overwrite."
|
45
46
|
raise Compass::FilesystemConflict.new(msg)
|
46
47
|
end
|
47
48
|
else
|
48
|
-
logger.record :create, basename(file_name)
|
49
|
+
logger.record :create, basename(file_name), extra
|
49
50
|
end
|
50
51
|
if skip_write
|
51
52
|
FileUtils.touch file_name unless options[:dry_run]
|
data/lib/compass/commands.rb
CHANGED
@@ -3,7 +3,7 @@ end
|
|
3
3
|
|
4
4
|
require 'compass/commands/registry'
|
5
5
|
|
6
|
-
%w(base generate_grid_background help list_frameworks project_base
|
6
|
+
%w(base generate_grid_background default help list_frameworks project_base
|
7
7
|
update_project watch_project create_project imports installer_command
|
8
8
|
print_version project_stats stamp_pattern sprite validate_project
|
9
9
|
write_configuration interactive unpack_extension).each do |lib|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
module DefaultOptionsParser
|
4
|
+
def set_options(opts)
|
5
|
+
opts.on("--trace") do
|
6
|
+
self.options[:trace] = true
|
7
|
+
end
|
8
|
+
opts.on("-?", "-h", "--help") do
|
9
|
+
self.options[:command] = Proc.new do
|
10
|
+
Help.new(working_path, options.merge(:help_command => "help"))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
opts.on("-q", "--quiet") do
|
14
|
+
self.options[:quiet] = true
|
15
|
+
end
|
16
|
+
opts.on("-v", "--version") do
|
17
|
+
self.options[:command] = Proc.new do
|
18
|
+
PrintVersion.new(working_path, options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
class Default < Base
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def option_parser(arguments)
|
28
|
+
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
29
|
+
parser.extend(DefaultOptionsParser)
|
30
|
+
end
|
31
|
+
# def usage
|
32
|
+
# $stderr.puts caller.join("\n")
|
33
|
+
# "XXX"
|
34
|
+
# end
|
35
|
+
def parse!(arguments)
|
36
|
+
parser = option_parser(arguments)
|
37
|
+
parser.parse!
|
38
|
+
parser.options[:command] ||= Proc.new do
|
39
|
+
Help.new(working_path, options.merge(:help_command => "help"))
|
40
|
+
end
|
41
|
+
parser.options
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
instance_eval(&options[:command]).execute
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -9,6 +9,10 @@ Description:
|
|
9
9
|
build and maintain your stylesheets and makes it easy
|
10
10
|
for you to use stylesheet libraries provided by others.
|
11
11
|
|
12
|
+
Donating:
|
13
|
+
Compass is charityware. If you find it useful please make
|
14
|
+
a tax deductable donation: http://umdf.org/compass
|
15
|
+
|
12
16
|
To get help on a particular command please specify the command.
|
13
17
|
|
14
18
|
}
|
@@ -83,6 +83,8 @@ Options:
|
|
83
83
|
lines << "Compass #{::Compass.version[:string]}"
|
84
84
|
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
|
85
85
|
lines << "Released under the MIT License."
|
86
|
+
lines << "Compass is charityware."
|
87
|
+
lines << "Please make a tax deductable donation: http://umdf.org/compass"
|
86
88
|
puts lines.join("\n")
|
87
89
|
end
|
88
90
|
end
|
@@ -5,6 +5,7 @@ module Compass::Commands
|
|
5
5
|
@commands[name.to_sym] = command_class
|
6
6
|
end
|
7
7
|
def get(name)
|
8
|
+
return unless name
|
8
9
|
@commands ||= Hash.new
|
9
10
|
@commands[name.to_sym] || @commands[abbreviation_of(name)]
|
10
11
|
end
|
@@ -13,6 +14,8 @@ module Compass::Commands
|
|
13
14
|
matching = @commands.keys.select{|k| k.to_s =~ re}
|
14
15
|
if matching.size == 1
|
15
16
|
matching.first
|
17
|
+
elsif name =~ /^-/
|
18
|
+
nil
|
16
19
|
else
|
17
20
|
raise Compass::Error, "Ambiguous abbreviation '#{name}'. Did you mean one of: #{matching.join(", ")}"
|
18
21
|
end
|
@@ -14,6 +14,9 @@ module Compass
|
|
14
14
|
Options:
|
15
15
|
}.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n")
|
16
16
|
|
17
|
+
opts.on("--time", "Display compilation times.") do
|
18
|
+
self.options[:time] = true
|
19
|
+
end
|
17
20
|
super
|
18
21
|
end
|
19
22
|
end
|
@@ -51,6 +54,7 @@ module Compass
|
|
51
54
|
:sass_files => explicit_sass_files,
|
52
55
|
:dry_run => options[:dry_run])
|
53
56
|
compiler_opts[:quiet] = options[:quiet] if options[:quiet]
|
57
|
+
compiler_opts[:time] = options[:time] if options[:time]
|
54
58
|
compiler_opts.merge!(additional_options)
|
55
59
|
Compass::Compiler.new(working_path,
|
56
60
|
Compass.configuration.sass_path,
|
data/lib/compass/compiler.rb
CHANGED
@@ -76,29 +76,49 @@ module Compass
|
|
76
76
|
target_directories.each {|dir| directory dir}
|
77
77
|
|
78
78
|
# Compile each sass file.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
result = timed do
|
80
|
+
sass_files.zip(css_files).each do |sass_filename, css_filename|
|
81
|
+
begin
|
82
|
+
compile_if_required sass_filename, css_filename
|
83
|
+
rescue Sass::SyntaxError => e
|
84
|
+
handle_exception(sass_filename, css_filename, e)
|
85
|
+
end
|
84
86
|
end
|
85
87
|
end
|
88
|
+
if options[:time]
|
89
|
+
puts "Compilation took #{(result.__duration * 1000).round / 1000.0}s"
|
90
|
+
end
|
86
91
|
end
|
87
92
|
|
88
93
|
def compile_if_required(sass_filename, css_filename)
|
89
94
|
if should_compile?(sass_filename, css_filename)
|
90
|
-
compile sass_filename, css_filename
|
95
|
+
compile sass_filename, css_filename, :time => options[:time]
|
91
96
|
else
|
92
97
|
logger.record :unchanged, basename(sass_filename) unless options[:quiet]
|
93
98
|
end
|
94
99
|
end
|
95
100
|
|
101
|
+
def timed
|
102
|
+
start_time = Time.now
|
103
|
+
res = yield
|
104
|
+
end_time = Time.now
|
105
|
+
res.instance_variable_set("@__duration", end_time - start_time)
|
106
|
+
def res.__duration
|
107
|
+
@__duration
|
108
|
+
end
|
109
|
+
res
|
110
|
+
end
|
111
|
+
|
96
112
|
# Compile one Sass file
|
97
|
-
def compile(sass_filename, css_filename)
|
113
|
+
def compile(sass_filename, css_filename, additional_options = {})
|
114
|
+
start_time = end_time = nil
|
98
115
|
css_content = logger.red do
|
99
|
-
|
116
|
+
timed do
|
117
|
+
engine(sass_filename, css_filename).render
|
118
|
+
end
|
100
119
|
end
|
101
|
-
|
120
|
+
duration = additional_options[:time] ? "(#{(css_content.__duration * 1000).round / 1000.0}s)" : ""
|
121
|
+
write_file(css_filename, css_content, options.merge(:force => true, :extra => duration))
|
102
122
|
end
|
103
123
|
|
104
124
|
def should_compile?(sass_filename, css_filename)
|
data/lib/compass/exec.rb
CHANGED
data/lib/compass/exec/helpers.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
module Compass::Exec
|
2
2
|
module Helpers
|
3
3
|
extend self
|
4
|
-
def select_appropriate_command_line_ui(arguments)
|
5
|
-
if Compass::Commands.command_exists? arguments.first
|
6
|
-
SubCommandUI
|
7
|
-
else
|
8
|
-
unless arguments.include?("-h") || arguments.include?("--help")
|
9
|
-
Compass::Logger.new.red do
|
10
|
-
Compass::Util.compass_warn "WARNING: This interface is deprecated. Please use the new subcommand interface.\nSee `compass help` for more information.\n"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
SwitchUI
|
14
|
-
end
|
15
|
-
end
|
16
4
|
def report_error(e, options)
|
17
5
|
$stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}"
|
18
6
|
if options[:trace]
|
@@ -30,6 +30,11 @@ module Compass::Exec
|
|
30
30
|
def perform!
|
31
31
|
$command = args.shift
|
32
32
|
command_class = Compass::Commands[$command]
|
33
|
+
unless command_class
|
34
|
+
args.unshift($command)
|
35
|
+
$command = "help"
|
36
|
+
command_class = Compass::Commands::Default
|
37
|
+
end
|
33
38
|
@options = if command_class.respond_to?("parse_#{$command}!")
|
34
39
|
command_class.send("parse_#{$command}!", args)
|
35
40
|
else
|
@@ -38,7 +43,7 @@ module Compass::Exec
|
|
38
43
|
command_class.new(Dir.getwd, @options).execute
|
39
44
|
rescue OptionParser::ParseError => e
|
40
45
|
puts "Error: #{e.message}"
|
41
|
-
puts command_class.usage
|
46
|
+
puts command_class.usage if command_class.respond_to?(:usage)
|
42
47
|
end
|
43
48
|
|
44
49
|
end
|
@@ -70,7 +70,7 @@ module Compass::SassExtensions::Functions::Sprites
|
|
70
70
|
:repeat => repeat_for(sprite_name),
|
71
71
|
:spacing => spacing_for(sprite_name),
|
72
72
|
:position => position_for(sprite_name),
|
73
|
-
:digest => MD5.file(file).hexdigest
|
73
|
+
:digest => Digest::MD5.file(file).hexdigest
|
74
74
|
}
|
75
75
|
end
|
76
76
|
@images.each_with_index do |image, index|
|
@@ -163,7 +163,8 @@ module Compass::SassExtensions::Functions::Sprites
|
|
163
163
|
|
164
164
|
def uniqueness_hash
|
165
165
|
@uniqueness_hash ||= begin
|
166
|
-
sum = MD5.
|
166
|
+
sum = Digest::MD5.new
|
167
|
+
sum << SPRITE_VERSION
|
167
168
|
sum << path
|
168
169
|
images.each do |image|
|
169
170
|
[:relative_file, :height, :width, :repeat, :spacing, :position, :digest].each do |attr|
|
@@ -5,8 +5,11 @@ module FSSM::Backends
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def add_handler(handler, preload=true)
|
8
|
-
@notifier.watch(handler.path.to_s, :
|
9
|
-
|
8
|
+
@notifier.watch(handler.path.to_s, :recursive, :attrib, :modify, :create,
|
9
|
+
:delete, :delete_self, :moved_from, :moved_to, :move_self) do |event|
|
10
|
+
path = FSSM::Pathname.for(event.absolute_name)
|
11
|
+
path = path.dirname unless event.name == "" # Event on root directory
|
12
|
+
handler.refresh(path)
|
10
13
|
end
|
11
14
|
|
12
15
|
handler.refresh(nil, true) if preload
|
@@ -1,65 +1,50 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'fileutils'
|
2
|
+
require 'find'
|
3
3
|
|
4
4
|
module FSSM
|
5
5
|
class Pathname < String
|
6
|
+
SYMLOOP_MAX = 8
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
ALT_SEPARATOR = Regexp.quote(File::ALT_SEPARATOR)
|
11
|
-
SEPARATOR_PAT = Regexp.compile("[#{SEPARATOR}#{ALT_SEPARATOR}]")
|
12
|
-
else
|
13
|
-
SEPARATOR_PAT = Regexp.compile(SEPARATOR)
|
14
|
-
end
|
15
|
-
|
16
|
-
if RUBY_PLATFORM =~ /(:?mswin|mingw|bccwin)/
|
17
|
-
PREFIX_PAT = Regexp.compile("^([A-Za-z]:#{SEPARATOR_PAT})")
|
18
|
-
else
|
19
|
-
PREFIX_PAT = Regexp.compile("^(#{SEPARATOR_PAT})")
|
20
|
-
end
|
8
|
+
ROOT = '/'.freeze
|
9
|
+
DOT = '.'.freeze
|
10
|
+
DOT_DOT = '..'.freeze
|
21
11
|
|
22
12
|
class << self
|
23
13
|
def for(path)
|
24
|
-
path
|
25
|
-
path.dememo
|
26
|
-
path
|
14
|
+
path.is_a?(::FSSM::Pathname) ? path : new("#{path}")
|
27
15
|
end
|
28
16
|
end
|
29
17
|
|
30
18
|
def initialize(path)
|
31
|
-
if path =~ %r{\0}
|
32
|
-
raise ArgumentError, "path cannot contain ASCII NULLs"
|
33
|
-
end
|
34
|
-
|
35
|
-
dememo
|
36
|
-
|
19
|
+
raise ArgumentError, "path cannot contain ASCII NULLs" if path =~ %r{\0}
|
37
20
|
super(path)
|
38
21
|
end
|
39
22
|
|
40
|
-
def
|
41
|
-
self
|
23
|
+
def <=>(other)
|
24
|
+
self.tr('/', "\0").to_s <=> other.to_str.tr('/', "\0")
|
25
|
+
rescue NoMethodError
|
26
|
+
nil
|
42
27
|
end
|
43
28
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
29
|
+
def ==(other)
|
30
|
+
left = self.cleanpath.tr('/', "\0").to_s
|
31
|
+
right = self.class.for(other).cleanpath.tr('/', "\0").to_s
|
47
32
|
|
48
|
-
|
33
|
+
left == right
|
34
|
+
rescue NoMethodError
|
35
|
+
false
|
36
|
+
end
|
49
37
|
|
50
|
-
def
|
51
|
-
|
52
|
-
set_prefix_and_names
|
53
|
-
@segments = @names.dup
|
54
|
-
@segments.delete('.')
|
55
|
-
@segments.unshift(@prefix) unless @prefix.empty?
|
56
|
-
@segments
|
38
|
+
def +(path)
|
39
|
+
dup << path
|
57
40
|
end
|
58
41
|
|
59
|
-
|
42
|
+
def <<(path)
|
43
|
+
replace( join(path).cleanpath! )
|
44
|
+
end
|
60
45
|
|
61
|
-
def
|
62
|
-
|
46
|
+
def absolute?
|
47
|
+
self[0, 1].to_s == ROOT
|
63
48
|
end
|
64
49
|
|
65
50
|
def ascend
|
@@ -69,37 +54,8 @@ module FSSM
|
|
69
54
|
end
|
70
55
|
end
|
71
56
|
|
72
|
-
def
|
73
|
-
|
74
|
-
1.upto(parts.length) do |i|
|
75
|
-
yield self.class.join(parts[0, i])
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def root?
|
80
|
-
set_prefix_and_names
|
81
|
-
@names.empty? && !@prefix.empty?
|
82
|
-
end
|
83
|
-
|
84
|
-
def parent
|
85
|
-
self + '..'
|
86
|
-
end
|
87
|
-
|
88
|
-
def relative?
|
89
|
-
set_prefix_and_names
|
90
|
-
@prefix.empty?
|
91
|
-
end
|
92
|
-
|
93
|
-
def absolute?
|
94
|
-
!relative?
|
95
|
-
end
|
96
|
-
|
97
|
-
def +(path)
|
98
|
-
dup << path
|
99
|
-
end
|
100
|
-
|
101
|
-
def <<(path)
|
102
|
-
replace(join(path).cleanpath!)
|
57
|
+
def children
|
58
|
+
entries[2..-1]
|
103
59
|
end
|
104
60
|
|
105
61
|
def cleanpath!
|
@@ -108,14 +64,16 @@ module FSSM
|
|
108
64
|
|
109
65
|
parts.each do |part|
|
110
66
|
case part
|
111
|
-
when
|
67
|
+
when DOT then
|
112
68
|
next
|
113
|
-
when
|
69
|
+
when DOT_DOT then
|
114
70
|
case final.last
|
115
|
-
when
|
116
|
-
|
117
|
-
when
|
118
|
-
final.push(
|
71
|
+
when ROOT then
|
72
|
+
next
|
73
|
+
when DOT_DOT then
|
74
|
+
final.push(DOT_DOT)
|
75
|
+
when nil then
|
76
|
+
final.push(DOT_DOT)
|
119
77
|
else
|
120
78
|
final.pop
|
121
79
|
end
|
@@ -124,142 +82,128 @@ module FSSM
|
|
124
82
|
end
|
125
83
|
end
|
126
84
|
|
127
|
-
replace(final.empty? ?
|
85
|
+
replace(final.empty? ? DOT : self.class.join(*final))
|
128
86
|
end
|
129
87
|
|
130
88
|
def cleanpath
|
131
89
|
dup.cleanpath!
|
132
90
|
end
|
133
91
|
|
134
|
-
def
|
135
|
-
|
92
|
+
def descend
|
93
|
+
parts = to_a
|
94
|
+
1.upto(parts.length) { |i| yield self.class.join(parts[0, i]) }
|
95
|
+
end
|
136
96
|
|
137
|
-
|
138
|
-
|
97
|
+
def dot?
|
98
|
+
self == DOT
|
99
|
+
end
|
139
100
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
end
|
101
|
+
def dot_dot?
|
102
|
+
self == DOT_DOT
|
103
|
+
end
|
144
104
|
|
145
|
-
|
146
|
-
|
147
|
-
|
105
|
+
def each_filename(&blk)
|
106
|
+
to_a.each(&blk)
|
107
|
+
end
|
108
|
+
|
109
|
+
def mountpoint?
|
110
|
+
stat1 = self.lstat
|
111
|
+
stat2 = self.parent.lstat
|
112
|
+
|
113
|
+
stat1.dev != stat2.dev || stat1.ino == stat2.ino
|
114
|
+
rescue Errno::ENOENT
|
115
|
+
false
|
116
|
+
end
|
117
|
+
|
118
|
+
def parent
|
119
|
+
self + '..'
|
120
|
+
end
|
121
|
+
|
122
|
+
def realpath
|
123
|
+
path = self
|
124
|
+
|
125
|
+
SYMLOOP_MAX.times do
|
126
|
+
link = path.readlink
|
127
|
+
link = path.dirname + link if link.relative?
|
128
|
+
path = link
|
148
129
|
end
|
130
|
+
|
131
|
+
raise Errno::ELOOP, self
|
132
|
+
rescue Errno::EINVAL
|
133
|
+
path.expand_path
|
134
|
+
end
|
135
|
+
|
136
|
+
def relative?
|
137
|
+
!absolute?
|
149
138
|
end
|
150
139
|
|
151
140
|
def relative_path_from(base)
|
152
141
|
base = self.class.for(base)
|
153
142
|
|
154
|
-
if self.absolute? != base.absolute?
|
155
|
-
raise ArgumentError, 'no relative path between a relative and absolute'
|
156
|
-
end
|
143
|
+
raise ArgumentError, 'no relative path between a relative and absolute' if self.absolute? != base.absolute?
|
157
144
|
|
158
|
-
|
159
|
-
|
160
|
-
end
|
145
|
+
return self if base.dot?
|
146
|
+
return self.class.new(DOT) if self == base
|
161
147
|
|
162
|
-
base = base.cleanpath
|
163
|
-
dest =
|
148
|
+
base = base.cleanpath.to_a
|
149
|
+
dest = self.cleanpath.to_a
|
164
150
|
|
165
151
|
while !dest.empty? && !base.empty? && dest[0] == base[0]
|
166
152
|
base.shift
|
167
153
|
dest.shift
|
168
154
|
end
|
169
155
|
|
170
|
-
base.shift if base[0] ==
|
171
|
-
dest.shift if dest[0] ==
|
156
|
+
base.shift if base[0] == DOT
|
157
|
+
dest.shift if dest[0] == DOT
|
172
158
|
|
173
|
-
if base.include?(
|
174
|
-
raise ArgumentError, "base directory may not contain '..'"
|
175
|
-
end
|
159
|
+
raise ArgumentError, "base directory may not contain '#{DOT_DOT}'" if base.include?(DOT_DOT)
|
176
160
|
|
177
|
-
path = base.fill(
|
161
|
+
path = base.fill(DOT_DOT) + dest
|
178
162
|
path = self.class.join(*path)
|
179
|
-
path = self.class.new(
|
163
|
+
path = self.class.new(DOT) if path.empty?
|
180
164
|
|
181
165
|
path
|
182
166
|
end
|
183
167
|
|
184
|
-
def
|
185
|
-
|
186
|
-
raise ArgumentError, "path cannot contain ASCII NULLs"
|
187
|
-
end
|
188
|
-
|
189
|
-
dememo
|
190
|
-
|
191
|
-
super(path)
|
168
|
+
def root?
|
169
|
+
!!(self =~ %r{^#{ROOT}+$})
|
192
170
|
end
|
193
171
|
|
194
|
-
def
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
true
|
172
|
+
def to_a
|
173
|
+
array = to_s.split(File::SEPARATOR)
|
174
|
+
array.delete('')
|
175
|
+
array.insert(0, ROOT) if absolute?
|
176
|
+
array
|
200
177
|
end
|
201
178
|
|
202
|
-
|
203
|
-
set_prefix_and_names
|
204
|
-
@prefix
|
205
|
-
end
|
179
|
+
alias segments to_a
|
206
180
|
|
207
|
-
def
|
208
|
-
|
209
|
-
@names
|
181
|
+
def to_path
|
182
|
+
self
|
210
183
|
end
|
211
184
|
|
212
|
-
def
|
213
|
-
|
214
|
-
@segments = nil
|
215
|
-
@prefix = nil
|
216
|
-
@names = nil
|
185
|
+
def to_s
|
186
|
+
"#{self}"
|
217
187
|
end
|
218
188
|
|
219
|
-
|
220
|
-
|
221
|
-
def set_prefix_and_names
|
222
|
-
return if @set
|
223
|
-
|
224
|
-
@names = []
|
225
|
-
|
226
|
-
if (match = PREFIX_PAT.match(self))
|
227
|
-
@prefix = match[0].to_s
|
228
|
-
@names += match.post_match.split(SEPARATOR_PAT)
|
229
|
-
else
|
230
|
-
@prefix = ''
|
231
|
-
@names += self.split(SEPARATOR_PAT)
|
232
|
-
end
|
233
|
-
|
234
|
-
@names.compact!
|
235
|
-
@names.delete('')
|
189
|
+
alias to_str to_s
|
236
190
|
|
237
|
-
|
191
|
+
def unlink
|
192
|
+
Dir.unlink(self)
|
193
|
+
true
|
194
|
+
rescue Errno::ENOTDIR
|
195
|
+
File.unlink(self)
|
196
|
+
true
|
238
197
|
end
|
239
|
-
|
240
198
|
end
|
241
199
|
|
242
200
|
class Pathname
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
dirs.map! {|path| new(path)}
|
247
|
-
|
248
|
-
if block_given?
|
249
|
-
dirs.each {|dir| yield dir}
|
250
|
-
nil
|
251
|
-
else
|
252
|
-
dirs
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
def [](pattern)
|
257
|
-
Dir[pattern].map! {|path| new(path)}
|
258
|
-
end
|
201
|
+
def self.[](pattern)
|
202
|
+
Dir[pattern].map! {|d| FSSM::Pathname.new(d) }
|
203
|
+
end
|
259
204
|
|
260
|
-
|
261
|
-
|
262
|
-
end
|
205
|
+
def self.pwd
|
206
|
+
FSSM::Pathname.new(Dir.pwd)
|
263
207
|
end
|
264
208
|
|
265
209
|
def entries
|
@@ -278,6 +222,24 @@ module FSSM
|
|
278
222
|
Dir.rmdir(self)
|
279
223
|
end
|
280
224
|
|
225
|
+
def self.glob(pattern, flags = 0)
|
226
|
+
dirs = Dir.glob(pattern, flags)
|
227
|
+
dirs.map! {|path| FSSM::Pathname.new(path) }
|
228
|
+
|
229
|
+
if block_given?
|
230
|
+
dirs.each {|dir| yield dir }
|
231
|
+
nil
|
232
|
+
else
|
233
|
+
dirs
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def glob(pattern, flags = 0, &block)
|
238
|
+
patterns = [pattern].flatten
|
239
|
+
patterns.map! {|p| self.class.glob(self.to_s + p, flags, &block) }
|
240
|
+
patterns.flatten
|
241
|
+
end
|
242
|
+
|
281
243
|
def chdir
|
282
244
|
blk = lambda { yield self } if block_given?
|
283
245
|
Dir.chdir(self, &blk)
|
@@ -372,8 +334,6 @@ module FSSM
|
|
372
334
|
def zero?
|
373
335
|
FileTest.zero?(self)
|
374
336
|
end
|
375
|
-
|
376
|
-
alias exist? exists?
|
377
337
|
end
|
378
338
|
|
379
339
|
class Pathname
|
@@ -407,10 +367,10 @@ module FSSM
|
|
407
367
|
end
|
408
368
|
|
409
369
|
class Pathname
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
370
|
+
def self.join(*parts)
|
371
|
+
last_part = FSSM::Pathname.new(parts.last)
|
372
|
+
return last_part if last_part.absolute?
|
373
|
+
FSSM::Pathname.new(File.join(*parts.reject {|p| p.empty? }))
|
414
374
|
end
|
415
375
|
|
416
376
|
def basename
|
@@ -478,6 +438,10 @@ module FSSM
|
|
478
438
|
File.size?(self)
|
479
439
|
end
|
480
440
|
|
441
|
+
def split
|
442
|
+
File.split(self).map {|part| FSSM::Pathname.new(part) }
|
443
|
+
end
|
444
|
+
|
481
445
|
def symlink(to)
|
482
446
|
File.symlink(self, to)
|
483
447
|
end
|
@@ -525,4 +489,14 @@ module FSSM
|
|
525
489
|
end
|
526
490
|
end
|
527
491
|
|
492
|
+
class Pathname
|
493
|
+
class << self
|
494
|
+
alias getwd pwd
|
495
|
+
end
|
496
|
+
|
497
|
+
alias absolute expand_path
|
498
|
+
alias delete unlink
|
499
|
+
alias exist? exists?
|
500
|
+
alias fnmatch fnmatch?
|
501
|
+
end
|
528
502
|
end
|
@@ -39,11 +39,14 @@ module FSSM::Support
|
|
39
39
|
def rb_inotify?
|
40
40
|
found = begin
|
41
41
|
require 'rb-inotify'
|
42
|
-
INotify::
|
42
|
+
if defined?(INotify::VERSION)
|
43
|
+
version = INotify::VERSION
|
44
|
+
version[0] > 0 || version[1] >= 6
|
45
|
+
end
|
43
46
|
rescue LoadError
|
44
47
|
false
|
45
48
|
end
|
46
|
-
STDERR.puts("Warning: Unable to load rb-inotify >= 0.
|
49
|
+
STDERR.puts("Warning: Unable to load rb-inotify >= 0.5.1. Inotify will be unavailable.") unless found
|
47
50
|
found
|
48
51
|
end
|
49
52
|
|
data/test/command_line_helper.rb
CHANGED
@@ -107,8 +107,7 @@ module Compass::CommandLineHelper
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def execute(*arguments)
|
110
|
-
|
111
|
-
exit_code = command_line_class.new(arguments).run!
|
110
|
+
exit_code = Compass::Exec::SubCommandUI.new(arguments).run!
|
112
111
|
# fail "Command Failed with exit code: #{exit_code}" unless exit_code == 0
|
113
112
|
exit_code
|
114
113
|
end
|
data/test/command_line_test.rb
CHANGED
@@ -20,7 +20,7 @@ class CommandLineTest < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
def test_basic_install
|
22
22
|
within_tmp_directory do
|
23
|
-
compass "--boring", "basic"
|
23
|
+
compass "create", "--boring", "basic"
|
24
24
|
assert File.exists?("basic/sass/screen.scss")
|
25
25
|
assert File.exists?("basic/stylesheets/screen.css")
|
26
26
|
assert_action_performed :directory, "basic/"
|
@@ -33,7 +33,7 @@ class CommandLineTest < Test::Unit::TestCase
|
|
33
33
|
next if framework.name =~ /^_/
|
34
34
|
define_method "test_#{framework.name}_installation" do
|
35
35
|
within_tmp_directory do
|
36
|
-
compass *%W(--boring --
|
36
|
+
compass *%W(create --boring --using #{framework.name} #{framework.name}_project)
|
37
37
|
assert File.exists?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
|
38
38
|
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
|
39
39
|
assert_action_performed :directory, "#{framework.name}_project/"
|
@@ -45,13 +45,13 @@ class CommandLineTest < Test::Unit::TestCase
|
|
45
45
|
|
46
46
|
def test_basic_update
|
47
47
|
within_tmp_directory do
|
48
|
-
compass "--boring", "basic"
|
48
|
+
compass "create", "--boring", "basic"
|
49
49
|
Dir.chdir "basic" do
|
50
50
|
# basic update with timestamp caching
|
51
|
-
compass "--boring"
|
51
|
+
compass "compile", "--boring"
|
52
52
|
assert_action_performed :unchanged, "sass/screen.scss"
|
53
53
|
# basic update with force option set
|
54
|
-
compass "--force", "--boring"
|
54
|
+
compass "compile", "--force", "--boring"
|
55
55
|
assert_action_performed :identical, "stylesheets/screen.css"
|
56
56
|
end
|
57
57
|
end
|
data/test/compass_test.rb
CHANGED
@@ -47,7 +47,7 @@ class CompassTest < Test::Unit::TestCase
|
|
47
47
|
assert_no_errors css_file, 'compass'
|
48
48
|
end
|
49
49
|
each_sass_file do |sass_file|
|
50
|
-
assert_renders_correctly sass_file
|
50
|
+
assert_renders_correctly sass_file, :ignore_charset => true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -86,8 +86,12 @@ private
|
|
86
86
|
for name in arguments
|
87
87
|
actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css"
|
88
88
|
expected_result_file = "#{result_path(@current_project)}/#{name}.css"
|
89
|
-
actual_lines = File.read(actual_result_file)
|
90
|
-
|
89
|
+
actual_lines = File.read(actual_result_file)
|
90
|
+
actual_lines.gsub!(/^@charset[^;]+;/,'') if options[:ignore_charset]
|
91
|
+
actual_lines = actual_lines.split("\n").reject{|l| l=~/\A\Z/}
|
92
|
+
expected_lines = ERB.new(File.read(expected_result_file)).result(binding)
|
93
|
+
expected_lines.gsub!(/^@charset[^;]+;/,'') if options[:ignore_charset]
|
94
|
+
expected_lines = expected_lines.split("\n").reject{|l| l=~/\A\Z/}
|
91
95
|
expected_lines.zip(actual_lines).each_with_index do |pair, line|
|
92
96
|
message = "template: #{name}\nline: #{line + 1}"
|
93
97
|
assert_equal(pair.first, pair.last, message)
|
data/test/rails_helper.rb
CHANGED
@@ -39,7 +39,7 @@ class RailsIntegrationTest < Test::Unit::TestCase
|
|
39
39
|
within_tmp_directory do
|
40
40
|
generate_rails_app_directories("compass_rails")
|
41
41
|
Dir.chdir "compass_rails" do
|
42
|
-
compass(*%w(
|
42
|
+
compass(*%w(init rails --trace --boring --sass-dir app/stylesheets --css-dir public/stylesheets/compiled .))
|
43
43
|
assert_action_performed :create, "./app/stylesheets/screen.scss"
|
44
44
|
assert_action_performed :create, "./config/initializers/compass.rb"
|
45
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -3702664206
|
5
4
|
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 11
|
9
8
|
- alpha
|
10
|
-
-
|
11
|
-
version: 0.11.alpha.
|
9
|
+
- 4
|
10
|
+
version: 0.11.alpha.4
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Chris Eppstein
|
@@ -19,7 +18,7 @@ autorequire:
|
|
19
18
|
bindir: bin
|
20
19
|
cert_chain: []
|
21
20
|
|
22
|
-
date: 2010-12-
|
21
|
+
date: 2010-12-10 00:00:00 -08:00
|
23
22
|
default_executable: compass
|
24
23
|
dependencies:
|
25
24
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +29,6 @@ dependencies:
|
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
hash: -3702664376
|
34
32
|
segments:
|
35
33
|
- 3
|
36
34
|
- 1
|
@@ -48,7 +46,6 @@ dependencies:
|
|
48
46
|
requirements:
|
49
47
|
- - ~>
|
50
48
|
- !ruby/object:Gem::Version
|
51
|
-
hash: 49
|
52
49
|
segments:
|
53
50
|
- 0
|
54
51
|
- 10
|
@@ -340,6 +337,7 @@ files:
|
|
340
337
|
- lib/compass/app_integration.rb
|
341
338
|
- lib/compass/commands/base.rb
|
342
339
|
- lib/compass/commands/create_project.rb
|
340
|
+
- lib/compass/commands/default.rb
|
343
341
|
- lib/compass/commands/generate_grid_background.rb
|
344
342
|
- lib/compass/commands/help.rb
|
345
343
|
- lib/compass/commands/imports.rb
|
@@ -562,7 +560,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
562
560
|
requirements:
|
563
561
|
- - ">="
|
564
562
|
- !ruby/object:Gem::Version
|
565
|
-
hash: 3
|
566
563
|
segments:
|
567
564
|
- 0
|
568
565
|
version: "0"
|
@@ -571,7 +568,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
571
568
|
requirements:
|
572
569
|
- - ">"
|
573
570
|
- !ruby/object:Gem::Version
|
574
|
-
hash: 25
|
575
571
|
segments:
|
576
572
|
- 1
|
577
573
|
- 3
|