less 2.0.4 → 2.0.5

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/less.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
23
  s.require_paths = ["lib"]
24
24
 
25
- s.add_dependency "therubyracer", "~> 0.9.1"
26
- s.add_development_dependency "rake", "~> 0.9.1"
25
+ s.add_dependency "therubyracer", "~> 0.9.2"
26
+ s.add_development_dependency "rake", "~> 0.9.2"
27
27
  s.add_development_dependency "rspec", "~> 2.0"
28
28
  end
29
29
 
data/lib/less/loader.rb CHANGED
@@ -1,17 +1,20 @@
1
1
 
2
2
  module Less
3
3
  class Loader
4
-
4
+ include CallJS
5
+
5
6
  def initialize
6
- @cxt = V8::Context.new
7
- @path = Pathname(__FILE__).dirname.join('js','lib')
8
- @exports = {
9
- "path" => Path.new,
10
- "sys" => Sys.new,
11
- "fs" => Fs.new
12
- }
13
- @process = Process.new
14
- @cxt['console'] = Console.new
7
+ lock do
8
+ @cxt = V8::Context.new
9
+ @path = Pathname(__FILE__).dirname.join('js','lib')
10
+ @exports = {
11
+ "path" => Path.new,
12
+ "sys" => Sys.new,
13
+ "fs" => Fs.new
14
+ }
15
+ @process = Process.new
16
+ @cxt['console'] = Console.new
17
+ end
15
18
  end
16
19
 
17
20
  def require(path)
@@ -19,9 +22,11 @@ module Less
19
22
  filename = path =~ /\.js$/ ? path : "#{path}.js"
20
23
  filepath = @path.join(filename)
21
24
  fail LoadError, "no such file: #{filename}" unless filepath.exist?
22
- load = @cxt.eval("(function(process, require, exports, __dirname) {require.paths = [];#{File.read(filepath)}})", filepath.expand_path)
23
- @exports[path] = exports = @cxt['Object'].new
24
- load.call(@process, method(:require), exports, Dir.pwd)
25
+ lock do
26
+ load = @cxt.eval("(function(process, require, exports, __dirname) {require.paths = [];#{File.read(filepath)}})", filepath.expand_path)
27
+ @exports[path] = exports = @cxt['Object'].new
28
+ load.call(@process, method(:require), exports, Dir.pwd)
29
+ end
25
30
  end
26
31
  return exports
27
32
  end
data/lib/less/parser.rb CHANGED
@@ -9,10 +9,32 @@ module Less
9
9
  #
10
10
  # @yield code to wrap
11
11
  def calljs
12
- yield
12
+ lock do
13
+ yield
14
+ end
13
15
  rescue V8::JSError => e
14
16
  raise ParseError.new(e)
15
17
  end
18
+
19
+ # @private
20
+ # Ensure proper locking before entering the V8 API
21
+ #
22
+ # @yield code to wrap in lock
23
+ def lock
24
+ result, exception = nil, nil
25
+ V8::C::Locker() do
26
+ begin
27
+ result = yield
28
+ rescue Exception => e
29
+ exception = e
30
+ end
31
+ end
32
+ if exception
33
+ raise exception
34
+ else
35
+ result
36
+ end
37
+ end
16
38
  end
17
39
 
18
40
  # Convert lesscss source into an abstract syntax Tree
@@ -29,7 +51,9 @@ module Less
29
51
  options.each do |k,v|
30
52
  stringy[k.to_s] = v.is_a?(Array) ? v.map(&:to_s) : v.to_s
31
53
  end
32
- @parser = Less.Parser.new(stringy)
54
+ lock do
55
+ @parser = Less.Parser.new(stringy)
56
+ end
33
57
  end
34
58
 
35
59
  # Convert `less` source into a abstract syntaxt tree
data/lib/less/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Less
2
- VERSION = '2.0.4'
2
+ VERSION = '2.0.5'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: less
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.4
5
+ version: 2.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Charles Lowell
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-17 00:00:00 -05:00
13
+ date: 2011-06-24 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.1
23
+ version: 0.9.2
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: *id001
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 0.9.1
34
+ version: 0.9.2
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: *id002
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="
183
183
  - !ruby/object:Gem::Version
184
- hash: -2388107400795165815
184
+ hash: 2860711812237804044
185
185
  segments:
186
186
  - 0
187
187
  version: "0"
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - ">="
192
192
  - !ruby/object:Gem::Version
193
- hash: -2388107400795165815
193
+ hash: 2860711812237804044
194
194
  segments:
195
195
  - 0
196
196
  version: "0"