haml-i18n-extractor 0.3.2 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzE3Mzc4M2VkYTdhOGViYWE2NjJlMjhhMjMxOGYxN2FiNjc3ZjJkMA==
4
+ NDlhNzU4YzZjOTczMTEzZTlmOTVkNmMwZWMwMjA0YTdhMmEwOTQ4OQ==
5
5
  data.tar.gz: !binary |-
6
- MGFiOWZhODkzODRjNTY4MDVhMzYzY2M1ODE0MWEwNGExNmM1MzMxYQ==
6
+ Njg0NTNjOTk3MmQ2Mzg0ZTc5YWZjNzM4OTUzMzI5NGM1OTRmYmEwNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWVhMDM5NzZkMzgwNTRmYzg5Njk2ZTAxYjg5NDI0YTdjZTY2ZDc3YmQyMmRj
10
- Mzg4NTcwMThjODA5ZTA0YzMxOWViNjBlMDFmMmJhMjZhMDkxNDYzYmQzNTQw
11
- MjE0MjE1NjAwMzQ5ODdlYjg4ODllZDc2YTRiYjk1OWEzZDljNWQ=
9
+ MWQ2MWIzODYzNjJjNDI4Y2U3OWVmODNlNmI4ZTc1MzRlNjUyNGIzM2MxOGYy
10
+ N2FhOTgyODYyZjAxZGI0M2YxNWFjODcwODVlMmUyNTVkMzBlZDczZTVkZDY5
11
+ Nzc2ZDI4ZTc4ODA5YTYzMTgyZjE0ZTRhY2Q2OTIyZDcxYzk2ZDE=
12
12
  data.tar.gz: !binary |-
13
- MWNjYjQwNTEzMWVmNDBmNzk4MzIwMGU3MTFkYzQ3NjY4YzFjMzcwZmY3MGEy
14
- YjMzMjFhNWMwNzI2OTZiMWRiZGNiZTZiMjFmMjE3OTkyZjYyNTk0MDJkZDI1
15
- Y2ZhZTFlZWRiY2M4NDM1ZGFkMjA5OTdjOTI0YjlhMGQ2Mzg3ZjY=
13
+ MGY1NDM3NzQwNDU4ZGY2NmY5M2UwOGQ5YjMyOWQ2ZmJjMTYxMjBmMmZkYWM0
14
+ ZmM2OWI4NDU5YTA2ZTAwZWViOTFiNjliZmI2NGIwYTU4MjJiNDg0MGVlZTgy
15
+ OGM2OWRmMWY2MmYxOWE0MDM5ZGE1YWE0NWVhZGVkNjFlMzVmYjA=
@@ -4,23 +4,9 @@ require 'haml-i18n-extractor'
4
4
 
5
5
  @prompter = Haml::I18n::Extractor::Prompter.new
6
6
 
7
- option_parser = Trollop::Parser.new do
8
- banner <<-EOB
9
-
10
- haml-i18n-extractor <path> [--interactive|--non-interactive] [--other-options]
11
-
12
- See options list:
13
- EOB
14
- version "Current version: #{Haml::I18n::Extractor::VERSION}"
15
- opt :interactive, "interactive mode", :short => 'i'
16
- opt :non_interactive, "non interactive mode", :short => 'n'
17
- opt :yaml_file, "yaml file path, defaults to config/locales/en.yml", :type => String, :short => 'y'
18
- opt :i18n_scope, "top level i18n scope, defaults to :en", :type => String, :short => 's'
19
- end
20
-
21
- opts = Trollop::with_standard_exception_handling option_parser do
7
+ opts = Trollop::with_standard_exception_handling Haml::I18n::Extractor::CLI.option_parser do
22
8
  raise Trollop::HelpNeeded if ARGV.empty?
23
- option_parser.parse ARGV
9
+ Haml::I18n::Extractor::CLI.option_parser.parse ARGV
24
10
  end
25
11
 
26
12
  path_to_extract = File.expand_path(ARGV[0])
@@ -31,5 +17,5 @@ end
31
17
  begin
32
18
  Haml::I18n::Extractor::CLI.new(opts).start
33
19
  rescue Haml::I18n::Extractor::CLI::CliError
34
- @prompter.puts("please try again")
20
+ Haml::I18n::Extractor::CLI.show_help!
35
21
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["shaiguitar@gmail.com"]
7
7
  gem.description = %q{Parse the texts out of the haml files into localization files}
8
8
  gem.summary = %q{Parse the texts out of the haml files into localization files}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/shaiguitar/haml-i18n-extractor"
10
10
  gem.executables = ['haml-i18n-extractor']
11
11
  gem.default_executable = 'haml-i18n-extractor'
12
12
 
@@ -8,6 +8,31 @@ class Haml::I18n::Extractor
8
8
  @prompter = Haml::I18n::Extractor::Prompter.new # may as well
9
9
  end
10
10
 
11
+ def self.option_parser
12
+ option_parser = Trollop::Parser.new do
13
+ banner <<-EOB
14
+
15
+ haml-i18n-extractor --version # print version of this gem
16
+ haml-i18n-extractor --help # this message
17
+ haml-i18n-extractor <path> [--interactive|--non-interactive] [--other-options]
18
+
19
+ See options list (short options available next to long option):\n
20
+
21
+ EOB
22
+ version "Current version: #{Haml::I18n::Extractor::VERSION}"
23
+ opt :interactive, "interactive mode", :short => 'i'
24
+ opt :non_interactive, "non interactive mode", :short => 'n'
25
+ opt :yaml_file, "yaml file path, defaults to config/locales/en.yml", :type => String, :short => 'y'
26
+ opt :i18n_scope, "top level i18n scope, defaults to :en", :type => String, :short => 's'
27
+ end
28
+ end
29
+
30
+ def self.show_help!
31
+ Trollop::with_standard_exception_handling option_parser do
32
+ raise Trollop::HelpNeeded
33
+ end
34
+ end
35
+
11
36
  def start
12
37
  check_interactive_or_not_passed
13
38
  if @options[:path]
@@ -30,7 +55,7 @@ class Haml::I18n::Extractor
30
55
  def check_interactive_or_not_passed
31
56
  if (!@options[:interactive] && !@options[:non_interactive]) || (@options[:interactive] && @options[:non_interactive])
32
57
  @prompter.puts("You must choose either one of interactive mode or non interactive mode.")
33
- @prompter.puts("See haml-i18n-extractor --help")
58
+ @prompter.puts("See haml-i18n-extractor --help below:")
34
59
  raise CliError
35
60
  end
36
61
  end
@@ -38,8 +38,8 @@ module Haml
38
38
  def run
39
39
  assign_replacements
40
40
  validate_haml(@haml_writer.body)
41
- @haml_writer.write_file
42
41
  @yaml_tool.write_file
42
+ @haml_writer.write_file
43
43
  end
44
44
 
45
45
  def assign_new_body
@@ -1,7 +1,7 @@
1
1
  module Haml
2
2
  module I18n
3
3
  class Extractor
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-i18n-extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shai Rosenfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -242,7 +242,7 @@ files:
242
242
  - test/text_replacer_test.rb
243
243
  - test/workflow_test.rb
244
244
  - test/yaml_tool_test.rb
245
- homepage: ''
245
+ homepage: https://github.com/shaiguitar/haml-i18n-extractor
246
246
  licenses: []
247
247
  metadata: {}
248
248
  post_install_message: