ObjCLocalizableConst 1.0.2 → 1.0.4
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.
- checksums.yaml +4 -4
- data/bin/ObjCLocalizableConst +1 -1
- data/lib/ObjCLocalizableConstGenerate.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ba6da5f867ac3038f48da56e4818de9dc6a6a0f
|
|
4
|
+
data.tar.gz: 83899797a584fe6153f4d5d7fa06b0b153351399
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76f2153390f1797f92094149949ecb96abff649ad4b478bd084ae59dd1c54cf1c30af25ee6e1921a55d7310a178a54fa39ff2e31a8c56d525847e3a8057389c4
|
|
7
|
+
data.tar.gz: 22293a7956dcf3f6221e0d4fd50277e18dbd5a506d901652d6690a6ed3649d4ebf01f0e975667a1423e7814b8a2eca9d1c1e8eab6715fa34740faa2d468237e3
|
data/bin/ObjCLocalizableConst
CHANGED
|
@@ -22,7 +22,7 @@ command :generate do |c|
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
command :replace do |c|
|
|
25
|
-
c.syntax = 'replace <
|
|
25
|
+
c.syntax = 'replace <ConstantFile> <Folder or File> [options]'
|
|
26
26
|
c.summary = 'Replace Strings in Folder using ConstFile.h'
|
|
27
27
|
c.example 'description', 'replace {PATH} {DIR or FILE}'
|
|
28
28
|
|
|
@@ -4,10 +4,10 @@ class ObjCLocalizableConstGenerate
|
|
|
4
4
|
fail 'É necessário informar onde deseja salvar o arquivo' if path.nil?
|
|
5
5
|
|
|
6
6
|
@contentConst = File.read(constantFile)
|
|
7
|
-
regx = /"(
|
|
7
|
+
regx = /"(.*)"\s*=\s*"(.*)"\s*;/
|
|
8
8
|
@contentConst.gsub!(regx) do
|
|
9
9
|
key = $1
|
|
10
|
-
"static NSString * const
|
|
10
|
+
"static NSString * const kLocalized#{key.gsub(".","_").camelcase} = @\"#{key}\";"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
File.open(path, "w") {|file| file.puts @contentConst }
|