haml-i18n-extractor 0.0.5 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +4 -1
- data/README.md +30 -13
- data/Rakefile +0 -2
- data/TODO +19 -4
- data/bin/haml-i18n-extractor +6 -20
- data/haml-i18n-extractor.gemspec +1 -0
- data/lib/haml-i18n-extractor/extractor.rb +78 -32
- data/lib/haml-i18n-extractor/haml_reader.rb +2 -2
- data/lib/haml-i18n-extractor/haml_writer.rb +18 -3
- data/lib/haml-i18n-extractor/helpers.rb +16 -0
- data/lib/haml-i18n-extractor/prompter.rb +38 -0
- data/lib/haml-i18n-extractor/text_finder.rb +1 -1
- data/lib/haml-i18n-extractor/version.rb +1 -1
- data/lib/haml-i18n-extractor/workflow.rb +90 -0
- data/lib/haml-i18n-extractor.rb +4 -1
- data/test/extractor_test.rb +31 -18
- data/test/haml_reader_test.rb +2 -2
- data/test/haml_writer_test.rb +10 -6
- data/test/prompter_test.rb +22 -0
- data/test/support/ex1.haml +1 -1
- data/test/test_helper.rb +65 -1
- data/test/text_finder_test.rb +2 -2
- data/test/workflow_test.rb +67 -0
- metadata +68 -31
- data/test/support/ex1.i18n-extractor.haml +0 -28
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmRjNTViYWFhY2M4ZDhjMGZmMzk2MGFmZTZhMGFjNDVhMjYyNWIwZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTc0YjQwN2M5OWRmMDIxNTY0NjNlYmI0YWU3Y2U5NTEzMzA1MDAyOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MmMxNWRkZWI5ODE5YzFiNWZmZTQxZDllYTk4MmM4ZjJjYjIzM2U4OWFiNDhj
|
10
|
+
MzE3MjI2ZDMyNjUyNjgxZmQ4Njc0NzI2MzQzOTdhMmVmZDg5ZjI2YzIyYTI1
|
11
|
+
ZDJjODE2M2VkOTNhMzA3MTkwMjFhNzIwM2ViNDljNWI3MjUwYjk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OWVlOGZmNGEzNjFkYTg5YWQ4Yjk0OGQ1YWZjMmQ5OTVhZjcwZmRiMDczYjE5
|
14
|
+
MjAyYmUzM2FlZmRiNWQ3YzY4MTljYjA5ZmM2ZWM1ZjI3N2M2ODhmNGQyOTZj
|
15
|
+
ODM0MTEwNjMzNTFhZTczNDE5ZmY4NDk4MjY1YzdlYzJhZjEyM2Y=
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
# Haml::I18n::Extractor
|
2
2
|
|
3
|
-
Extract strings likely to be translated from haml
|
3
|
+
Extract strings likely to be translated from haml templates for I18n translation. Replace the text, create yaml files, do all things you thought macros would solve, but didn't end up really saving THAT much time. Automate that pain away.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`gem install haml-i18n-extractor`
|
6
8
|
|
7
|
-
|
9
|
+
However I don't upload gems to rubygems in my spare time, so if you want the latest code edge style, you can also simply clone this repo and install the gem from the root of the repo:
|
8
10
|
|
9
|
-
`
|
11
|
+
`gem uninstall -x haml-i18n-extractor; rm *gem; gem build *gemspec; gem install --local *gem`
|
10
12
|
|
11
|
-
## Notes
|
12
13
|
|
13
|
-
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
- You can use the lib directly:
|
14
17
|
|
15
18
|
<pre>
|
16
19
|
begin
|
@@ -23,13 +26,23 @@ rescue Haml::I18n::Extractor::NothingToTranslate
|
|
23
26
|
end
|
24
27
|
</pre>
|
25
28
|
|
26
|
-
|
29
|
+
- You can also simply run the binary provided with the gem on a rails app:
|
30
|
+
|
31
|
+
`cd your-rails-app-to-translate && haml-i18n-extractor .`
|
27
32
|
|
28
|
-
The workflow
|
33
|
+
The workflow is an interactive one using highline which will allow you to choose if you want to:
|
29
34
|
|
30
|
-
|
35
|
+
1) overwrite the haml file.
|
36
|
+
2) place a tmp haml file.
|
37
|
+
3) pass, move on to the next haml file.
|
31
38
|
|
32
|
-
|
39
|
+
Run the binary and see!
|
40
|
+
|
41
|
+
## Example output
|
42
|
+
|
43
|
+
This should be a before and after picture of using this lib, whether directly in rubyland or using the executable:
|
44
|
+
|
45
|
+
- Before running (old haml):
|
33
46
|
|
34
47
|
<pre>
|
35
48
|
shai@comp ~/p/project ‹master*› » cat app/views/admin/notifications/index.html.haml
|
@@ -55,9 +68,9 @@ What you should be seeing for a "foo.haml" file is a dumped version "foo.i18n-ex
|
|
55
68
|
.nav= will_paginate(@consumer_notifications)
|
56
69
|
</pre>
|
57
70
|
|
58
|
-
|
71
|
+
- After running (new haml, new yaml):
|
59
72
|
|
60
|
-
|
73
|
+
Note how some of the strings are replaced, and the ones that shouldn't, aren't. Yup. Beautiful, right?
|
61
74
|
|
62
75
|
Haml:
|
63
76
|
|
@@ -101,10 +114,14 @@ Yaml:
|
|
101
114
|
nbsp;: ! ' '
|
102
115
|
</pre>
|
103
116
|
|
117
|
+
## Feedback
|
118
|
+
|
119
|
+
Can use github issues to address any concern you have, or simply email me, with the contact info here: [http://shairosenfeld.com/](http://shairosenfeld.com/)
|
120
|
+
|
104
121
|
## Contributing
|
105
122
|
|
106
123
|
1. Fork it
|
107
124
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
108
125
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
109
126
|
4. Push to the branch (`git push origin my-new-feature`)
|
110
|
-
5. Create new Pull Request
|
127
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/TODO
CHANGED
@@ -1,5 +1,20 @@
|
|
1
|
-
-
|
2
|
-
|
1
|
+
- Remove the ex1.output ex1.i18n-extractor duplication. (or move to tmp dir):
|
2
|
+
Move to test/tmp a-la the way workflow is working.
|
3
|
+
- Ensure that yaml file gets written to the right directory, and does a deep merge.
|
3
4
|
- Add {} to disallowed characters
|
4
|
-
- Add yaml fixtures and compare those
|
5
|
-
- handled email suffixes (foo.en.html.haml etc)
|
5
|
+
- Add yaml fixtures and compare those
|
6
|
+
- handled email suffixes (foo.en.html.haml etc)
|
7
|
+
- admin/bla should be namespaced such as: en.admin.bla vs just en.bla in the yml file?
|
8
|
+
- add to README 'it is idempotent...' :P
|
9
|
+
- add herbgobbler (ERB) and this to another more generalized repo for translating templates?
|
10
|
+
- Refactor tests: split out what is integration vs unit, too much coupling.
|
11
|
+
|
12
|
+
## chage the workflow to work per-line
|
13
|
+
|
14
|
+
regarding overwriting or not:
|
15
|
+
right now just leave be (tmp file). figure out later.
|
16
|
+
pass in opts...
|
17
|
+
cleanup workflow - keep around
|
18
|
+
but no prompting, just handle a rails project dir.
|
19
|
+
move any prompting in workflow into prompter.
|
20
|
+
if the user says 'no' on a line, make sure to not replace it!
|
data/bin/haml-i18n-extractor
CHANGED
@@ -3,29 +3,15 @@
|
|
3
3
|
require 'haml-i18n-extractor'
|
4
4
|
|
5
5
|
if ARGV.empty?
|
6
|
+
puts "Usage: <haml-i18n-extractor> --version"
|
6
7
|
puts "Usage: <haml-i18n-extractor> [path]"
|
7
8
|
abort
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
all_files = Dir.glob("**/*")
|
14
|
-
haml_paths = all_files.select do |file|
|
15
|
-
file.match /.haml$/
|
11
|
+
if ARGV[0] == "--version"
|
12
|
+
puts Haml::I18n::Extractor::VERSION
|
13
|
+
abort
|
16
14
|
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
haml_paths.each do |haml_path|
|
22
|
-
begin
|
23
|
-
puts "extracting strings for #{haml_path}"
|
24
|
-
@ex1 = Haml::I18n::Extractor.new(haml_path)
|
25
|
-
@ex1.run
|
26
|
-
rescue Haml::I18n::Extractor::InvalidSyntax
|
27
|
-
puts "There was an error with #{haml_path}"
|
28
|
-
rescue Haml::I18n::Extractor::NothingToTranslate
|
29
|
-
puts "Nothing to translate for #{haml_path}"
|
30
|
-
end
|
31
|
-
end
|
16
|
+
workflow = Haml::I18n::Extractor::Workflow.new(File.expand_path(ARGV[0]))
|
17
|
+
workflow.run
|
data/haml-i18n-extractor.gemspec
CHANGED
@@ -5,22 +5,27 @@ module Haml
|
|
5
5
|
def self.debug?
|
6
6
|
ENV['DEBUG']
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
class InvalidSyntax < StandardError ; end
|
10
|
-
class
|
10
|
+
class NotADirectory < StandardError ; end
|
11
11
|
class NotDefinedLineType < StandardError ; end
|
12
12
|
|
13
13
|
LINE_TYPES_ALL = [:text, :not_text, :loud, :silent, :element]
|
14
14
|
LINE_TYPES_ADD_EVAL = [:text, :element]
|
15
|
-
|
15
|
+
|
16
16
|
attr_reader :haml_reader, :haml_writer
|
17
|
-
attr_reader :locale_hash, :yaml_tool
|
17
|
+
attr_reader :locale_hash, :yaml_tool, :type
|
18
18
|
|
19
|
-
def initialize(haml_path)
|
19
|
+
def initialize(haml_path, opts = {})
|
20
|
+
@type = opts[:type]
|
21
|
+
@prompt_per_line = opts[:prompt_per_line]
|
20
22
|
@haml_reader = Haml::I18n::Extractor::HamlReader.new(haml_path)
|
21
23
|
validate_haml(@haml_reader.body)
|
22
|
-
@haml_writer = Haml::I18n::Extractor::HamlWriter.new(haml_path)
|
24
|
+
@haml_writer = Haml::I18n::Extractor::HamlWriter.new(haml_path, {:type => @type})
|
23
25
|
@yaml_tool = Haml::I18n::Extractor::YamlTool.new
|
26
|
+
# hold all the processed lines
|
27
|
+
@body = []
|
28
|
+
# holds a line_no => {info_about_line_replacemnts_or_not}
|
24
29
|
@locale_hash = {}
|
25
30
|
end
|
26
31
|
|
@@ -30,55 +35,96 @@ module Haml
|
|
30
35
|
@haml_writer.write_file
|
31
36
|
@yaml_tool.write_file
|
32
37
|
end
|
33
|
-
|
38
|
+
|
34
39
|
def assign_new_body
|
35
40
|
@haml_writer.body = new_body
|
36
41
|
end
|
37
|
-
|
42
|
+
|
38
43
|
def assign_yaml
|
39
44
|
@yaml_tool.locale_hash = @locale_hash
|
40
45
|
end
|
41
|
-
|
46
|
+
|
42
47
|
def assign_replacements
|
43
48
|
assign_new_body
|
44
49
|
assign_yaml
|
45
50
|
end
|
46
51
|
|
47
|
-
|
48
|
-
# to be used later by the yaml tool.
|
49
|
-
# keep indentation to use later when printing out.
|
50
|
-
def new_body
|
51
|
-
new_lines = []
|
52
|
-
file_has_been_parsed = false
|
52
|
+
def new_body
|
53
53
|
@haml_reader.lines.each_with_index do |orig_line, line_no|
|
54
|
-
orig_line
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
process_line(orig_line,line_no)
|
55
|
+
end
|
56
|
+
@body.join("\n")
|
57
|
+
end
|
58
|
+
|
59
|
+
# this is the bulk of it:
|
60
|
+
# where we end up setting body info and locale_hash.
|
61
|
+
# not _write_, just set that info in memory in correspoding locations.
|
62
|
+
# refactor more?
|
63
|
+
def process_line(orig_line, line_no)
|
64
|
+
orig_line.chomp!
|
65
|
+
orig_line, whitespace = handle_line_whitespace(orig_line)
|
66
|
+
line_type, line_match = handle_line_finding(orig_line)
|
67
|
+
should_be_replaced, text_to_replace, locale_hash = handle_line_replacing(orig_line, line_match, line_type, line_no)
|
68
|
+
if should_be_replaced
|
69
|
+
if prompt_per_line?
|
70
|
+
Haml::I18n::Extractor::Prompter.new(orig_line,text_to_replace).ask_user
|
71
|
+
user_approves = Haml::I18n::Extractor::Prompter.new(orig_line,text_to_replace).ask_user
|
64
72
|
else
|
65
|
-
|
66
|
-
new_lines << "#{whitespace_indentation}#{orig_line}"
|
73
|
+
user_approves = true
|
67
74
|
end
|
68
75
|
end
|
69
|
-
|
70
|
-
|
76
|
+
append_to_locale_hash(line_no, locale_hash)
|
77
|
+
if user_approves
|
78
|
+
add_to_body("#{whitespace}#{text_to_replace}")
|
79
|
+
else
|
80
|
+
add_to_body("#{whitespace}#{orig_line}")
|
81
|
+
end
|
82
|
+
return should_be_replaced
|
83
|
+
end
|
84
|
+
|
85
|
+
def prompt_per_line?
|
86
|
+
!!@prompt_per_line
|
71
87
|
end
|
72
|
-
|
88
|
+
|
73
89
|
private
|
74
|
-
|
90
|
+
|
91
|
+
def handle_line_replacing(orig_line, line_match, line_type, line_no)
|
92
|
+
if line_match && !line_match.empty?
|
93
|
+
replacer = Haml::I18n::Extractor::TextReplacer.new(orig_line, line_match, line_type)
|
94
|
+
hash = replacer.replace_hash.dup.merge!({:path => @haml_reader.path })
|
95
|
+
[ true, hash[:modified_line], hash ]
|
96
|
+
else
|
97
|
+
hash = { :modified_line => nil,:keyname => nil,:replaced_text => nil, :path => nil }
|
98
|
+
[ false, orig_line, hash ]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def append_to_locale_hash(line_no, hash)
|
103
|
+
@locale_hash[line_no] = hash
|
104
|
+
end
|
105
|
+
|
106
|
+
def handle_line_finding(orig_line)
|
107
|
+
Haml::I18n::Extractor::TextFinder.new(orig_line).process_by_regex
|
108
|
+
end
|
109
|
+
|
110
|
+
def handle_line_whitespace(orig_line)
|
111
|
+
orig_line.rstrip.match(/([ \t]+)?(.*)/)
|
112
|
+
whitespace_indentation = $1
|
113
|
+
orig_line = $2
|
114
|
+
[ orig_line, whitespace_indentation ]
|
115
|
+
end
|
116
|
+
|
117
|
+
def add_to_body(ln)
|
118
|
+
@body << ln
|
119
|
+
end
|
120
|
+
|
75
121
|
def validate_haml(haml)
|
76
122
|
parser = Haml::Parser.new(haml, Haml::Options.new)
|
77
123
|
parser.parse
|
78
124
|
rescue Haml::SyntaxError
|
79
125
|
raise InvalidSyntax, "invalid syntax for haml #{@haml_reader.path}"
|
80
126
|
end
|
81
|
-
|
127
|
+
|
82
128
|
end
|
83
129
|
end
|
84
130
|
end
|
@@ -3,10 +3,17 @@ module Haml
|
|
3
3
|
class Extractor
|
4
4
|
class HamlWriter
|
5
5
|
|
6
|
-
attr_accessor :path, :lines, :body
|
6
|
+
attr_accessor :path, :lines, :body, :type
|
7
7
|
|
8
|
-
def initialize(orig_path)
|
9
|
-
@
|
8
|
+
def initialize(orig_path, options = {})
|
9
|
+
@type = options[:type] || :dump # safe default.
|
10
|
+
|
11
|
+
if overwrite?
|
12
|
+
@path = orig_path
|
13
|
+
elsif dump?
|
14
|
+
@path = orig_path.gsub(/.haml$/, ".i18n-extractor.haml")
|
15
|
+
end
|
16
|
+
|
10
17
|
end
|
11
18
|
|
12
19
|
def write_file
|
@@ -15,6 +22,14 @@ module Haml
|
|
15
22
|
f.close
|
16
23
|
end
|
17
24
|
|
25
|
+
def overwrite?
|
26
|
+
@type == :overwrite
|
27
|
+
end
|
28
|
+
|
29
|
+
def dump?
|
30
|
+
@type == :dump
|
31
|
+
end
|
32
|
+
|
18
33
|
end
|
19
34
|
end
|
20
35
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'highline'
|
2
|
+
require 'highline/import'
|
3
|
+
|
4
|
+
module Haml
|
5
|
+
module I18n
|
6
|
+
class Extractor
|
7
|
+
class Prompter
|
8
|
+
|
9
|
+
include Helpers::Highline
|
10
|
+
|
11
|
+
def initialize(orig_line, replaced_line)
|
12
|
+
@orig_line = orig_line
|
13
|
+
@replaced_line = replaced_line
|
14
|
+
end
|
15
|
+
|
16
|
+
def ask_user
|
17
|
+
say(highlight("Replace this line:"))
|
18
|
+
say("\n")
|
19
|
+
say(@orig_line.inspect)
|
20
|
+
say("\n")
|
21
|
+
say(highlight("With this line?"))
|
22
|
+
say("\n")
|
23
|
+
say(@replaced_line.inspect)
|
24
|
+
say("\n")
|
25
|
+
answer = ask(highlight('y/n?')) do |q|
|
26
|
+
q.echo = false
|
27
|
+
q.character = true
|
28
|
+
q.validate = /\A[yn]\Z/
|
29
|
+
end
|
30
|
+
answer == 'y'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
@@ -32,7 +32,7 @@ module Haml
|
|
32
32
|
if @haml == ""
|
33
33
|
return Haml::Parser::Line.new("", "", "", 0, @parser, false)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
match = @haml.rstrip.scan(/(([ \t]+)?(.*?))(?:\Z|\r\n|\r|\n)/m)
|
37
37
|
match.pop
|
38
38
|
haml_line ||= match.each_with_index.map do |(full, whitespace, text), index|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'highline'
|
2
|
+
require 'highline/import'
|
3
|
+
|
4
|
+
module Haml
|
5
|
+
module I18n
|
6
|
+
class Extractor
|
7
|
+
class Workflow
|
8
|
+
|
9
|
+
include Helpers::Highline
|
10
|
+
|
11
|
+
def initialize(project_path)
|
12
|
+
@project_path = project_path
|
13
|
+
unless File.directory?(@project_path)
|
14
|
+
raise Extractor::NotADirectory, "#{@project_path} needs to be a directory!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def files
|
19
|
+
@haml_files ||= Dir.glob(@project_path + "/**/*").select do |file|
|
20
|
+
file.match /.haml$/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# FIXME, use prompter to do any prompting in this class TODO
|
26
|
+
#
|
27
|
+
def output_stats
|
28
|
+
say(highlight("Wowza! Found #{files.size} haml files!\n\n", :red))
|
29
|
+
say("#{files.join("\n")}\n\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
CHOICES = {O: :overwrite, D: :dump, N: :next}
|
33
|
+
|
34
|
+
def process_file?(file)
|
35
|
+
o = %{[#{highlight(:O)}]verwrite}
|
36
|
+
d = %{[#{highlight(:D)}]ump}
|
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'
|
51
|
+
end
|
52
|
+
|
53
|
+
def run
|
54
|
+
output_stats
|
55
|
+
files.each do |haml_path|
|
56
|
+
type = process_file?(haml_path)
|
57
|
+
if type
|
58
|
+
process(haml_path, type)
|
59
|
+
else
|
60
|
+
say(highlight("Not processing") + " file #{haml_path}.")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end_message
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def end_message
|
69
|
+
say(highlight("\n\n\nNow run a git diff or such and see what changed!"))
|
70
|
+
end
|
71
|
+
|
72
|
+
def index_for(file)
|
73
|
+
highlight((files.index(file) + 1).to_s)
|
74
|
+
end
|
75
|
+
|
76
|
+
def process(haml_path, type)
|
77
|
+
say(highlight("#{type}-d file") + " #{haml_path}\n\n")
|
78
|
+
options = {:type => type} # overwrite or dump haml
|
79
|
+
options.merge!({:prompt_per_line => true}) # per-line prompts
|
80
|
+
begin
|
81
|
+
@ex1 = Haml::I18n::Extractor.new(haml_path, options)
|
82
|
+
@ex1.run
|
83
|
+
rescue Haml::I18n::Extractor::InvalidSyntax
|
84
|
+
say("Haml Syntax error fo #{haml_path}. Please inspect further.")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/haml-i18n-extractor.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require "haml-i18n-extractor/version"
|
2
|
+
require "haml-i18n-extractor/helpers"
|
2
3
|
require "haml-i18n-extractor/text_finder"
|
3
4
|
require "haml-i18n-extractor/text_replacer"
|
4
5
|
require "haml-i18n-extractor/haml_reader"
|
5
6
|
require "haml-i18n-extractor/haml_writer"
|
6
7
|
require "haml-i18n-extractor/yaml_tool"
|
7
|
-
require "haml-i18n-extractor/extractor"
|
8
|
+
require "haml-i18n-extractor/extractor"
|
9
|
+
require "haml-i18n-extractor/prompter"
|
10
|
+
require "haml-i18n-extractor/workflow"
|
data/test/extractor_test.rb
CHANGED
@@ -7,10 +7,37 @@ module Haml
|
|
7
7
|
@ex1 = Haml::I18n::Extractor.new(file_path("ex1.haml"))
|
8
8
|
end
|
9
9
|
|
10
|
-
test "it can process the haml and replace it with other text
|
10
|
+
test "it can process the haml and replace it with other text" do
|
11
11
|
@ex1.run
|
12
12
|
end
|
13
13
|
|
14
|
+
test "with a type of overwrite or dump affecting haml writer" do
|
15
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :type => :overwrite)
|
16
|
+
assert_equal h.haml_writer.overwrite?, true
|
17
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"))
|
18
|
+
assert_equal h.haml_writer.overwrite?, false
|
19
|
+
end
|
20
|
+
|
21
|
+
test "with a prompt_per_line option which prompts the user-per line" do
|
22
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :prompt_per_line => true)
|
23
|
+
assert_equal h.prompt_per_line?, true
|
24
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"))
|
25
|
+
assert_equal h.prompt_per_line?, false
|
26
|
+
end
|
27
|
+
|
28
|
+
test "with a prompt_per_line option takes user input into consideration" do
|
29
|
+
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :prompt_per_line => true)
|
30
|
+
user_input = "D" # dump
|
31
|
+
File.readlines(file_path("ex1.haml")).size.times do
|
32
|
+
user_input << "n" # do not replace lines
|
33
|
+
end
|
34
|
+
with_highline(user_input) do
|
35
|
+
h.run
|
36
|
+
end
|
37
|
+
# no changes were made cause user was all like 'uhhh, no thxk'
|
38
|
+
assert_equal File.read(h.haml_writer.path), File.read(file_path("ex1.haml"))
|
39
|
+
end
|
40
|
+
|
14
41
|
test "can not initialize if the haml is not valid syntax" do
|
15
42
|
begin
|
16
43
|
Haml::I18n::Extractor.new(file_path("bad.haml"))
|
@@ -20,11 +47,6 @@ module Haml
|
|
20
47
|
end
|
21
48
|
end
|
22
49
|
|
23
|
-
test "can initialize if the haml is valid syntax" do
|
24
|
-
# setup method initializes
|
25
|
-
assert true, "extractor can initialize"
|
26
|
-
end
|
27
|
-
|
28
50
|
test "it can replace a string body and have expected output" do
|
29
51
|
expected_output = File.read(file_path("ex1.output.haml"))
|
30
52
|
assert_equal @ex1.new_body, expected_output
|
@@ -36,7 +58,7 @@ module Haml
|
|
36
58
|
@ex1.run
|
37
59
|
assert_equal File.exists?(@ex1.haml_writer.path), true
|
38
60
|
end
|
39
|
-
|
61
|
+
|
40
62
|
test "it writes the locale info to an out file when run" do
|
41
63
|
assert_equal File.exists?(@ex1.yaml_tool.locale_file), false
|
42
64
|
@ex1.run
|
@@ -44,16 +66,6 @@ module Haml
|
|
44
66
|
assert_equal YAML.load(File.read(@ex1.yaml_tool.locale_file)), @ex1.yaml_tool.yaml_hash
|
45
67
|
end
|
46
68
|
|
47
|
-
test "it raises if there is nothing to translate" do
|
48
|
-
begin
|
49
|
-
@nothing_to_translate = Haml::I18n::Extractor.new(file_path("nothing_to_translate.haml"))
|
50
|
-
assert_equal @ex1.yaml_tool.locale_hash, nil
|
51
|
-
@nothing_to_translate.run
|
52
|
-
rescue Haml::I18n::Extractor::NothingToTranslate
|
53
|
-
assert true, "NothingToTranslate raised"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
69
|
test "sends a hash over of replacement info to its yaml tool when run" do
|
58
70
|
@ex1 = Haml::I18n::Extractor.new(file_path("ex1.haml"))
|
59
71
|
assert_equal @ex1.yaml_tool.locale_hash, nil
|
@@ -69,10 +81,11 @@ module Haml
|
|
69
81
|
@ex1.haml_writer.body = File.read(file_path("bad.haml"))
|
70
82
|
@ex1.run
|
71
83
|
end
|
84
|
+
assert false, "should raise"
|
72
85
|
rescue Haml::I18n::Extractor::InvalidSyntax
|
73
86
|
assert true, "it should not allow invalid output to be written"
|
74
87
|
end
|
75
88
|
end
|
76
89
|
|
77
90
|
end
|
78
|
-
end
|
91
|
+
end
|
data/test/haml_reader_test.rb
CHANGED
data/test/haml_writer_test.rb
CHANGED
@@ -4,7 +4,7 @@ require 'fileutils'
|
|
4
4
|
module Haml
|
5
5
|
class HamlWriterTest < MiniTest::Unit::TestCase
|
6
6
|
|
7
|
-
ORIG_TEMP_FILE_PATH = "
|
7
|
+
ORIG_TEMP_FILE_PATH = File.join(TestHelper::TMPDIR, "foo_haml_extractor_test.haml")
|
8
8
|
|
9
9
|
def setup
|
10
10
|
File.open(ORIG_TEMP_FILE_PATH, "w") do |f|
|
@@ -18,15 +18,19 @@ module Haml
|
|
18
18
|
FileUtils.rm_rf(ORIG_TEMP_FILE_PATH)
|
19
19
|
end
|
20
20
|
|
21
|
-
test "
|
21
|
+
test "it can dump the file and that is the default" do
|
22
22
|
@writer = Haml::I18n::Extractor::HamlWriter.new(ORIG_TEMP_FILE_PATH)
|
23
|
-
|
23
|
+
@writer.body = "This is what it is"
|
24
|
+
@writer.write_file
|
25
|
+
assert_equal @writer.path, "#{TestHelper::TMPDIR}foo_haml_extractor_test.i18n-extractor.haml"
|
26
|
+
assert_equal File.read(@writer.path), "This is what it is\n"
|
24
27
|
end
|
25
|
-
|
26
|
-
test "it can
|
27
|
-
@writer = Haml::I18n::Extractor::HamlWriter.new(ORIG_TEMP_FILE_PATH)
|
28
|
+
|
29
|
+
test "it can overwrite the file" do
|
30
|
+
@writer = Haml::I18n::Extractor::HamlWriter.new(ORIG_TEMP_FILE_PATH, {:type => :overwrite})
|
28
31
|
@writer.body = "This is what it is"
|
29
32
|
@writer.write_file
|
33
|
+
assert_equal @writer.path, ORIG_TEMP_FILE_PATH # we ovewrote the original one.
|
30
34
|
assert_equal File.read(@writer.path), "This is what it is\n"
|
31
35
|
end
|
32
36
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Haml
|
4
|
+
class PrompterTest < MiniTest::Unit::TestCase
|
5
|
+
|
6
|
+
def test_asks_to_process_line_yes
|
7
|
+
with_highline("y") do
|
8
|
+
assert_equal Haml::I18n::Extractor::Prompter.new("orig", "replace").ask_user, true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_asks_to_process_line_no
|
13
|
+
with_highline("n") do
|
14
|
+
assert_equal Haml::I18n::Extractor::Prompter.new("orig", "replace").ask_user, false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
data/test/support/ex1.haml
CHANGED
data/test/test_helper.rb
CHANGED
@@ -13,8 +13,8 @@ require 'action_view'
|
|
13
13
|
require 'nokogiri'
|
14
14
|
require 'rails'
|
15
15
|
require 'fileutils'
|
16
|
-
|
17
16
|
require 'pry'
|
17
|
+
|
18
18
|
module Declarative
|
19
19
|
def test(name, &block)
|
20
20
|
define_method("test #{name}", &block)
|
@@ -79,6 +79,18 @@ def file_path(name)
|
|
79
79
|
File.dirname(__FILE__) + "/support/#{name}"
|
80
80
|
end
|
81
81
|
|
82
|
+
def with_highline(input = nil, &blk)
|
83
|
+
old_terminal = $terminal
|
84
|
+
@input = input ? StringIO.new(input) : StringIO.new
|
85
|
+
@output = StringIO.new
|
86
|
+
$terminal = HighLine.new(@input, @output)
|
87
|
+
yield
|
88
|
+
ensure
|
89
|
+
$terminal = old_terminal
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|
82
94
|
def without_rails_mode
|
83
95
|
Object.send(:remove_const, :Rails) if defined?(Rails)
|
84
96
|
yield
|
@@ -96,3 +108,55 @@ EOR
|
|
96
108
|
yield
|
97
109
|
end
|
98
110
|
|
111
|
+
module TestHelper
|
112
|
+
|
113
|
+
TMPDIR = File.join(File.dirname(__FILE__) + "/tmp/")
|
114
|
+
PROJECT_DIR = File.join(TMPDIR, "workflow/")
|
115
|
+
|
116
|
+
def self.setup_project_directory!
|
117
|
+
# mimic a rails app.
|
118
|
+
view1 = File.join(PROJECT_DIR, "app", "views", "view1")
|
119
|
+
view2 = File.join(PROJECT_DIR, "app", "views", "view2")
|
120
|
+
[ view1, view2 ].map do |dir|
|
121
|
+
FileUtils.mkdir_p(dir)
|
122
|
+
["thing.haml", "thang.haml"].map do |fn|
|
123
|
+
haml_text=<<EOH
|
124
|
+
%h1 Notifications
|
125
|
+
|
126
|
+
.nav= will_paginate(@consumer_notifications)
|
127
|
+
%table.themed{cellspacing: 0}
|
128
|
+
%thead
|
129
|
+
%tr
|
130
|
+
%th.first Type #{fn}_#{dir}
|
131
|
+
%th Identifier #{fn}_#{dir}
|
132
|
+
%th Data #{fn}_#{dir}
|
133
|
+
%th Success #{fn}_#{dir}
|
134
|
+
%th Reported To #{fn}_#{dir}
|
135
|
+
%th.last #{fn}_#{dir}
|
136
|
+
- @consumer_notifications.each do |cn|
|
137
|
+
%tr
|
138
|
+
%td.type= cn.notification.type
|
139
|
+
%td.identifier= cn.notification.identifier
|
140
|
+
%td.data= cn.notification.data
|
141
|
+
%td.success= cn.success
|
142
|
+
%td.reported_to= cn.reported_to
|
143
|
+
.nav= will_paginate(@consumer_notifications)
|
144
|
+
EOH
|
145
|
+
File.open(File.join(dir, fn), "w") do |f|
|
146
|
+
f.write haml_text
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
# config dir
|
151
|
+
FileUtils.mkdir_p(File.join(PROJECT_DIR, "config/locales"))
|
152
|
+
# for testing we're only working on .haml files.
|
153
|
+
File.open(File.join(view1, "not_haml.rb"), "w") do |f|
|
154
|
+
f.write "puts :not_haml"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.teardown_project_directory!
|
159
|
+
FileUtils.rm_rf(PROJECT_DIR)
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
data/test/text_finder_test.rb
CHANGED
@@ -3,12 +3,12 @@ require 'test_helper'
|
|
3
3
|
module Haml
|
4
4
|
class StringFinderTest < MiniTest::Unit::TestCase
|
5
5
|
|
6
|
-
# empty line
|
6
|
+
# empty line
|
7
7
|
test "empty line does not explode" do
|
8
8
|
assert_equal find_text(""), ""
|
9
9
|
assert_equal find_type(""), :text
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
# regular text mode
|
13
13
|
test "regular text without whitespaces" do
|
14
14
|
assert_equal find_text("iphone"), "iphone"
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Haml
|
4
|
+
class WorkflowTest < MiniTest::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
TestHelper.setup_project_directory! # tests here rely on this setup...
|
8
|
+
@workflow = Haml::I18n::Extractor::Workflow.new(TestHelper::PROJECT_DIR)
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
TestHelper.teardown_project_directory!
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_it_should_work_on_a_directory_mkay
|
16
|
+
filename = "#{TestHelper::PROJECT_DIR}app/views/bar/thang.haml"
|
17
|
+
bad_worfklow = Haml::I18n::Extractor::Workflow.new(filename)
|
18
|
+
assert false, "should raise"
|
19
|
+
rescue Haml::I18n::Extractor::NotADirectory
|
20
|
+
assert true, "workflow works on a directory bubba."
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_it_finds_all_haml_files
|
24
|
+
assert_equal @workflow.files.size, 4
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_outputs_stats
|
28
|
+
with_highline do
|
29
|
+
@workflow.output_stats
|
30
|
+
assert @output.string.match(/Found 4 haml files/), "Outputs stats"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_asks_to_process_file_yes
|
35
|
+
with_highline("O") do
|
36
|
+
assert_equal @workflow.process_file?(@workflow.files.first), :overwrite
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_asks_to_process_file_no
|
41
|
+
with_highline("N") do
|
42
|
+
assert_equal @workflow.process_file?(@workflow.files.first), nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_asks_to_process_file_dump
|
47
|
+
with_highline("D") do
|
48
|
+
assert_equal @workflow.process_file?(@workflow.files.first), :dump
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_run_works
|
53
|
+
automate_user_interaction = ""
|
54
|
+
6.times do # should be number of files we're testing on
|
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
|
60
|
+
end
|
61
|
+
with_highline(automate_user_interaction ) do
|
62
|
+
@workflow.run
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
metadata
CHANGED
@@ -1,93 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-i18n-extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Shai Rosenfeld
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-03
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: tilt
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: haml
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rails
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
45
|
- - ! '>='
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: 3.0.0
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: rbench
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: pry
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
73
|
- - ! '>='
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: '0'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: minitest
|
71
|
-
requirement:
|
72
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
73
86
|
requirements:
|
74
87
|
- - ! '>='
|
75
88
|
- !ruby/object:Gem::Version
|
76
89
|
version: '0'
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
80
97
|
- !ruby/object:Gem::Dependency
|
81
98
|
name: nokogiri
|
82
|
-
requirement:
|
83
|
-
none: false
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
84
100
|
requirements:
|
85
101
|
- - ! '>='
|
86
102
|
- !ruby/object:Gem::Version
|
87
103
|
version: '0'
|
88
104
|
type: :development
|
89
105
|
prerelease: false
|
90
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: highline
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
91
125
|
description: Parse the texts out of the haml files into localization files
|
92
126
|
email:
|
93
127
|
- shaiguitar@gmail.com
|
@@ -110,59 +144,62 @@ files:
|
|
110
144
|
- lib/haml-i18n-extractor/extractor.rb
|
111
145
|
- lib/haml-i18n-extractor/haml_reader.rb
|
112
146
|
- lib/haml-i18n-extractor/haml_writer.rb
|
147
|
+
- lib/haml-i18n-extractor/helpers.rb
|
148
|
+
- lib/haml-i18n-extractor/prompter.rb
|
113
149
|
- lib/haml-i18n-extractor/text_finder.rb
|
114
150
|
- lib/haml-i18n-extractor/text_replacer.rb
|
115
151
|
- lib/haml-i18n-extractor/version.rb
|
152
|
+
- lib/haml-i18n-extractor/workflow.rb
|
116
153
|
- lib/haml-i18n-extractor/yaml_tool.rb
|
117
154
|
- test/extractor_test.rb
|
118
155
|
- test/haml_reader_test.rb
|
119
156
|
- test/haml_writer_test.rb
|
157
|
+
- test/prompter_test.rb
|
120
158
|
- test/support/bad.haml
|
121
159
|
- test/support/ex1.haml
|
122
|
-
- test/support/ex1.i18n-extractor.haml
|
123
160
|
- test/support/ex1.output.haml
|
124
161
|
- test/support/nothing_to_translate.haml
|
125
162
|
- test/support/nothing_to_translate.i18n-extractor.haml
|
126
163
|
- test/test_helper.rb
|
127
164
|
- test/text_finder_test.rb
|
128
165
|
- test/text_replacer_test.rb
|
166
|
+
- test/workflow_test.rb
|
129
167
|
- test/yaml_tool_test.rb
|
130
168
|
homepage: ''
|
131
169
|
licenses: []
|
170
|
+
metadata: {}
|
132
171
|
post_install_message:
|
133
172
|
rdoc_options: []
|
134
173
|
require_paths:
|
135
174
|
- lib
|
136
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
176
|
requirements:
|
139
177
|
- - ! '>='
|
140
178
|
- !ruby/object:Gem::Version
|
141
179
|
version: '0'
|
142
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
181
|
requirements:
|
145
182
|
- - ! '>='
|
146
183
|
- !ruby/object:Gem::Version
|
147
184
|
version: '0'
|
148
185
|
requirements: []
|
149
186
|
rubyforge_project:
|
150
|
-
rubygems_version:
|
187
|
+
rubygems_version: 2.0.3
|
151
188
|
signing_key:
|
152
|
-
specification_version:
|
189
|
+
specification_version: 4
|
153
190
|
summary: Parse the texts out of the haml files into localization files
|
154
191
|
test_files:
|
155
192
|
- test/extractor_test.rb
|
156
193
|
- test/haml_reader_test.rb
|
157
194
|
- test/haml_writer_test.rb
|
195
|
+
- test/prompter_test.rb
|
158
196
|
- test/support/bad.haml
|
159
197
|
- test/support/ex1.haml
|
160
|
-
- test/support/ex1.i18n-extractor.haml
|
161
198
|
- test/support/ex1.output.haml
|
162
199
|
- test/support/nothing_to_translate.haml
|
163
200
|
- test/support/nothing_to_translate.i18n-extractor.haml
|
164
201
|
- test/test_helper.rb
|
165
202
|
- test/text_finder_test.rb
|
166
203
|
- test/text_replacer_test.rb
|
204
|
+
- test/workflow_test.rb
|
167
205
|
- test/yaml_tool_test.rb
|
168
|
-
has_rdoc:
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#header.page
|
2
|
-
%p#brand= link_to t('.some_place'), '/'
|
3
|
-
#menu
|
4
|
-
%ul.header-links
|
5
|
-
- if true
|
6
|
-
- if false
|
7
|
-
%li
|
8
|
-
%a#cheese-rice{:href => url_for([:admin, :dashboard])}
|
9
|
-
%span.thing-ok= t('.admin')
|
10
|
-
#bla
|
11
|
-
%ul#admin-dropdown-box
|
12
|
-
%li
|
13
|
-
%a{:href => url_for([:admin, :dashboard])}
|
14
|
-
%span= t('.admin_dashboard')
|
15
|
-
%li
|
16
|
-
%a{:href => url_for([:admin, :stacks])}
|
17
|
-
%span= t('.stacks')
|
18
|
-
%li
|
19
|
-
%a{:href => url_for([:admin, :environments])}
|
20
|
-
%span t('.alerts')
|
21
|
-
%li
|
22
|
-
%a{:href => url_for([:admin, :environments])}
|
23
|
-
%span= t('.alerts')
|
24
|
-
%li
|
25
|
-
%a{:href => url_for([:admin, :accounts])}
|
26
|
-
%span= t('.accounts')
|
27
|
-
- if true
|
28
|
-
= t('.what_is_supposed_to_be_is_supp')
|