haml_lint 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11dfd8283a78d7d9464e3a003a7f97446178b76f
4
- data.tar.gz: de67f6e626da0bd9e3f91e1183af9d88af54d369
3
+ metadata.gz: 80e71cdb5e58b93dd53b7e4fe3eef1bba2002af5
4
+ data.tar.gz: a724e0a1cb1748cce64d430cd4ba34e82fc904ec
5
5
  SHA512:
6
- metadata.gz: bd464c7c0f1542a93a3bf3fa1b017117ffef544dbc6b5c95cd05c7a2ff99ff78362786d23b024b3608596acc8cc165eb3e3791d659a3752e87f6aff7506d702c
7
- data.tar.gz: 41b5410fc090a6151476edfdadc7d3f24eb7f2d0ed8e7d7065463901d382e412fc017694a6725532546095e08dc8b9eaa05274d30f99b93eb05786159e6465af
6
+ metadata.gz: 202ce87309496ebb5372e607f734348e9532a1c83cde72ada2b88fe2e6a5b5d4d26459b181de83e838bd35685dd12b36bf0b7b25405351811f734a809f78d6c8
7
+ data.tar.gz: f82080cf1c10090eee512efd10ef85eac22e751d49d488e9f94d889eed191c1203b85bd00411c1cb3b77a1076a93908ce18078213f9906427e1a2f51d8212ac2
@@ -37,6 +37,7 @@ module HamlLint
37
37
  # @param source [String] Haml code to parse
38
38
  # @raise [HamlLint::Exceptions::ParseError] if there was a problem parsing
39
39
  def process_source(source)
40
+ @source = process_encoding(source)
40
41
  @source = strip_frontmatter(source)
41
42
  @source_lines = @source.split("\n")
42
43
 
@@ -81,6 +82,18 @@ module HamlLint
81
82
  new_node
82
83
  end
83
84
 
85
+ # Ensures source code is interpreted as UTF-8.
86
+ #
87
+ # This is necessary as sometimes Ruby guesses the encoding of a file
88
+ # incorrectly, for example if the LC_ALL environment variable is set to "C".
89
+ # @see http://unix.stackexchange.com/a/87763
90
+ #
91
+ # @param source [String]
92
+ # @return [String] source encoded with UTF-8 encoding
93
+ def process_encoding(source)
94
+ source.force_encoding(Encoding::UTF_8)
95
+ end
96
+
84
97
  # Removes YAML frontmatter
85
98
  def strip_frontmatter(source)
86
99
  if config['skip_frontmatter'] &&
@@ -65,7 +65,7 @@ module HamlLint
65
65
  # @param str [String]
66
66
  # @return [String]
67
67
  def camel_case(str)
68
- str.split(/_|-| /).map { |part| part.sub(/^\w/) { |c| c.upcase } }.join
68
+ str.split(/_|-| /).map { |part| part.sub(/^\w/, &:upcase) }.join
69
69
  end
70
70
 
71
71
  # Find all consecutive items satisfying the given block of a minimum size,
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module HamlLint
3
- VERSION = '0.15.1'
3
+ VERSION = '0.15.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-03 00:00:00.000000000 Z
12
+ date: 2015-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml