web_translate_it 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/history.md +6 -0
- data/lib/web_translate_it.rb +2 -0
- data/lib/web_translate_it/command_line.rb +14 -6
- data/lib/web_translate_it/configuration.rb +5 -1
- data/lib/web_translate_it/tasks.rb +1 -2
- data/lib/web_translate_it/translation_file.rb +0 -1
- data/spec/web_translate_it/configuration_spec.rb +3 -3
- data/spec/web_translate_it_spec.rb +1 -1
- data/version.yml +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -44,6 +44,10 @@ Run `wti --help` to see the usage:
|
|
44
44
|
-v --version Show version.
|
45
45
|
-h --help This page.
|
46
46
|
|
47
|
+
You should also configure your language file paths in your project’s File Manager so the `web_translate_it` gems knows about your file structure, like so.
|
48
|
+
|
49
|
+
![Web Translate It File Manager](http://s3.amazonaws.com:80/edouard.baconfile.com/web_translate_it%2Ffile_manager.png)
|
50
|
+
|
47
51
|
## Specific tools for Ruby on Rails
|
48
52
|
|
49
53
|
This gem includes some rake tasks and a rack middleware to integrate Web Translate It with Ruby on Rails.
|
data/history.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## Version 1.6.2 /2010-04-01
|
2
|
+
|
3
|
+
* Bug fix: ability to run `rake` tasks if Web Translate It is installed as a plugin.
|
4
|
+
* Fix tests and 1 encoding bug for Ruby 1.9.
|
5
|
+
* Bug fix: prevents a few crashes when accessing non-configured projects.
|
6
|
+
|
1
7
|
## Version 1.6.1 /2010-03-26
|
2
8
|
|
3
9
|
* Bug fix: `wti push --all` was using an incorrect list of locales, thus not pushing all files.
|
data/lib/web_translate_it.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'util')
|
2
3
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'configuration')
|
3
4
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'translation_file')
|
4
5
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'auto_fetch')
|
5
6
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'command_line')
|
6
7
|
require File.join(File.dirname(__FILE__), 'web_translate_it', 'project')
|
8
|
+
require File.join(File.dirname(__FILE__), 'web_translate_it', 'tasks')
|
7
9
|
|
8
10
|
module WebTranslateIt
|
9
11
|
|
@@ -78,18 +78,26 @@ OPTION
|
|
78
78
|
project = YAML.load WebTranslateIt::Project.fetch_info(api_key)
|
79
79
|
project_info = project['project']
|
80
80
|
File.open(path, 'w'){ |file| file << generate_configuration(api_key, project_info) }
|
81
|
+
error = false
|
81
82
|
project_info['project_files'].each do |file|
|
82
|
-
if
|
83
|
+
if file['name'].blank?
|
84
|
+
puts "Project File #{file['id']} doesn’t seem to be set up."
|
85
|
+
error = true
|
86
|
+
elsif !File.exists?(file['name'])
|
83
87
|
puts "Could not find file `#{file['name']}`."
|
84
|
-
|
85
|
-
puts "https://webtranslateit.com/projects/#{project_info['id']}/files"
|
88
|
+
error = true
|
86
89
|
else
|
87
90
|
puts "Found #{file['name']}."
|
88
91
|
end
|
89
92
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
+
if error
|
94
|
+
puts "Please check the correct full path is specified in the File Manager"
|
95
|
+
puts "https://webtranslateit.com/projects/#{project_info['id']}/files"
|
96
|
+
else
|
97
|
+
puts ""
|
98
|
+
puts "Done! You can now use `wti` to push and pull your language files."
|
99
|
+
puts "Check `wti --help` for more information."
|
100
|
+
end
|
93
101
|
end
|
94
102
|
|
95
103
|
def self.stats
|
@@ -41,7 +41,11 @@ module WebTranslateIt
|
|
41
41
|
def set_files(project)
|
42
42
|
self.files = []
|
43
43
|
project['project_files'].each do |project_file|
|
44
|
-
|
44
|
+
if project_file['name'].blank?
|
45
|
+
puts "File #{project_file['id']} not set up"
|
46
|
+
else
|
47
|
+
self.files.push TranslationFile.new(project_file['id'], project_file['name'], project_file['locale_code'], self.api_key)
|
48
|
+
end
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
|
3
3
|
describe WebTranslateIt::Configuration do
|
4
4
|
describe "#initialize" do
|
5
5
|
it "should fetch and not blow up" do
|
6
|
-
Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
6
|
+
WebTranslateIt::Configuration::Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
7
7
|
lambda{ WebTranslateIt::Configuration.new }.should_not raise_error
|
8
8
|
end
|
9
9
|
|
@@ -17,7 +17,7 @@ describe WebTranslateIt::Configuration do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should assign the API key, files" do
|
20
|
-
Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
20
|
+
WebTranslateIt::Configuration::Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
21
21
|
configuration = WebTranslateIt::Configuration.new
|
22
22
|
configuration.api_key.should == '4af21ce1fb3a4f7127a60b31ebc41c1446b38bb2'
|
23
23
|
configuration.files.first.should be_a(WebTranslateIt::TranslationFile)
|
@@ -26,7 +26,7 @@ describe WebTranslateIt::Configuration do
|
|
26
26
|
|
27
27
|
describe "#set_locales_to_ignore" do
|
28
28
|
before(:each) do
|
29
|
-
Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
29
|
+
WebTranslateIt::Configuration::Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/../examples"))
|
30
30
|
@configuration = WebTranslateIt::Configuration.new
|
31
31
|
end
|
32
32
|
|
@@ -9,7 +9,7 @@ describe WebTranslateIt do
|
|
9
9
|
|
10
10
|
before(:each) do
|
11
11
|
WebTranslateIt::I18n.stub(:locale => 'en')
|
12
|
-
Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/examples"))
|
12
|
+
WebTranslateIt::Configuration::Rails = OpenStruct.new(:root => Pathname.new(File.dirname(__FILE__) + "/examples"))
|
13
13
|
@configuration = WebTranslateIt::Configuration.new
|
14
14
|
@file = mock(WebTranslateIt::TranslationFile)
|
15
15
|
@file.stub(:fetch => true, :locale => true)
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 1.6.
|
8
|
+
- 2
|
9
|
+
version: 1.6.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "\xC3\x89douard Bri\xC3\xA8re"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-01 00:00:00 +02:00
|
18
18
|
default_executable: wti
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|