sass 3.2.0.alpha.11 → 3.2.0.alpha.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/REVISION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/sass/cache_stores/base.rb +4 -9
  4. data/lib/sass/cache_stores/filesystem.rb +2 -0
  5. data/lib/sass/css.rb +2 -1
  6. data/lib/sass/engine.rb +28 -8
  7. data/lib/sass/environment.rb +26 -0
  8. data/lib/sass/exec.rb +13 -0
  9. data/lib/sass/importers/base.rb +2 -1
  10. data/lib/sass/script/funcall.rb +8 -0
  11. data/lib/sass/script/interpolation.rb +9 -0
  12. data/lib/sass/script/list.rb +7 -0
  13. data/lib/sass/script/literal.rb +5 -0
  14. data/lib/sass/script/node.rb +8 -0
  15. data/lib/sass/script/number.rb +28 -5
  16. data/lib/sass/script/operation.rb +8 -0
  17. data/lib/sass/script/string_interpolation.rb +9 -0
  18. data/lib/sass/script/unary_operation.rb +7 -0
  19. data/lib/sass/script/variable.rb +5 -0
  20. data/lib/sass/scss/parser.rb +26 -13
  21. data/lib/sass/scss/rx.rb +1 -1
  22. data/lib/sass/scss/static_parser.rb +2 -2
  23. data/lib/sass/tree/content_node.rb +9 -0
  24. data/lib/sass/tree/debug_node.rb +1 -6
  25. data/lib/sass/tree/each_node.rb +1 -7
  26. data/lib/sass/tree/extend_node.rb +1 -1
  27. data/lib/sass/tree/for_node.rb +2 -7
  28. data/lib/sass/tree/function_node.rb +1 -6
  29. data/lib/sass/tree/if_node.rb +1 -19
  30. data/lib/sass/tree/mixin_def_node.rb +5 -6
  31. data/lib/sass/tree/mixin_node.rb +2 -7
  32. data/lib/sass/tree/node.rb +4 -19
  33. data/lib/sass/tree/prop_node.rb +0 -5
  34. data/lib/sass/tree/return_node.rb +1 -6
  35. data/lib/sass/tree/rule_node.rb +9 -7
  36. data/lib/sass/tree/trace_node.rb +32 -0
  37. data/lib/sass/tree/variable_node.rb +1 -7
  38. data/lib/sass/tree/visitors/check_nesting.rb +30 -13
  39. data/lib/sass/tree/visitors/convert.rb +5 -1
  40. data/lib/sass/tree/visitors/cssize.rb +3 -3
  41. data/lib/sass/tree/visitors/deep_copy.rb +87 -0
  42. data/lib/sass/tree/visitors/perform.rb +36 -16
  43. data/lib/sass/tree/visitors/set_options.rb +97 -0
  44. data/lib/sass/tree/visitors/to_css.rb +5 -1
  45. data/lib/sass/tree/warn_node.rb +1 -7
  46. data/lib/sass/tree/while_node.rb +1 -7
  47. data/test/sass/cache_test.rb +15 -0
  48. data/test/sass/conversion_test.rb +38 -0
  49. data/test/sass/css2sass_test.rb +9 -0
  50. data/test/sass/engine_test.rb +248 -17
  51. data/test/sass/scss/css_test.rb +4 -2
  52. data/test/sass/scss/scss_test.rb +53 -12
  53. data/vendor/fssm/Gemfile +3 -0
  54. data/vendor/fssm/LICENSE +1 -1
  55. data/vendor/fssm/README.markdown +55 -27
  56. data/vendor/fssm/Rakefile +6 -54
  57. data/vendor/fssm/example.rb +6 -3
  58. data/vendor/fssm/fssm.gemspec +17 -70
  59. data/vendor/fssm/lib/fssm.rb +7 -3
  60. data/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
  61. data/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
  62. data/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
  63. data/vendor/fssm/lib/fssm/backends/rbfsevent.rb +42 -0
  64. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
  65. data/vendor/fssm/lib/fssm/monitor.rb +19 -9
  66. data/vendor/fssm/lib/fssm/path.rb +24 -21
  67. data/vendor/fssm/lib/fssm/pathname.rb +13 -479
  68. data/vendor/fssm/lib/fssm/state/directory.rb +29 -11
  69. data/vendor/fssm/lib/fssm/state/file.rb +1 -1
  70. data/vendor/fssm/lib/fssm/support.rb +41 -12
  71. data/vendor/fssm/lib/fssm/tree.rb +6 -6
  72. data/vendor/fssm/lib/fssm/version.rb +3 -0
  73. data/vendor/fssm/profile/prof-cache.rb +3 -3
  74. data/vendor/fssm/profile/prof-pathname-rubinius.rb +35 -0
  75. data/vendor/fssm/profile/prof-pathname.rb +7 -7
  76. data/vendor/fssm/spec/count_down_latch.rb +151 -0
  77. data/vendor/fssm/spec/monitor_spec.rb +202 -0
  78. data/vendor/fssm/spec/path_spec.rb +36 -15
  79. data/vendor/fssm/spec/spec_helper.rb +6 -6
  80. metadata +14 -4
  81. data/vendor/fssm/VERSION.yml +0 -5
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Travis Tilley
1
+ Copyright (c) 2011 Travis Tilley
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,3 +1,5 @@
1
+ # FSSM ![project status](http://stillmaintained.com/ttilley/fssm.png) #
2
+
1
3
  Monitor API
2
4
  ===========
3
5
 
@@ -12,44 +14,70 @@ Monitor with path
12
14
 
13
15
  This form watches one path, and enters the run loop automatically. The first parameter is the path to watch, and the second parameter is an optional glob pattern or array of glob patterns that a file must match in order to trigger a callback. The default glob, if ommitted, is `'**/*'`.
14
16
 
15
- FSSM.monitor('/some/directory/', '**/*') do
16
- update {|base, relative|}
17
- delete {|base, relative|}
18
- create {|base, relative|}
19
- end
17
+ FSSM.monitor('/some/directory/', '**/*') do
18
+ update {|base, relative|}
19
+ delete {|base, relative|}
20
+ create {|base, relative|}
21
+ end
20
22
 
21
23
  Monitor with block
22
24
  ------------------
23
25
 
24
26
  This form watches one or more paths, and enters the run loop automatically. The glob configuration call can be ommitted, and defaults to `'**/*'`.
25
27
 
26
- FSSM.monitor do
27
- path '/some/directory/' do
28
- glob '**/*.yml'
29
-
30
- update {|base, relative|}
31
- delete {|base, relative|}
32
- create {|base, relative|}
33
- end
34
-
35
- path '/some/other/directory/' do
36
- update {|base, relative|}
37
- delete {|base, relative|}
38
- create {|base, relative|}
39
- end
40
- end
28
+ FSSM.monitor do
29
+ path '/some/directory/' do
30
+ glob '**/*.yml'
31
+
32
+ update {|base, relative|}
33
+ delete {|base, relative|}
34
+ create {|base, relative|}
35
+ end
36
+
37
+ path '/some/other/directory/' do
38
+ update {|base, relative|}
39
+ delete {|base, relative|}
40
+ create {|base, relative|}
41
+ end
42
+ end
41
43
 
42
44
  Monitor object
43
45
  --------------
44
46
 
45
47
  This form doesn't enter the run loop automatically.
46
48
 
47
- monitor = FSSM::Monitor.new
49
+ monitor = FSSM::Monitor.new
50
+
51
+ monitor.path '/some/directory/' do
52
+ update {|base, relative|}
53
+ delete {|base, relative|}
54
+ create {|base, relative|}
55
+ end
56
+
57
+ monitor.run
58
+
59
+ Monitoring directories
60
+ ----------------------
61
+
62
+ By default, FSSM monitors changes in files only. To enable monitoring of files and directories, pass option `directories => true` in a hash to the monitor. Please note that this may not work as expected in all backends. For example:
63
+
64
+ FSSM::Monitor.new(:directories => true)
65
+ FSSM.monitor(dir, file_glob, :directories => true)
66
+
67
+ When directories are monitored, there's an additional third argument to the callbacks. Instead of
68
+
69
+ FSSM.monitor('/some/directory/', '**/*') do
70
+ update {|base, relative|}
71
+ delete {|base, relative|}
72
+ create {|base, relative|}
73
+ end
74
+
75
+ you get this:
48
76
 
49
- monitor.path '/some/directory/' do
50
- update {|base, relative|}
51
- delete {|base, relative|}
52
- create {|base, relative|}
53
- end
77
+ FSSM.monitor('/some/directory/', '**/*', :directories => true) do
78
+ update {|base, relative, type|}
79
+ delete {|base, relative, type|}
80
+ create {|base, relative, type|}
81
+ end
54
82
 
55
- monitor.run
83
+ The value of `type` argument is either `:file` or `:directory`.
@@ -1,59 +1,11 @@
1
1
  require 'rubygems'
2
- require 'rake'
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "fssm"
8
- gem.summary = %Q{file system state monitor}
9
- gem.description = %Q{file system state monitor}
10
- gem.email = "ttilley@gmail.com"
11
- gem.homepage = "http://github.com/ttilley/fssm"
12
- gem.authors = ["Travis Tilley"]
13
- gem.add_development_dependency "rspec"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- rescue LoadError
17
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
- end
19
-
20
- require 'spec/rake/spectask'
21
- Spec::Rake::SpecTask.new(:spec) do |spec|
22
- spec.libs << 'lib' << 'spec'
23
- spec.spec_files = FileList['spec/**/*_spec.rb']
24
- end
25
-
26
- Spec::Rake::SpecTask.new(:rcov) do |spec|
27
- spec.libs << 'lib' << 'spec'
28
- spec.pattern = 'spec/**/*_spec.rb'
29
- spec.rcov = true
30
- end
31
-
32
- task :spec => :check_dependencies
33
-
34
- begin
35
- require 'reek/rake_task'
36
- Reek::RakeTask.new do |t|
37
- t.fail_on_error = true
38
- t.verbose = false
39
- t.source_files = 'lib/**/*.rb'
40
- end
41
- rescue LoadError
42
- task :reek do
43
- abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
44
- end
45
- end
46
-
47
- begin
48
- require 'roodi'
49
- require 'roodi_task'
50
- RoodiTask.new do |t|
51
- t.verbose = false
52
- end
53
- rescue LoadError
54
- task :roodi do
55
- abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
56
- end
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.rspec_opts = ["--color", "--backtrace", "--format", "documentation"]
8
+ spec.verbose = true
57
9
  end
58
10
 
59
11
  task :default => :spec
@@ -1,9 +1,12 @@
1
1
  $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
2
 
3
+ # for rb-inotify/rb-fsevent
4
+ require 'rubygems'
5
+
3
6
  require 'fssm'
4
7
 
5
8
  FSSM.monitor('.', '**/*') do
6
- update {|b, r| puts "Update in #{b} to #{r}"}
7
- delete {|b, r| puts "Delete in #{b} to #{r}"}
8
- create {|b, r| puts "Create in #{b} to #{r}"}
9
+ update { |b, r| puts "Update in #{b} to #{r}" }
10
+ delete { |b, r| puts "Delete in #{b} to #{r}" }
11
+ create { |b, r| puts "Create in #{b} to #{r}" }
9
12
  end
@@ -1,77 +1,24 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "fssm/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{fssm}
8
- s.version = "0.1.4"
6
+ s.name = "fssm"
7
+ s.version = FSSM::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Travis Tilley", "Nathan Weizenbaum", "Chris Eppstein",
10
+ "Jonathan Castello", "Tuomas Kareinen"]
11
+ s.email = ["ttilley@gmail.com"]
12
+ s.homepage = "https://github.com/ttilley/fssm"
13
+ s.summary = %q{File System State Monitor}
14
+ s.description = %q{The File System State Monitor keeps track of the state of any number of paths and will fire events when said state changes (create/update/delete). FSSM supports using FSEvents on MacOS, Inotify on GNU/Linux, and polling anywhere else.}
9
15
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Travis Tilley"]
12
- s.date = %q{2010-03-10}
13
- s.description = %q{file system state monitor}
14
- s.email = %q{ttilley@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.markdown"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.markdown",
24
- "Rakefile",
25
- "VERSION.yml",
26
- "example.rb",
27
- "fssm.gemspec",
28
- "lib/fssm.rb",
29
- "lib/fssm/backends/fsevents.rb",
30
- "lib/fssm/backends/inotify.rb",
31
- "lib/fssm/backends/polling.rb",
32
- "lib/fssm/backends/rubycocoa/fsevents.rb",
33
- "lib/fssm/monitor.rb",
34
- "lib/fssm/path.rb",
35
- "lib/fssm/pathname.rb",
36
- "lib/fssm/state/directory.rb",
37
- "lib/fssm/state/file.rb",
38
- "lib/fssm/support.rb",
39
- "lib/fssm/tree.rb",
40
- "profile/prof-cache.rb",
41
- "profile/prof-fssm-pathname.html",
42
- "profile/prof-pathname.rb",
43
- "profile/prof-plain-pathname.html",
44
- "profile/prof.html",
45
- "spec/path_spec.rb",
46
- "spec/root/duck/quack.txt",
47
- "spec/root/file.css",
48
- "spec/root/file.rb",
49
- "spec/root/file.yml",
50
- "spec/root/moo/cow.txt",
51
- "spec/spec_helper.rb"
52
- ]
53
- s.homepage = %q{http://github.com/ttilley/fssm}
54
- s.rdoc_options = ["--charset=UTF-8"]
55
- s.require_paths = ["lib"]
56
- s.rubygems_version = %q{1.3.6}
57
- s.summary = %q{file system state monitor}
58
- s.test_files = [
59
- "spec/path_spec.rb",
60
- "spec/spec_helper.rb",
61
- "spec/root/file.rb"
62
- ]
16
+ s.rubyforge_project = "fssm"
63
17
 
64
- if s.respond_to? :specification_version then
65
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
- s.specification_version = 3
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
67
22
 
68
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
- s.add_development_dependency(%q<rspec>, [">= 0"])
70
- else
71
- s.add_dependency(%q<rspec>, [">= 0"])
72
- end
73
- else
74
- s.add_dependency(%q<rspec>, [">= 0"])
75
- end
23
+ s.add_development_dependency "rspec", ">= 2.4.0"
76
24
  end
77
-
@@ -1,17 +1,20 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
3
 
4
+ #noinspection ALL
4
5
  module FSSM
5
6
  FileNotFoundError = Class.new(StandardError)
6
- CallbackError = Class.new(StandardError)
7
+ FileNotRealError = Class.new(StandardError)
8
+ CallbackError = Class.new(StandardError)
7
9
 
8
10
  class << self
9
11
  def dbg(msg=nil)
10
- STDERR.puts(msg)
12
+ STDERR.puts("FSSM -> #{msg}")
11
13
  end
12
14
 
13
15
  def monitor(*args, &block)
14
- monitor = FSSM::Monitor.new
16
+ options = args[-1].is_a?(Hash) ? args.pop : {}
17
+ monitor = FSSM::Monitor.new(options)
15
18
  FSSM::Support.use_block(args.empty? ? monitor : monitor.path(*args), block)
16
19
 
17
20
  monitor.run
@@ -21,6 +24,7 @@ end
21
24
 
22
25
  require 'thread'
23
26
 
27
+ require 'fssm/version'
24
28
  require 'fssm/pathname'
25
29
  require 'fssm/support'
26
30
  require 'fssm/tree'
@@ -10,7 +10,7 @@ module FSSM::Backends
10
10
  def add_handler(handler, preload=true)
11
11
  @handlers[handler.path.to_s] = handler
12
12
 
13
- fsevent = Rucola::FSEvents.new(handler.path.to_s, {:latency => 0.5}) do |events|
13
+ fsevent = Rucola::FSEvents.new(handler.path.to_s, {:latency => 0.5}) do |events|
14
14
  events.each do |event|
15
15
  handler.refresh(event.path)
16
16
  end
@@ -5,8 +5,8 @@ module FSSM::Backends
5
5
  end
6
6
 
7
7
  def add_handler(handler, preload=true)
8
- @notifier.watch(handler.path.to_s, :recursive, :attrib, :modify, :create,
9
- :delete, :delete_self, :moved_from, :moved_to, :move_self) do |event|
8
+ @notifier.watch(handler.path.to_s, :recursive, :attrib, :close_write, :create,
9
+ :delete, :delete_self, :moved_from, :moved_to, :move_self) do |event|
10
10
  path = FSSM::Pathname.for(event.absolute_name)
11
11
  path = path.dirname unless event.name == "" # Event on root directory
12
12
  handler.refresh(path)
@@ -2,7 +2,7 @@ module FSSM::Backends
2
2
  class Polling
3
3
  def initialize(options={})
4
4
  @handlers = []
5
- @latency = options[:latency] || 1.5
5
+ @latency = options[:latency] || 1.5
6
6
  end
7
7
 
8
8
  def add_handler(handler, preload=true)
@@ -14,7 +14,7 @@ module FSSM::Backends
14
14
  begin
15
15
  loop do
16
16
  start = Time.now.to_f
17
- @handlers.each {|handler| handler.refresh}
17
+ @handlers.each { |handler| handler.refresh }
18
18
  nap_time = @latency - (Time.now.to_f - start)
19
19
  sleep nap_time if nap_time > 0
20
20
  end
@@ -0,0 +1,42 @@
1
+ module FSSM::Backends
2
+ class RBFSEvent
3
+ def initialize
4
+ @handlers = []
5
+ end
6
+
7
+ def add_handler(handler, preload=true)
8
+ @handlers << handler
9
+ handler.refresh(nil, true) if preload
10
+ end
11
+
12
+ def run
13
+ begin
14
+ @fsevent = FSEvent.new
15
+ @fsevent.watch(temporary_multipath_hack) do |paths|
16
+ paths.each do |path|
17
+ temporary_multipath_handler(path)
18
+ end
19
+ end
20
+ @fsevent.run
21
+ rescue Interrupt
22
+ @fsevent.stop
23
+ end
24
+ end
25
+
26
+ def temporary_multipath_handler(path)
27
+ @handlers.each do |handler|
28
+ handler_path = File.join(handler.path.to_s, "")
29
+ if path.start_with?(handler_path)
30
+ handler.refresh(path)
31
+ break
32
+ end
33
+ end
34
+ end
35
+
36
+ def temporary_multipath_hack
37
+ @handlers = @handlers.sort {|x,y| y.path.to_pathname.segments.length <=> x.path.to_pathname.segments.length}
38
+ return @handlers.map {|handler| handler.path.to_s}
39
+ end
40
+
41
+ end
42
+ end
@@ -14,7 +14,7 @@ module Rucola
14
14
  # Returns an array of the files/dirs in the path that the event occurred in.
15
15
  # The files are sorted by the modification time, the first entry is the last modified file.
16
16
  def files
17
- Dir.glob("#{File.expand_path(path)}/*").sort_by {|f| File.mtime(f) }.reverse
17
+ Dir.glob("#{File.expand_path(path)}/*").sort_by { |f| File.mtime(f) }.reverse
18
18
  end
19
19
 
20
20
  # Returns the last modified file in the path that the event occurred in.
@@ -88,22 +88,22 @@ module Rucola
88
88
  raise ArgumentError, 'No callback block was specified.' unless block_given?
89
89
 
90
90
  options = params.last.kind_of?(Hash) ? params.pop : {}
91
- @paths = params.flatten
91
+ @paths = params.flatten
92
92
 
93
93
  paths.each { |path| raise ArgumentError, "The specified path (#{path}) does not exist." unless File.exist?(path) }
94
94
 
95
- @allocator = options[:allocator] || OSX::KCFAllocatorDefault
96
- @context = options[:context] || nil
97
- @since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
98
- @latency = options[:latency] || 0.0
99
- @flags = options[:flags] || 0
100
- @stream = options[:stream] || nil
95
+ @allocator = options[:allocator] || OSX::KCFAllocatorDefault
96
+ @context = options[:context] || nil
97
+ @since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
98
+ @latency = options[:latency] || 0.0
99
+ @flags = options[:flags] || 0
100
+ @stream = options[:stream] || nil
101
101
 
102
102
  @user_callback = block
103
- @callback = Proc.new do |stream, client_callback_info, number_of_events, paths_pointer, event_flags, event_ids|
103
+ @callback = Proc.new do |stream, client_callback_info, number_of_events, paths_pointer, event_flags, event_ids|
104
104
  paths_pointer.regard_as('*')
105
105
  events = []
106
- number_of_events.times {|i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) }
106
+ number_of_events.times { |i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) }
107
107
  @user_callback.call(events)
108
108
  end
109
109
  end