css_parser 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -291,7 +291,10 @@ module CssParser
291
291
  base_uri = uri if base_uri.nil?
292
292
 
293
293
  src, charset = read_remote_file(uri)
294
- add_block!(src, {:media_types => media_types, :base_uri => base_uri})
294
+
295
+ if src
296
+ add_block!(src, {:media_types => media_types, :base_uri => base_uri})
297
+ end
295
298
  end
296
299
 
297
300
  # Load a local CSS file.
@@ -381,6 +384,7 @@ module CssParser
381
384
  end
382
385
  rescue
383
386
  raise RemoteFileError if @options[:io_exceptions]
387
+ return nil, nil
384
388
  end
385
389
 
386
390
  return src, charset
data/lib/css_parser.rb CHANGED
@@ -7,7 +7,7 @@ require 'stringio'
7
7
  require 'iconv'
8
8
 
9
9
  module CssParser
10
- VERSION = '1.1.2'
10
+ VERSION = '1.1.4'
11
11
 
12
12
  # Merge multiple CSS RuleSets by cascading according to the CSS 2.1 cascading rules
13
13
  # (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order).
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Test cases for reading and generating CSS shorthand properties
4
4
  class CssParserBasicTests < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Test cases for the CssParser's loading functions.
4
4
  class CssParserLoadingTests < Test::Unit::TestCase
@@ -39,7 +39,7 @@ class CssParserLoadingTests < Test::Unit::TestCase
39
39
  end
40
40
 
41
41
  def test_loading_a_local_file_with_scheme
42
- file_name = 'file://' + File.dirname(__FILE__) + '/fixtures/simple.css'
42
+ file_name = 'file://' + File.expand_path(File.dirname(__FILE__)) + '/fixtures/simple.css'
43
43
  @cp.load_uri!(file_name)
44
44
  assert_equal 'margin: 0px;', @cp.find_by_selector('p').join(' ')
45
45
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Test cases for the handling of media types
4
4
  class CssParserMediaTypesTests < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Test cases for the CssParser.
4
4
  class CssParserTests < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
  # coding: iso-8859-1
2
- require File.dirname(__FILE__) + '/test_helper'
2
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
3
3
 
4
4
  # Test cases for CSS regular expressions
5
5
  #
data/test/test_merging.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  class MergingTests < Test::Unit::TestCase
4
4
  include CssParser
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require "set"
3
3
 
4
4
  # Test cases for parsing CSS blocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Test cases for reading and generating CSS shorthand properties
4
4
  class RuleSetCreatingShorthandTests < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  class RuleSetExpandingShorthandTests < Test::Unit::TestCase
4
4
  include CssParser
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 1
9
- - 3
10
- version: 1.1.3
8
+ - 4
9
+ version: 1.1.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Alex Dunae
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-03 00:00:00 -07:00
17
+ date: 2010-11-11 00:00:00 -08:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -65,7 +64,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
- hash: 3
69
67
  segments:
70
68
  - 0
71
69
  version: "0"
@@ -74,7 +72,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ">="
76
74
  - !ruby/object:Gem::Version
77
- hash: 3
78
75
  segments:
79
76
  - 0
80
77
  version: "0"