chriseppstein-compass 0.8.12 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +7 -0
- data/REVISION +1 -1
- data/VERSION.yml +1 -1
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +10 -0
- data/lib/compass/commands/watch_project.rb +22 -8
- data/lib/vendor/fssm.rb +30 -0
- data/lib/vendor/fssm/backends/fsevents.rb +78 -0
- data/lib/vendor/fssm/backends/polling.rb +24 -0
- data/lib/vendor/fssm/ext.rb +7 -0
- data/lib/vendor/fssm/monitor.rb +21 -0
- data/lib/vendor/fssm/path.rb +88 -0
- data/lib/vendor/fssm/state.rb +46 -0
- data/lib/vendor/fssm/support.rb +26 -0
- metadata +12 -3
data/CHANGELOG.markdown
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
COMPASS CHANGELOG
|
2
2
|
=================
|
3
3
|
|
4
|
+
0.8.13 (August 30, 2009)
|
5
|
+
------------------------
|
6
|
+
|
7
|
+
* [Blueprint] Mixins have been added for these as +prepend-top and +append-bottom and grid classes will be generated by +blueprint-grid.
|
8
|
+
* [Command Line] The watch mode has been re-implemented to use the FSSM library by Travis Tilley. OSX users will
|
9
|
+
now have support for filesystem monitoring. Fixes an infinite looping bug that occured with syntax users.
|
10
|
+
|
4
11
|
0.8.12 (August 22, 2009)
|
5
12
|
------------------------
|
6
13
|
|
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3ce66e278b2a7a526151bc7c1ab5b344d398f451
|
data/VERSION.yml
CHANGED
@@ -66,6 +66,10 @@
|
|
66
66
|
@for !n from 1 through !blueprint_grid_columns
|
67
67
|
.push-#{!n}
|
68
68
|
+push-margins(!n)
|
69
|
+
.prepend-top
|
70
|
+
+prepend-top
|
71
|
+
.append-bottom
|
72
|
+
+append-bottom
|
69
73
|
|
70
74
|
|
71
75
|
// Columns
|
@@ -111,6 +115,12 @@
|
|
111
115
|
=prepend(!n)
|
112
116
|
:padding-left = (!blueprint_grid_outer_width) * !n
|
113
117
|
|
118
|
+
=append-bottom(!amount = 1.5em)
|
119
|
+
:margin-bottom= !amount
|
120
|
+
|
121
|
+
=prepend-top(!amount = 1.5em)
|
122
|
+
:margin-top= !amount
|
123
|
+
|
114
124
|
=pull-base
|
115
125
|
+float-left
|
116
126
|
:position relative
|
@@ -14,17 +14,30 @@ module Compass
|
|
14
14
|
puts ""
|
15
15
|
exit 0
|
16
16
|
end
|
17
|
+
|
18
|
+
recompile
|
19
|
+
|
17
20
|
puts ">>> Compass is watching for changes. Press Ctrl-C to Stop."
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
|
22
|
+
require File.join(Compass.lib_directory, 'vendor', 'fssm')
|
23
|
+
|
24
|
+
FSSM.monitor do |monitor|
|
25
|
+
Compass.configuration.sass_load_paths.each do |load_path|
|
26
|
+
monitor.path load_path do |path|
|
27
|
+
path.glob '**/*.sass'
|
28
|
+
|
29
|
+
path.update &method(:recompile)
|
30
|
+
path.delete {|base, relative| remove_obsolete_css(base,relative); recompile(base, relative)}
|
31
|
+
path.create &method(:recompile)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
24
35
|
end
|
36
|
+
|
25
37
|
end
|
26
38
|
|
27
|
-
def remove_obsolete_css(
|
39
|
+
def remove_obsolete_css(base = nil, relative = nil)
|
40
|
+
compiler = new_compiler_instance(:quiet => true)
|
28
41
|
sass_files = compiler.sass_files
|
29
42
|
deleted_sass_files = (last_sass_files || []) - sass_files
|
30
43
|
deleted_sass_files.each do |deleted_sass_file|
|
@@ -34,7 +47,8 @@ module Compass
|
|
34
47
|
self.last_sass_files = sass_files
|
35
48
|
end
|
36
49
|
|
37
|
-
def recompile(
|
50
|
+
def recompile(base = nil, relative = nil)
|
51
|
+
compiler = new_compiler_instance(:quiet => true)
|
38
52
|
if file = compiler.out_of_date?
|
39
53
|
begin
|
40
54
|
puts ">>> Change detected to: #{file}"
|
data/lib/vendor/fssm.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module FSSM
|
2
|
+
FileNotFoundError = Class.new(StandardError)
|
3
|
+
CallbackError = Class.new(StandardError)
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def monitor(*args, &block)
|
7
|
+
monitor = FSSM::Monitor.new
|
8
|
+
context = args.empty? ? monitor : monitor.path(*args)
|
9
|
+
if block && block.arity == 0
|
10
|
+
context.instance_eval(&block)
|
11
|
+
elsif block && block.arity == 1
|
12
|
+
block.call(context)
|
13
|
+
end
|
14
|
+
monitor.run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
$:.unshift(File.dirname(__FILE__))
|
20
|
+
require 'pathname'
|
21
|
+
require 'fssm/ext'
|
22
|
+
require 'fssm/support'
|
23
|
+
require 'fssm/path'
|
24
|
+
require 'fssm/state'
|
25
|
+
require 'fssm/monitor'
|
26
|
+
|
27
|
+
require "fssm/backends/#{FSSM::Support.backend.downcase}"
|
28
|
+
FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
|
29
|
+
$:.shift
|
30
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module FSSM::Backends
|
2
|
+
class FSEvents
|
3
|
+
def initialize(options={})
|
4
|
+
@streams = []
|
5
|
+
@handlers = {}
|
6
|
+
@allocator = options[:allocator] || OSX::KCFAllocatorDefault
|
7
|
+
@context = options[:context] || nil
|
8
|
+
@since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
|
9
|
+
@latency = options[:latency] || 0.0
|
10
|
+
@flags = options[:flags] || 0
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_path(path, preload=true)
|
14
|
+
@handlers["#{path}"] = FSSM::State.new(path, preload)
|
15
|
+
|
16
|
+
cb = lambda do |stream, context, number, paths, flags, ids|
|
17
|
+
paths.regard_as('*')
|
18
|
+
watched = OSX.FSEventStreamCopyPathsBeingWatched(stream).first
|
19
|
+
@handlers["#{watched}"].refresh
|
20
|
+
# TODO: support this level of granularity
|
21
|
+
# number.times do |n|
|
22
|
+
# @handlers["#{watched}"].refresh_path(paths[n])
|
23
|
+
# end
|
24
|
+
end
|
25
|
+
|
26
|
+
@streams << create_stream(cb, "#{path}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
@streams.each do |stream|
|
31
|
+
schedule_stream(stream)
|
32
|
+
start_stream(stream)
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
OSX.CFRunLoopRun
|
37
|
+
rescue Interrupt
|
38
|
+
@streams.each do |stream|
|
39
|
+
stop_stream(stream)
|
40
|
+
invalidate_stream(stream)
|
41
|
+
release_stream(stream)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def create_stream(callback, paths)
|
50
|
+
paths = [paths] unless paths.is_a?(Array)
|
51
|
+
OSX.FSEventStreamCreate(@allocator, callback, @context, paths, @since, @latency, @flags)
|
52
|
+
end
|
53
|
+
|
54
|
+
def schedule_stream(stream, options={})
|
55
|
+
run_loop = options[:run_loop] || OSX.CFRunLoopGetCurrent
|
56
|
+
loop_mode = options[:loop_mode] || OSX::KCFRunLoopDefaultMode
|
57
|
+
|
58
|
+
OSX.FSEventStreamScheduleWithRunLoop(stream, run_loop, loop_mode)
|
59
|
+
end
|
60
|
+
|
61
|
+
def start_stream(stream)
|
62
|
+
OSX.FSEventStreamStart(stream)
|
63
|
+
end
|
64
|
+
|
65
|
+
def stop_stream(stream)
|
66
|
+
OSX.FSEventStreamStop(stream)
|
67
|
+
end
|
68
|
+
|
69
|
+
def invalidate_stream(stream)
|
70
|
+
OSX.FSEventStreamInvalidate(stream)
|
71
|
+
end
|
72
|
+
|
73
|
+
def release_stream(stream)
|
74
|
+
OSX.FSEventStreamRelease(stream)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module FSSM::Backends
|
2
|
+
class Polling
|
3
|
+
def initialize(options={})
|
4
|
+
@handlers = []
|
5
|
+
@latency = options[:latency] || 1
|
6
|
+
end
|
7
|
+
|
8
|
+
def add_path(path, preload=true)
|
9
|
+
@handlers << FSSM::State.new(path, preload)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
begin
|
14
|
+
loop do
|
15
|
+
start = Time.now.to_f
|
16
|
+
@handlers.each {|handler| handler.refresh}
|
17
|
+
nap_time = @latency - (Time.now.to_f - start)
|
18
|
+
sleep nap_time if nap_time > 0
|
19
|
+
end
|
20
|
+
rescue Interrupt
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class FSSM::Monitor
|
2
|
+
def initialize(options={})
|
3
|
+
@options = options
|
4
|
+
@backend = FSSM::Backends::Default.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def path(*args, &block)
|
8
|
+
path = FSSM::Path.new(*args)
|
9
|
+
if block && block.arity == 0
|
10
|
+
path.instance_eval(&block)
|
11
|
+
elsif block && block.arity == 1
|
12
|
+
block.call(path)
|
13
|
+
end
|
14
|
+
@backend.add_path(path)
|
15
|
+
path
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
@backend.run
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class FSSM::Path
|
2
|
+
def initialize(path=nil, glob=nil, &block)
|
3
|
+
set_path(path || '.')
|
4
|
+
set_glob(glob || '**/*')
|
5
|
+
init_callbacks
|
6
|
+
if block && block.arity == 0
|
7
|
+
self.instance_eval(&block)
|
8
|
+
elsif block && block.arity == 1
|
9
|
+
block.call(self)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
@path.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_pathname
|
18
|
+
@path
|
19
|
+
end
|
20
|
+
|
21
|
+
def glob(value=nil)
|
22
|
+
return @glob if value.nil?
|
23
|
+
set_glob(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create(callback_or_path=nil, &block)
|
27
|
+
callback_action(:create, (block_given? ? block : callback_or_path))
|
28
|
+
end
|
29
|
+
|
30
|
+
def update(callback_or_path=nil, &block)
|
31
|
+
callback_action(:update, (block_given? ? block : callback_or_path))
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete(callback_or_path=nil, &block)
|
35
|
+
callback_action(:delete, (block_given? ? block : callback_or_path))
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def init_callbacks
|
41
|
+
do_nothing = lambda {|base, relative|}
|
42
|
+
@callbacks = Hash.new(do_nothing)
|
43
|
+
end
|
44
|
+
|
45
|
+
def callback_action(type, arg=nil)
|
46
|
+
if arg.is_a?(Proc)
|
47
|
+
set_callback(type, arg)
|
48
|
+
elsif arg.nil?
|
49
|
+
get_callback(type)
|
50
|
+
else
|
51
|
+
run_callback(type, arg)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def set_callback(type, arg)
|
56
|
+
raise ArgumentError, "Proc expected" unless arg.is_a?(Proc)
|
57
|
+
@callbacks[type] = arg
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_callback(type)
|
61
|
+
@callbacks[type]
|
62
|
+
end
|
63
|
+
|
64
|
+
def run_callback(type, arg)
|
65
|
+
base, relative = split_path(arg)
|
66
|
+
|
67
|
+
begin
|
68
|
+
@callbacks[type].call(base, relative)
|
69
|
+
rescue Exception => e
|
70
|
+
raise FSSM::CallbackError, "#{type} - #{base.join(relative)}: #{e.message}", e.backtrace
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def split_path(path)
|
75
|
+
path = Pathname.for(path)
|
76
|
+
[@path, (path.relative? ? path : path.relative_path_from(@path))]
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_path(path)
|
80
|
+
path = Pathname.for(path)
|
81
|
+
raise FSSM::FileNotFoundError, "#{path}" unless path.exist?
|
82
|
+
@path = path.realpath
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_glob(glob)
|
86
|
+
@glob = glob.is_a?(Array) ? glob : [glob]
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class FSSM::State
|
2
|
+
def initialize(path, preload=true)
|
3
|
+
@path = path
|
4
|
+
@snapshot = {}
|
5
|
+
snapshot if preload
|
6
|
+
end
|
7
|
+
|
8
|
+
def refresh
|
9
|
+
previous = @snapshot
|
10
|
+
current = snapshot
|
11
|
+
|
12
|
+
deleted(previous, current)
|
13
|
+
created(previous, current)
|
14
|
+
modified(previous, current)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def created(previous, current)
|
20
|
+
(current.keys - previous.keys).each {|created| @path.create(created)}
|
21
|
+
end
|
22
|
+
|
23
|
+
def deleted(previous, current)
|
24
|
+
(previous.keys - current.keys).each {|deleted| @path.delete(deleted)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def modified(previous, current)
|
28
|
+
(current.keys & previous.keys).each do |file|
|
29
|
+
@path.update(file) if (current[file] <=> previous[file]) != 0
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def snapshot
|
34
|
+
snap = {}
|
35
|
+
@path.glob.each {|glob| add_glob(snap, glob)}
|
36
|
+
@snapshot = snap
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_glob(snap, glob)
|
40
|
+
Pathname.glob(@path.to_pathname.join(glob)).each do |fn|
|
41
|
+
next unless fn.file?
|
42
|
+
snap["#{fn}"] = fn.mtime
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module FSSM::Support
|
2
|
+
class << self
|
3
|
+
# def backend
|
4
|
+
# (mac? && carbon_core?) ? 'FSEvents' : 'Polling'
|
5
|
+
# end
|
6
|
+
|
7
|
+
def backend
|
8
|
+
'Polling'
|
9
|
+
end
|
10
|
+
|
11
|
+
def mac?
|
12
|
+
@@mac ||= RUBY_PLATFORM =~ /darwin/i
|
13
|
+
end
|
14
|
+
|
15
|
+
def carbon_core?
|
16
|
+
@@carbon_core ||= begin
|
17
|
+
require 'osx/foundation'
|
18
|
+
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
|
19
|
+
true
|
20
|
+
rescue LoadError
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chriseppstein-compass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Eppstein
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-30 00:00:00 -07:00
|
13
13
|
default_executable: compass
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -260,6 +260,14 @@ files:
|
|
260
260
|
- lib/compass/test_case.rb
|
261
261
|
- lib/compass/validator.rb
|
262
262
|
- lib/compass/version.rb
|
263
|
+
- lib/vendor/fssm.rb
|
264
|
+
- lib/vendor/fssm/backends/fsevents.rb
|
265
|
+
- lib/vendor/fssm/backends/polling.rb
|
266
|
+
- lib/vendor/fssm/ext.rb
|
267
|
+
- lib/vendor/fssm/monitor.rb
|
268
|
+
- lib/vendor/fssm/path.rb
|
269
|
+
- lib/vendor/fssm/state.rb
|
270
|
+
- lib/vendor/fssm/support.rb
|
263
271
|
- test/command_line_helper.rb
|
264
272
|
- test/command_line_test.rb
|
265
273
|
- test/compass_test.rb
|
@@ -297,6 +305,7 @@ files:
|
|
297
305
|
- test/test_rails_helper.rb
|
298
306
|
has_rdoc: false
|
299
307
|
homepage: http://compass-style.org
|
308
|
+
licenses:
|
300
309
|
post_install_message:
|
301
310
|
rdoc_options:
|
302
311
|
- --charset=UTF-8
|
@@ -317,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
326
|
requirements: []
|
318
327
|
|
319
328
|
rubyforge_project: compass
|
320
|
-
rubygems_version: 1.
|
329
|
+
rubygems_version: 1.3.5
|
321
330
|
signing_key:
|
322
331
|
specification_version: 3
|
323
332
|
summary: A Real Stylesheet Framework
|