haml-i18n-extractor 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/TODO +19 -6
- data/lib/haml-i18n-extractor/core-ext/hash.rb +6 -2
- data/lib/haml-i18n-extractor/extractor.rb +7 -4
- data/lib/haml-i18n-extractor/haml_writer.rb +3 -3
- data/lib/haml-i18n-extractor/prompter.rb +45 -8
- data/lib/haml-i18n-extractor/version.rb +1 -1
- data/lib/haml-i18n-extractor/workflow.rb +11 -33
- data/lib/haml-i18n-extractor/yaml_tool.rb +26 -15
- data/test/extractor_test.rb +15 -1
- data/test/prompter_test.rb +2 -2
- data/test/test_helper.rb +0 -19
- data/test/workflow_test.rb +20 -10
- data/test/yaml_tool_test.rb +5 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODdmOTAwNjUxNWQ5YTEzYWU1MWY5ZGJmYzUxZjAwNDQwNTQxMjFkYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzdjODNhMWY1NDc3ZTM3Y2FkOTMyMDMxZjhiMjFkNzJhZmMzZTFiMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTJjMDA1NjA3NGJhNDk1N2RlYjBkZmQ4OGZmNmY4NTVlMDMyNjNlYWJkNzVi
|
10
|
+
ZGEyMTFjNzgwNzdmMmZmYTg2NWY2NmI4NGU4MmIxMWZkODkwZjUwZDU4NmUw
|
11
|
+
YjNjMDNhZTNlZjBlZTIyMzkyMTBiM2JjNTc5MDgzMWFhNjQ2YTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTVjODAwMDM1ZTg2ZTEyNDI0Mjc2MmRiYmE5NTgxY2Q5YzEyODU0MmZlOGY1
|
14
|
+
MmUxMTNiYjk4NzcyNjcwNzEyNzJmMGMwNTQyOTViMzFkOWFmYjdkM2Q3OGQx
|
15
|
+
OTc5M2IxOTA0MmRiNmNhZWMzZTM5NzA4OTY3YWFlYzM4ZDJlM2I=
|
data/TODO
CHANGED
@@ -12,10 +12,23 @@
|
|
12
12
|
|
13
13
|
## workflow todo's
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
make sure yaml keys are in one file
|
16
|
+
|
17
|
+
either way when yaml is written, it should just write itself to config/locales/en.yml
|
18
|
+
wether its one-off, or project mode. and that's something yaml_tool should do.
|
19
|
+
merge itself in.
|
20
|
+
|
20
21
|
give user more context on line changes (like grep -C 4)
|
21
|
-
|
22
|
+
agreegate yaml:
|
23
|
+
|
24
|
+
<ruby>
|
25
|
+
|
26
|
+
require 'yaml'
|
27
|
+
require 'pp'
|
28
|
+
ActiveSupport::HashWithIndifferentAccess = HashWithIndifferentAccess # hack when it writes out the yaml, it should not be with_indifferent_access
|
29
|
+
all_yaml = Dir.glob('*yml').collect{|x| File.read(x) }
|
30
|
+
locale_hash = Hash.new
|
31
|
+
all_yaml.map{|y| YAML.load(y) }.map{|x| locale_hash.deep_merge!(x)}
|
32
|
+
pp locale_hash; "file.write it"
|
33
|
+
|
34
|
+
</ruby>
|
@@ -16,6 +16,8 @@ module Haml
|
|
16
16
|
attr_reader :haml_reader, :haml_writer
|
17
17
|
attr_reader :locale_hash, :yaml_tool, :type
|
18
18
|
|
19
|
+
DEFAULT_LINE_LOCALE_HASH = { :modified_line => nil,:keyname => nil,:replaced_text => nil, :path => nil }
|
20
|
+
|
19
21
|
def initialize(haml_path, opts = {})
|
20
22
|
@type = opts[:type]
|
21
23
|
@prompt_per_line = opts[:prompt_per_line]
|
@@ -64,18 +66,19 @@ module Haml
|
|
64
66
|
orig_line.chomp!
|
65
67
|
orig_line, whitespace = handle_line_whitespace(orig_line)
|
66
68
|
line_type, line_match = handle_line_finding(orig_line)
|
67
|
-
should_be_replaced, text_to_replace,
|
69
|
+
should_be_replaced, text_to_replace, line_locale_hash = handle_line_replacing(orig_line, line_match, line_type, line_no)
|
68
70
|
if should_be_replaced
|
69
71
|
if prompt_per_line?
|
70
|
-
user_approves = Haml::I18n::Extractor::Prompter.new(orig_line,text_to_replace)
|
72
|
+
user_approves = Haml::I18n::Extractor::Prompter.new.ask_user(orig_line,text_to_replace)
|
71
73
|
else
|
72
74
|
user_approves = true
|
73
75
|
end
|
74
76
|
end
|
75
|
-
append_to_locale_hash(line_no, locale_hash)
|
76
77
|
if user_approves
|
78
|
+
append_to_locale_hash(line_no, line_locale_hash)
|
77
79
|
add_to_body("#{whitespace}#{text_to_replace}")
|
78
80
|
else
|
81
|
+
append_to_locale_hash(line_no, DEFAULT_LINE_LOCALE_HASH)
|
79
82
|
add_to_body("#{whitespace}#{orig_line}")
|
80
83
|
end
|
81
84
|
return should_be_replaced
|
@@ -93,7 +96,7 @@ module Haml
|
|
93
96
|
hash = replacer.replace_hash.dup.merge!({:path => @haml_reader.path })
|
94
97
|
[ true, hash[:modified_line], hash ]
|
95
98
|
else
|
96
|
-
hash =
|
99
|
+
hash = DEFAULT_LINE_LOCALE_HASH
|
97
100
|
[ false, orig_line, hash ]
|
98
101
|
end
|
99
102
|
end
|
@@ -7,13 +7,13 @@ module Haml
|
|
7
7
|
|
8
8
|
def initialize(orig_path, options = {})
|
9
9
|
@type = options[:type] || :dump # safe default.
|
10
|
-
|
10
|
+
|
11
11
|
if overwrite?
|
12
12
|
@path = orig_path
|
13
13
|
elsif dump?
|
14
14
|
@path = orig_path.gsub(/.haml$/, ".i18n-extractor.haml")
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
end
|
18
18
|
|
19
19
|
def write_file
|
@@ -33,4 +33,4 @@ module Haml
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
@@ -8,19 +8,14 @@ module Haml
|
|
8
8
|
|
9
9
|
include Helpers::Highline
|
10
10
|
|
11
|
-
def
|
12
|
-
@orig_line = orig_line
|
13
|
-
@replaced_line = replaced_line
|
14
|
-
end
|
15
|
-
|
16
|
-
def ask_user
|
11
|
+
def ask_user(orig_line, replaced_line)
|
17
12
|
say(highlight("Replace this line:"))
|
18
13
|
say("\n")
|
19
|
-
say(
|
14
|
+
say(orig_line.inspect)
|
20
15
|
say("\n")
|
21
16
|
say(highlight("With this line?"))
|
22
17
|
say("\n")
|
23
|
-
say(
|
18
|
+
say(replaced_line.inspect)
|
24
19
|
say("\n")
|
25
20
|
answer = ask(highlight('y/n?')) do |q|
|
26
21
|
q.echo = false
|
@@ -30,6 +25,48 @@ module Haml
|
|
30
25
|
answer == 'y'
|
31
26
|
end
|
32
27
|
|
28
|
+
def output_stats(file_count, file_names)
|
29
|
+
say(highlight("Wowza! Found #{file_count} haml files!\n\n", :red))
|
30
|
+
say("#{file_names}\n\n")
|
31
|
+
end
|
32
|
+
|
33
|
+
def process(haml_path, type)
|
34
|
+
say(highlight("#{type}-d file") + " #{haml_path}\n\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
def end_message
|
38
|
+
say(highlight("\n\n\nNow run a git diff or such and see what changed!"))
|
39
|
+
end
|
40
|
+
|
41
|
+
def not_processing(haml_path)
|
42
|
+
say(highlight("Not processing") + " file #{haml_path}.")
|
43
|
+
end
|
44
|
+
|
45
|
+
def syntax_error(haml_path)
|
46
|
+
say("Haml Syntax error fo #{haml_path}. Please inspect further.")
|
47
|
+
end
|
48
|
+
|
49
|
+
CHOICES = {O: :overwrite, D: :dump, N: :next}
|
50
|
+
|
51
|
+
def process_file?(file, file_index)
|
52
|
+
o = %{[#{highlight(:O)}]verwrite}
|
53
|
+
d = %{[#{highlight(:D)}]ump}
|
54
|
+
n = %{[#{highlight(:N)}]ext}
|
55
|
+
say("#{o} OR #{d} OR #{n}\n")
|
56
|
+
say("Choose the right option for")
|
57
|
+
say("#{highlight(file_index)} #{highlight(file)}")
|
58
|
+
choices = CHOICES.keys.map(&:to_s)
|
59
|
+
prompt = "Your choice #{highlight(choices)}?"
|
60
|
+
answer = ask(prompt) do |q|
|
61
|
+
q.echo = false
|
62
|
+
q.character = true
|
63
|
+
q.validate = /\A[#{choices}r]\Z/
|
64
|
+
end
|
65
|
+
return :overwrite if answer == 'O'
|
66
|
+
return :overwrite if answer == 'R' # cheat 'replace'
|
67
|
+
return :dump if answer == 'D'
|
68
|
+
end
|
69
|
+
|
33
70
|
end
|
34
71
|
end
|
35
72
|
end
|
@@ -1,15 +1,11 @@
|
|
1
|
-
require 'highline'
|
2
|
-
require 'highline/import'
|
3
|
-
|
4
1
|
module Haml
|
5
2
|
module I18n
|
6
3
|
class Extractor
|
7
4
|
class Workflow
|
8
5
|
|
9
|
-
include Helpers::Highline
|
10
|
-
|
11
6
|
def initialize(project_path)
|
12
7
|
@project_path = project_path
|
8
|
+
@prompter = Haml::I18n::Extractor::Prompter.new
|
13
9
|
unless File.directory?(@project_path)
|
14
10
|
raise Extractor::NotADirectory, "#{@project_path} needs to be a directory!"
|
15
11
|
end
|
@@ -21,33 +17,15 @@ module Haml
|
|
21
17
|
end
|
22
18
|
end
|
23
19
|
|
24
|
-
|
25
|
-
# FIXME, use prompter to do any prompting in this class TODO
|
26
|
-
#
|
27
20
|
def output_stats
|
28
|
-
|
29
|
-
|
21
|
+
file_count = files.size
|
22
|
+
file_names = files.join("\n")
|
23
|
+
@prompter.output_stats(file_count, file_names)
|
30
24
|
end
|
31
25
|
|
32
|
-
CHOICES = {O: :overwrite, D: :dump, N: :next}
|
33
|
-
|
34
26
|
def process_file?(file)
|
35
|
-
|
36
|
-
|
37
|
-
n = %{[#{highlight(:N)}]ext}
|
38
|
-
say("#{o} OR #{d} OR #{n}\n")
|
39
|
-
say("Choose the right option for")
|
40
|
-
say("#{index_for(file)} #{highlight(file)}")
|
41
|
-
choices = CHOICES.keys.map(&:to_s)
|
42
|
-
prompt = "Your choice #{highlight(choices)}?"
|
43
|
-
answer = ask(prompt) do |q|
|
44
|
-
q.echo = false
|
45
|
-
q.character = true
|
46
|
-
q.validate = /\A[#{choices}r]\Z/
|
47
|
-
end
|
48
|
-
return :overwrite if answer == 'O'
|
49
|
-
return :overwrite if answer == 'R' # cheat 'replace'
|
50
|
-
return :dump if answer == 'D'
|
27
|
+
file_index = index_for(file)
|
28
|
+
@prompter.process_file?(file, file_index)
|
51
29
|
end
|
52
30
|
|
53
31
|
def run
|
@@ -57,7 +35,7 @@ module Haml
|
|
57
35
|
if type
|
58
36
|
process(haml_path, type)
|
59
37
|
else
|
60
|
-
|
38
|
+
@prompter.not_processing(haml_path)
|
61
39
|
end
|
62
40
|
end
|
63
41
|
end_message
|
@@ -66,22 +44,22 @@ module Haml
|
|
66
44
|
private
|
67
45
|
|
68
46
|
def end_message
|
69
|
-
|
47
|
+
@prompter.end_message
|
70
48
|
end
|
71
49
|
|
72
50
|
def index_for(file)
|
73
|
-
|
51
|
+
(files.index(file) + 1).to_s
|
74
52
|
end
|
75
53
|
|
76
54
|
def process(haml_path, type)
|
77
|
-
|
55
|
+
@prompter.process(haml_path, type)
|
78
56
|
options = {:type => type} # overwrite or dump haml
|
79
57
|
options.merge!({:prompt_per_line => true}) # per-line prompts
|
80
58
|
begin
|
81
59
|
@ex1 = Haml::I18n::Extractor.new(haml_path, options)
|
82
60
|
@ex1.run
|
83
61
|
rescue Haml::I18n::Extractor::InvalidSyntax
|
84
|
-
|
62
|
+
@prompter.syntax_error(haml_path)
|
85
63
|
end
|
86
64
|
end
|
87
65
|
end
|
@@ -7,27 +7,26 @@ module Haml
|
|
7
7
|
module I18n
|
8
8
|
class Extractor
|
9
9
|
class YamlTool
|
10
|
-
|
10
|
+
|
11
11
|
attr_accessor :locales_dir, :locale_hash
|
12
12
|
|
13
13
|
def initialize(locales_dir = nil)
|
14
14
|
if locales_dir
|
15
15
|
@locales_dir = locales_dir
|
16
16
|
else
|
17
|
-
|
18
|
-
@locales_dir = File.expand_path(".")
|
17
|
+
@locales_dir = File.expand_path("./config/locales/")
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
# {:en => {:view_name => {:key_name => :string_name } } }
|
23
22
|
def yaml_hash
|
24
|
-
|
23
|
+
yml = HashWithIndifferentAccess.recursive_init
|
25
24
|
@locale_hash.map do |line_no, info|
|
26
25
|
unless info[:keyname].nil?
|
27
|
-
|
26
|
+
yml[i18n_scope][standardized_viewname(info[:path])][standarized_keyname(info[:keyname])] = info[:replaced_text]
|
28
27
|
end
|
29
28
|
end
|
30
|
-
|
29
|
+
yml = hashify(yml)
|
31
30
|
end
|
32
31
|
|
33
32
|
def locale_file
|
@@ -36,19 +35,35 @@ module Haml
|
|
36
35
|
if pth
|
37
36
|
full_path = Pathname.new(pth)
|
38
37
|
base_name = full_path.basename.to_s
|
38
|
+
if ! File.exist?(@locales_dir)
|
39
|
+
FileUtils.mkdir_p(@locales_dir)
|
40
|
+
end
|
39
41
|
File.expand_path(File.join( @locales_dir, standardized_viewname(full_path) + ".#{base_name}.yml"))
|
40
42
|
end
|
41
|
-
end.
|
43
|
+
end || "haml-i18-extractor.yml"
|
42
44
|
end
|
43
|
-
|
45
|
+
|
44
46
|
def write_file
|
45
47
|
f = File.open(locale_file, "w+")
|
46
48
|
f.puts yaml_hash.to_yaml
|
47
49
|
f.flush
|
48
50
|
end
|
49
|
-
|
51
|
+
|
50
52
|
private
|
51
53
|
|
54
|
+
# {:foo => {:bar => {:baz => :mam}, :barrr => {:bazzz => :mammm} }}
|
55
|
+
def hashify(my_hash)
|
56
|
+
if my_hash.is_a?(HashWithIndifferentAccess)
|
57
|
+
result = {}
|
58
|
+
my_hash.each do |k, v|
|
59
|
+
result[k.to_s] = hashify(v)
|
60
|
+
end
|
61
|
+
result
|
62
|
+
else
|
63
|
+
my_hash
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
52
67
|
def i18n_scope
|
53
68
|
:en
|
54
69
|
end
|
@@ -64,11 +79,7 @@ module Haml
|
|
64
79
|
Pathname.new(pth).dirname.to_s.split("/").last
|
65
80
|
end
|
66
81
|
|
67
|
-
|
68
|
-
# defined?(Rails)
|
69
|
-
# end
|
70
|
-
|
71
|
-
end
|
82
|
+
end
|
72
83
|
end
|
73
84
|
end
|
74
|
-
end
|
85
|
+
end
|
data/test/extractor_test.rb
CHANGED
@@ -25,7 +25,7 @@ module Haml
|
|
25
25
|
assert_equal h.prompt_per_line?, false
|
26
26
|
end
|
27
27
|
|
28
|
-
test "with a prompt_per_line option takes user input into consideration" do
|
28
|
+
test "with a prompt_per_line option takes user input into consideration for haml" do
|
29
29
|
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :prompt_per_line => true)
|
30
30
|
user_input = "D" # dump
|
31
31
|
File.readlines(file_path("ex1.haml")).size.times do
|
@@ -38,6 +38,19 @@ module Haml
|
|
38
38
|
assert_equal File.read(h.haml_writer.path), File.read(file_path("ex1.haml"))
|
39
39
|
end
|
40
40
|
|
41
|
+
test "with a prompt_per_line option takes user input into consideration for yaml" do
|
42
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :prompt_per_line => true)
|
43
|
+
user_input = "D" # dump
|
44
|
+
File.readlines(file_path("ex1.haml")).size.times do
|
45
|
+
user_input << "n" # do not replace lines
|
46
|
+
end
|
47
|
+
with_highline(user_input) do
|
48
|
+
h.run
|
49
|
+
end
|
50
|
+
# no changes were made cause user was all like 'uhhh, no thxk'
|
51
|
+
assert_equal YAML.load(File.read(h.yaml_tool.locale_file)), {}
|
52
|
+
end
|
53
|
+
|
41
54
|
test "can not initialize if the haml is not valid syntax" do
|
42
55
|
begin
|
43
56
|
Haml::I18n::Extractor.new(file_path("bad.haml"))
|
@@ -60,6 +73,7 @@ module Haml
|
|
60
73
|
end
|
61
74
|
|
62
75
|
test "it writes the locale info to an out file when run" do
|
76
|
+
Dir.glob("*yml").map {|p| FileUtils.rm(p) } # HAX, TODO: handle with yaml files correctly (config/en.yml)
|
63
77
|
assert_equal File.exists?(@ex1.yaml_tool.locale_file), false
|
64
78
|
@ex1.run
|
65
79
|
assert_equal File.exists?(@ex1.yaml_tool.locale_file), true
|
data/test/prompter_test.rb
CHANGED
@@ -5,13 +5,13 @@ module Haml
|
|
5
5
|
|
6
6
|
def test_asks_to_process_line_yes
|
7
7
|
with_highline("y") do
|
8
|
-
assert_equal Haml::I18n::Extractor::Prompter.new("orig", "replace")
|
8
|
+
assert_equal Haml::I18n::Extractor::Prompter.new.ask_user("orig", "replace"), true
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_asks_to_process_line_no
|
13
13
|
with_highline("n") do
|
14
|
-
assert_equal Haml::I18n::Extractor::Prompter.new("orig", "replace")
|
14
|
+
assert_equal Haml::I18n::Extractor::Prompter.new.ask_user("orig", "replace"), false
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
data/test/test_helper.rb
CHANGED
@@ -89,25 +89,6 @@ ensure
|
|
89
89
|
$terminal = old_terminal
|
90
90
|
end
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
def without_rails_mode
|
95
|
-
Object.send(:remove_const, :Rails) if defined?(Rails)
|
96
|
-
yield
|
97
|
-
end
|
98
|
-
|
99
|
-
def with_rails_mode
|
100
|
-
create_klass=<<EOR
|
101
|
-
module Rails
|
102
|
-
def self.root
|
103
|
-
"/data/current/name"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
EOR
|
107
|
-
eval create_klass
|
108
|
-
yield
|
109
|
-
end
|
110
|
-
|
111
92
|
module TestHelper
|
112
93
|
|
113
94
|
TMPDIR = File.join(File.dirname(__FILE__) + "/tmp/")
|
data/test/workflow_test.rb
CHANGED
@@ -12,6 +12,18 @@ module Haml
|
|
12
12
|
TestHelper.teardown_project_directory!
|
13
13
|
end
|
14
14
|
|
15
|
+
def full_project_user_interaction
|
16
|
+
automate_user_interaction = ""
|
17
|
+
6.times do # should be number of files we're testing on
|
18
|
+
automate_user_interaction << "O" # overwrite file
|
19
|
+
50.times do # should be number of lines in file,
|
20
|
+
# this should do right now.
|
21
|
+
automate_user_interaction << "y" # replace line
|
22
|
+
end
|
23
|
+
end
|
24
|
+
automate_user_interaction
|
25
|
+
end
|
26
|
+
|
15
27
|
def test_it_should_work_on_a_directory_mkay
|
16
28
|
filename = "#{TestHelper::PROJECT_DIR}app/views/bar/thang.haml"
|
17
29
|
bad_worfklow = Haml::I18n::Extractor::Workflow.new(filename)
|
@@ -19,7 +31,7 @@ module Haml
|
|
19
31
|
rescue Haml::I18n::Extractor::NotADirectory
|
20
32
|
assert true, "workflow works on a directory bubba."
|
21
33
|
end
|
22
|
-
|
34
|
+
|
23
35
|
def test_it_finds_all_haml_files
|
24
36
|
assert_equal @workflow.files.size, 4
|
25
37
|
end
|
@@ -49,16 +61,14 @@ module Haml
|
|
49
61
|
end
|
50
62
|
end
|
51
63
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
automate_user_interaction << "O" # overwrite file
|
56
|
-
50.times do # should be number of lines in file,
|
57
|
-
# this should do right now.
|
58
|
-
automate_user_interaction << "y" # replace line
|
59
|
-
end
|
64
|
+
def test_yaml_file_in_config
|
65
|
+
with_highline(full_project_user_interaction) do
|
66
|
+
@workflow.run
|
60
67
|
end
|
61
|
-
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_run_works
|
71
|
+
with_highline(full_project_user_interaction) do
|
62
72
|
@workflow.run
|
63
73
|
end
|
64
74
|
end
|
data/test/yaml_tool_test.rb
CHANGED
@@ -28,25 +28,16 @@ module Haml
|
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# assert_equal yaml_tool.locales_dir, "/data/current/name/config/locales"
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
|
38
|
-
test "locale dir defaults to cwd if no rails" do
|
39
|
-
without_rails_mode do
|
40
|
-
yaml_tool = Haml::I18n::Extractor::YamlTool.new
|
41
|
-
assert_equal yaml_tool.locales_dir, File.expand_path(".")
|
42
|
-
end
|
31
|
+
test "locale dir defaults to config/locales/" do
|
32
|
+
yaml_tool = Haml::I18n::Extractor::YamlTool.new
|
33
|
+
assert_equal yaml_tool.locales_dir, File.expand_path("./config/locales")
|
43
34
|
end
|
44
|
-
|
35
|
+
|
45
36
|
test "you can set the locale_dir" do
|
46
37
|
yaml_tool = Haml::I18n::Extractor::YamlTool.new(@temp_locale_dir)
|
47
38
|
assert_equal yaml_tool.locales_dir, @temp_locale_dir
|
48
39
|
end
|
49
|
-
|
40
|
+
|
50
41
|
test "it relies on the locale_hash having a certain format" do
|
51
42
|
setup_locale_hash
|
52
43
|
@ex1.yaml_tool.locale_hash.each do |line_no, info_for_line|
|
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.0.
|
4
|
+
version: 0.0.12
|
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-05-
|
11
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|