i18n-cocoa 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf33f6d55b0323e9fc5c980f82f3e59515ac2a50
4
- data.tar.gz: c00f49d7b1c616a240b2885827389361f238837c
3
+ metadata.gz: 5fb89f4fc53709c2d624e976a3284b20e6946387
4
+ data.tar.gz: 4dc100da833def9078cc5f3ff16bd166dfcf1ec1
5
5
  SHA512:
6
- metadata.gz: eb33bc5501a7feb7ba5c11d68cdb76fec4d95864bc5a67af5a0eb72d87c828bc524978a77874be78892f23e1f0d04122d01312788585c800ae32284ac6ab430d
7
- data.tar.gz: 7c092cad942b9e6825af738ab9c745b3b991ead3e28ab53d6a8b93553035579733a2d7739d2ab33ae4159f6cbcfa7011ae89a296b656297ce9f1152bd5427a15
6
+ metadata.gz: 5d5a4582799d1018027ca73f2c0807cebf7c80c76803109d2ecd9f3efbfe6172e4a51651650e5a0e008c2ba49fb46399934595e2188e0b2537d7bc462f362230
7
+ data.tar.gz: 3520e52f7973b64a405ae2780de1eff0737d728828bd803aa8294d7e980f863dfb6a8dea1fcf5fa55aace35cf69f9df0f444e95f27f6f0e5b2ef5d6393b94b45
@@ -1,34 +1,31 @@
1
1
  # encoding: utf-8
2
- require 'pp'
3
2
 
4
3
  module I18n
5
4
  module Cocoa
6
5
 
7
6
  class Finder
8
7
 
9
- def initialize localized_macro_string='NSLocalizedString'
10
- @localized_macro_string = localized_macro_string
8
+ def initialize attributes
9
+ @localized_macro_string = attributes[:localized_macro_string]
11
10
  @method_file_paths = []
12
11
  @localized_file_paths = []
13
12
 
14
- _search_file_paths File.absolute_path(".")
13
+ _search_file_paths File.absolute_path(attributes[:search_path])
15
14
  end
16
15
 
17
16
  def ensure_localization
18
17
  failure_issues = []
19
18
 
20
19
  # use variable key for localization
21
- lines_with_variable_and_logic = _find_lines_using_variable_key_in_method_files
22
- lines_with_variable_and_logic.each do |l|
23
- failure_issues << Utils.create_issue("found to set varible keys with logic", l)
24
- end
20
+ lines = _find_lines_using_variable_key_in_method_files
21
+ failure_issues << Utils.create_issue("found to set varible keys with logic", lines) if lines.count > 0
25
22
 
26
23
  # use localized key but key doesnt exist in strings file
27
24
  used_keys = _get_used_localized_keys_from_method_files
28
25
  localized_keys = _get_localized_keys_from_strings_files
29
26
 
30
27
  forgot_keys = _contain_keys_in_localized_keys used_keys, localized_keys
31
- failure_issues << Utils.create_issue("found to forget keys", forgot_keys.join(", ")) if forgot_keys.count > 0
28
+ failure_issues << Utils.create_issue("found to forget keys", forgot_keys) if forgot_keys.count > 0
32
29
 
33
30
  [failure_issues.count == 0, failure_issues]
34
31
  end
@@ -1,6 +1,15 @@
1
1
  module I18n
2
2
  module Cocoa
3
3
 
4
+ class Issue
5
+ attr_reader :description, :values
6
+
7
+ def initialize description, values
8
+ @description = description
9
+ @values = values
10
+ end
11
+ end
12
+
4
13
  module Utils
5
14
 
6
15
  def self.encode string
@@ -14,8 +23,8 @@ module I18n
14
23
  string.encode(temporal_encoding, string.encoding, replace_options).encode(string.encoding)
15
24
  end
16
25
 
17
- def self.create_issue title, description
18
- "#{title}: #{description}"
26
+ def self.create_issue description, values
27
+ Issue.new description, values
19
28
  end
20
29
  end
21
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module Cocoa
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.3"
6
6
  end
7
7
  end
data/lib/i18n/cocoa.rb CHANGED
@@ -7,10 +7,17 @@ require "i18n/cocoa/finder"
7
7
  module I18n
8
8
  module Cocoa
9
9
 
10
- def self.health localized_macro_string='NSLocalizedString'
11
- finder = Finder.new localized_macro_string
10
+ def self.health attributes = {}
11
+ finder = Finder.new(config.update attributes)
12
12
  finder.ensure_localization
13
13
  end
14
14
 
15
+ def self.config
16
+ {
17
+ :localized_macro_string => 'NSLocalizedString',
18
+ :search_path => '.'
19
+ }
20
+ end
21
+
15
22
  end
16
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-cocoa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hirohisa Kawasaki