hash_rocket 0.3.2 → 0.3.3
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/Gemfile.lock +1 -1
- data/README.md +0 -6
- data/lib/hash_rocket/version.rb +1 -1
- data/lib/hash_rocket.rb +9 -3
- data/spec/data/Gemfile +3 -0
- data/spec/data/file.erb +3 -0
- data/spec/data/file.haml +3 -0
- data/spec/data/file.html +3 -0
- data/spec/data/file.rb +3 -0
- data/spec/data/file.yml +3 -0
- data/spec/data/result.txt +4 -0
- data/spec/hash_rocket_spec.rb +3 -2
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -48,10 +48,4 @@ Notes:
|
|
48
48
|
|
49
49
|
This script will prompt you the files he cannot parse
|
50
50
|
--> ERROR ON /path/to/the/problematic/file
|
51
|
-
## Contributing
|
52
51
|
|
53
|
-
1. Fork it
|
54
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
56
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
-
5. Create new Pull Request
|
data/lib/hash_rocket/version.rb
CHANGED
data/lib/hash_rocket.rb
CHANGED
@@ -7,6 +7,7 @@ module HashRocket
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.convert(folder=nil, path=nil, verbose=nil)
|
10
|
+
puts ".... #{path}"
|
10
11
|
file_names = path_parameters(folder, path)
|
11
12
|
file_names.each do |fn|
|
12
13
|
if fn =~ /(Gemfile|\.(erb|rb|html|haml|spec))/
|
@@ -33,12 +34,17 @@ private
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def self.solve_invalid_byte_sequence_in_utf8(text)
|
36
|
-
|
37
|
-
|
37
|
+
if defined?(Rails)
|
38
|
+
text.encode!('UTF-16', undef: :replace, invalid: :replace, replace: "")
|
39
|
+
puts "mouahha1"
|
40
|
+
return text.encode!('UTF-8')
|
41
|
+
else
|
42
|
+
return text
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def self.organize_symbols(text, verbose)
|
41
|
-
result = text.scan(/([^:]:\w{1,}(\ {1,}|[\ {1,}]?)=>(\ {1,}|[\ ]?))/).flatten
|
47
|
+
result = text.scan(/([^:]:\w{1,}(\ {1,}|[\ {1,}]?)=>(\ {1,}|[\ ]?))|(^:\w{1,}(\ {1,}|[\ {1,}]?)=>(\ {1,}|[\ ]?))/).flatten
|
42
48
|
text = match_symbols(text, result, verbose) if result
|
43
49
|
text
|
44
50
|
end
|
data/spec/data/Gemfile
CHANGED
data/spec/data/file.erb
CHANGED
data/spec/data/file.haml
CHANGED
data/spec/data/file.html
CHANGED
data/spec/data/file.rb
CHANGED
data/spec/data/file.yml
CHANGED
data/spec/data/result.txt
CHANGED
data/spec/hash_rocket_spec.rb
CHANGED
@@ -5,13 +5,14 @@ describe HashRocket do
|
|
5
5
|
let(:folder) { File.expand_path('../..',__FILE__) + "/spec/data" }
|
6
6
|
let(:result) { "/result.txt" }
|
7
7
|
|
8
|
-
|
8
|
+
context "hash_rocket should be replaced if the file extention is supported: " do
|
9
9
|
|
10
10
|
before :each do
|
11
11
|
@file = folder + example.metadata[:file_ext]
|
12
12
|
@backup = File.read(@file)
|
13
|
-
HashRocket.convert(nil, @file,
|
13
|
+
HashRocket.convert(nil, @file, true)
|
14
14
|
@conversion = File.read(@file)
|
15
|
+
puts @conversion
|
15
16
|
end
|
16
17
|
|
17
18
|
after :each do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_rocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70201732751120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70201732751120
|
25
25
|
description: find and replace old hash rocket
|
26
26
|
email:
|
27
27
|
- mathieub@4nkh.com
|