web_translate_it 2.0.0.rc4 → 2.0.0

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.
data/bin/wti CHANGED
@@ -42,7 +42,7 @@ EOS
42
42
  opt :locale, "ISO code of locale(s) to pull", :type => :string
43
43
  opt :all, "Pull all files"
44
44
  opt :force, "Force pull (bypass conditional requests to WTI)"
45
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
45
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
46
46
  end
47
47
  when "push"
48
48
  Trollop::options do
@@ -58,43 +58,43 @@ EOS
58
58
  opt :ignore_missing, "Force WTI to not obsolete missing strings"
59
59
  opt :minor, "Minor Changes. When pushing a master file, prevents target translations to be flagged as `to_verify`."
60
60
  opt :label, "Apply a label to the changes", :type => :string
61
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
61
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
62
62
  end
63
63
  when "add"
64
64
  Trollop::options do
65
65
  banner "Create and push a new master language file"
66
66
  opt :low_priority, "WTI will process this file with a low priority"
67
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
67
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
68
68
  end
69
69
  when "rm"
70
70
  Trollop::options do
71
71
  banner "Delete a master language file"
72
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
72
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
73
73
  end
74
74
  when "addlocale"
75
75
  Trollop::options do
76
76
  banner "Add a new locale to the project"
77
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
77
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
78
78
  end
79
79
  when "rmlocale"
80
80
  Trollop::options do
81
81
  banner "Delete a locale from the project"
82
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
82
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
83
83
  end
84
84
  when "status"
85
85
  Trollop::options do
86
86
  banner "Fetch and display project statistics"
87
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
87
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
88
88
  end
89
89
  when "init"
90
90
  Trollop::options do
91
91
  banner "Configure your project to sync"
92
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
92
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
93
93
  end
94
94
  when "match"
95
95
  Trollop::options do
96
96
  banner "Display matching of local files with File Manager"
97
- opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
97
+ opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
98
98
  end
99
99
  else
100
100
  if command.nil?
data/history.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Version 2.0.0 / 2012-04-24
2
+
3
+ * Add more helpers to `wti init` a project
4
+ * Add ability to add a source locale to a project from the command line: the first `wti addlocale xx` sets the source locale.
5
+ * `wti add`: Display if there are no new files to add.
6
+
1
7
  ## Version 2.0.0.rc4 / 2012-04-23
2
8
 
3
9
  * Allow instantiating `WebTranslateIt::String` and `WebTranslateIt::Term` using a Hash made of symbols or strings.
@@ -64,6 +64,7 @@ module WebTranslateIt
64
64
 
65
65
  def add
66
66
  STDOUT.sync = true
67
+ puts "# Creating master files"
67
68
  if parameters == []
68
69
  puts StringUtil.failure("Error: You must provide the path to the master file to add.")
69
70
  puts "Usage: wti add path/to/master_file_1 path/to/master_file_2 ..."
@@ -71,12 +72,16 @@ module WebTranslateIt
71
72
  end
72
73
  WebTranslateIt::Connection.new(configuration.api_key) do |http|
73
74
  added = configuration.files.find_all{ |file| file.locale == configuration.source_locale}.collect {|file| File.expand_path(file.file_path) }.to_set
74
- parameters.reject{ |param| added.include?(File.expand_path(param))}.each do |param|
75
- file = TranslationFile.new(nil, param, nil, configuration.api_key)
76
- file.create(http, command_options.low_priority)
75
+ to_add = parameters.reject{ |param| added.include?(File.expand_path(param))}
76
+ if to_add.any?
77
+ to_add.each do |param|
78
+ file = TranslationFile.new(nil, param, nil, configuration.api_key)
79
+ file.create(http, command_options.low_priority)
80
+ end
81
+ else
82
+ puts "No new master file to add."
77
83
  end
78
84
  end
79
- puts StringUtil.success("Master file added.")
80
85
  end
81
86
 
82
87
  def rm
@@ -138,8 +143,9 @@ module WebTranslateIt
138
143
  end
139
144
 
140
145
  def init
141
- api_key = Util.ask("Project API Key:")
142
- path = Util.ask("Configuration file path:", '.wti')
146
+ puts "# Initializing project"
147
+ api_key = Util.ask(" Project API Key:")
148
+ path = Util.ask(" Path to configuration file:", '.wti')
143
149
  FileUtils.mkpath(path.split('/')[0..path.split('/').size-2].join('/')) unless path.split('/').count == 1
144
150
  project = YAML.load WebTranslateIt::Project.fetch_info(api_key)
145
151
  project_info = project['project']
@@ -149,7 +155,28 @@ module WebTranslateIt
149
155
  end
150
156
  File.open(path, 'w'){ |file| file << generate_configuration(api_key, project_info) }
151
157
  puts ""
152
- puts "Your project was successfully setup. You can now use `wti` to push and pull your language files."
158
+ puts " Your project was successfully initialized."
159
+ if project_info["source_locale"]["code"].nil? || project_info["target_locales"].count <= 1 || project_info["project_files"].none?
160
+ puts ""
161
+ puts " There are a few more things to set up:"
162
+ puts ""
163
+ end
164
+ if project_info["source_locale"]["code"].nil?
165
+ puts " *) You don't have a source locale setup."
166
+ puts " Add the source locale with: `wti addlocale <locale_code>`"
167
+ puts ""
168
+ end
169
+ if project_info["target_locales"].count <= 1
170
+ puts " *) You don't have a target locale setup."
171
+ puts " Add the first target locale with: `wti addlocale <locale_code>`"
172
+ puts ""
173
+ end
174
+ if project_info["project_files"].none?
175
+ puts " *) You don't have linguistic files setup."
176
+ puts " Add a master file with: `wti add <path/to/file.xml>`"
177
+ puts ""
178
+ end
179
+ puts "You can now use `wti` to push and pull your language files."
153
180
  puts "Check `wti --help` for help."
154
181
  end
155
182
 
@@ -7,7 +7,7 @@ module WebTranslateIt
7
7
  # Return a string representing the gem version
8
8
  # For example "1.8.3"
9
9
  def self.version
10
- IO.read(File.expand_path('../../../version', __FILE__))
10
+ File.read(File.expand_path('../../../version', __FILE__))
11
11
  end
12
12
 
13
13
  def self.calculate_percentage(processed, total)
data/version CHANGED
@@ -1 +1 @@
1
- 2.0.0.rc4
1
+ 2.0.0
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc4
5
- prerelease: 6
4
+ version: 2.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Édouard Brière
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-23 00:00:00.000000000 Z
12
+ date: 2012-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
@@ -150,9 +150,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
- - - ! '>'
153
+ - - ! '>='
154
154
  - !ruby/object:Gem::Version
155
- version: 1.3.1
155
+ version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
158
  rubygems_version: 1.8.23