apstrings 0.1.0 → 0.1.1

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: b254fe96c0c7a6649d63b91f3149576422524c70
4
- data.tar.gz: e80f20ebe76cffd2c692cf95aca6540bf4f1f156
3
+ metadata.gz: 292a421cdd4aab71df731888d6a0a68d98ca7aea
4
+ data.tar.gz: 8e590af7b8e60118de6c8e7e16134145d94ef0c6
5
5
  SHA512:
6
- metadata.gz: cd106d42a84875e270ca91763c46e7a34a5cb8210de8a7c0cfe46f4aafd93c4c8e887c143a1c48614136e69be2238895e31caf4acf551ac71203e6490382782c
7
- data.tar.gz: 95acbc76b7b0bdd8a213d3aeba65d197265c78315786c809da0a67acb916232641a8c366a82c7527b38e2ea2e279594eb83af9fb6b4ef1c9676ec6ea0a4756a1
6
+ metadata.gz: 1e2e9fefdb7298f0bfaf47f0a906139705d045318989a49e30721e2829a32bff3a8a0dfd0672ffbf4347981e24b7089cc4939b4471558d06281003c7df4bdcb9
7
+ data.tar.gz: 63208036355c703c77f6b236b7c2c7fe9bd23b371b2958f015a4d0c23aa13d2b8b792ed8d497633b8d24bf323273a25b21165fbf5f5afdcf3bcccfd6ce874c8f
@@ -6,7 +6,7 @@ module Apstrings
6
6
  def initialize(line)
7
7
  @content = line
8
8
  @in_comment = false
9
- raise "Line does not end in ;" unless valid?
9
+ raise "ERROR : Line does not end with `;`, #{line}" unless valid?
10
10
  end
11
11
 
12
12
  def empty_line?
@@ -2,6 +2,8 @@ module Apstrings
2
2
  require 'apstrings/line'
3
3
  require 'apstrings/kv_pair'
4
4
  require 'apstrings/dot_string_file'
5
+ require 'colorize'
6
+
5
7
  class StringsParser
6
8
  KEY = "KEY"
7
9
  COMMENT = "COMMENT"
@@ -15,10 +17,17 @@ module Apstrings
15
17
  state = KEY
16
18
  current_comment = nil
17
19
  comments_for_keys = {}
20
+ idx = 1;
18
21
  @read_file.each do |content_line|
19
- current_line = Line.new(content_line)
20
- next if current_line.empty_line? && current_line.in_comment == false
21
-
22
+ begin
23
+ current_line = Line.new(content_line)
24
+ next if current_line.empty_line? && current_line.in_comment == false
25
+ rescue RuntimeError => e
26
+ puts "#{e} \b Error occured in #{@read_file}, \n line number : #{idx}.".red
27
+ else
28
+ idx ++;
29
+ end
30
+
22
31
  #State machine
23
32
  case state
24
33
  when KEY
@@ -1,3 +1,3 @@
1
1
  module Apstrings
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/apstrings.rb CHANGED
@@ -1,15 +1,25 @@
1
1
  require "apstrings/version"
2
+ require 'colorize'
2
3
 
3
4
  module Apstrings
4
5
  require 'apstrings/reader'
5
6
  require 'apstrings/strings_parser'
6
7
  # Public
7
8
  def self.parse(file)
8
- file = read(file)
9
+ file = Apstrings::read(file)
9
10
  StringsParser.new(file).parse_file
10
11
  end
11
12
 
12
13
  def self.read(file)
13
14
  Reader.read(file)
14
15
  end
16
+
17
+ def self.check(path = File::expand_path("."), master = "zh-Hans")
18
+ p "Checking files recursively for #{path} according to master strings file name : #{master}"
19
+
20
+
21
+ end
22
+
15
23
  end
24
+
25
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apstrings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JasonWorking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler