web_translate_it 1.8.2.3 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/wti CHANGED
@@ -39,6 +39,7 @@ EOS
39
39
  opt :locale, "ISO code of locale(s) to pull", :type => :string
40
40
  opt :all, "Pull all files"
41
41
  opt :force, "Force pull (bypass conditional requests to WTI)"
42
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
42
43
  end
43
44
  when "push"
44
45
  Trollop::options do
@@ -52,14 +53,19 @@ EOS
52
53
  opt :merge, "Force WTI to merge this file"
53
54
  opt :ignore_missing, "Force WTI to not obsolete missing strings"
54
55
  opt :label, "Apply a label to the changes", :type => :string
56
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
55
57
  end
56
58
  when "add"
57
59
  Trollop::options do
58
60
  banner "Create and push a new master language file"
59
61
  opt :low_priority, "WTI will process this file with a low priority"
62
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
60
63
  end
61
64
  when "addlocale"
62
- Trollop::options { banner "Add a new locale to the project" }
65
+ Trollop::options do
66
+ banner "Add a new locale to the project"
67
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
68
+ end
63
69
  when "server"
64
70
  Trollop::options do
65
71
  banner <<-EOS
@@ -68,14 +74,24 @@ Start a synchronisation server
68
74
  EOS
69
75
  opt :port, "Run server on a specific port", :default => 4000, :short => "-p"
70
76
  opt :host, "Run server on a specific host", :default => "0.0.0.0", :short => "-h"
77
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
71
78
  end
72
79
  when "status"
73
- Trollop::options { banner "Fetch and display project statistics" }
74
80
  when "st"
81
+ Trollop::options do
82
+ banner "Fetch and display project statistics"
83
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
84
+ end
75
85
  when "init"
76
- Trollop::options { banner "Configure your project to sync" }
86
+ Trollop::options do
87
+ banner "Configure your project to sync"
88
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
89
+ end
77
90
  when "match"
78
- Trollop::options { banner "Display matching of local files with File Manager" }
91
+ Trollop::options do
92
+ banner "Display matching of local files with File Manager"
93
+ opt :config, "Path to a translation.yml file", :short => "-c", :default => ".wti"
94
+ end
79
95
  else
80
96
  Trollop::die "Unknown subcommand #{command.inspect}"
81
97
  end
data/history.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Version 1.8.3 / 2011-11-14
2
+
3
+ * Bring back `-c` option to specify a configuration file with a specific name. `wti pull -c config/translations.yml` for instance. See #67 and #71.
4
+ * `web_translate_it` rubygem now respects [semantic versioning](http://semver.org/). #72.
5
+
1
6
  ## Version 1.8.2.3 / 2011-11-09
2
7
 
3
8
  * Remove `sanitize_locale`. This method was replacing locale codes like `en_US` by `en-US`.
@@ -91,13 +91,16 @@ module WebTranslateIt
91
91
 
92
92
  def init
93
93
  api_key = Util.ask("Project API Key:")
94
+ path = Util.ask("Configuration file path:", '.wti')
95
+ puts path.split('/')[0..path.split('/').size-2].join('/')
96
+ FileUtils.mkpath(path.split('/')[0..path.split('/').size-2].join('/')) unless path.split('/').count == 1
94
97
  project = YAML.load WebTranslateIt::Project.fetch_info(api_key)
95
98
  project_info = project['project']
96
- if File.exists?('.wti') && !File.writable?('.wti')
97
- puts StringUtil.failure("Error: `.wti` file is not writable.")
99
+ if File.exists?(path) && !File.writable?(path)
100
+ puts StringUtil.failure("Error: `#{path}` file is not writable.")
98
101
  exit
99
102
  end
100
- File.open('.wti', 'w'){ |file| file << generate_configuration(api_key, project_info) }
103
+ File.open(path, 'w'){ |file| file << generate_configuration(api_key, project_info) }
101
104
  puts ""
102
105
  puts "Done! You can now use `wti` to push and pull your language files."
103
106
  puts "Check `wti --help` for help."
@@ -167,21 +170,26 @@ module WebTranslateIt
167
170
  end
168
171
 
169
172
  def configuration_file_path
170
- if File.exists?('config/translation.yml')
171
- puts "Warning: `config/translation.yml` is deprecated in favour of a `.wti` file."
172
- if Util.ask_yes_no("Would you like to migrate your configuration now?", true)
173
- require 'fileutils'
174
- if FileUtils.mv('config/translation.yml', '.wti')
175
- return '.wti'
173
+ if self.command_options.config
174
+ puts self.command_options.config
175
+ return self.command_options.config
176
+ else
177
+ if File.exists?('config/translation.yml')
178
+ puts "Warning: `config/translation.yml` is deprecated in favour of a `.wti` file."
179
+ if Util.ask_yes_no("Would you like to migrate your configuration now?", true)
180
+ require 'fileutils'
181
+ if FileUtils.mv('config/translation.yml', '.wti')
182
+ return '.wti'
183
+ else
184
+ puts "Couldn’t move `config/translation.yml`."
185
+ return false
186
+ end
176
187
  else
177
- puts "Couldn’t move `config/translation.yml`."
178
- return false
188
+ return 'config/translation.yml'
179
189
  end
180
190
  else
181
- return 'config/translation.yml'
191
+ return '.wti'
182
192
  end
183
- else
184
- return '.wti'
185
193
  end
186
194
  end
187
195
 
@@ -9,10 +9,10 @@ module WebTranslateIt
9
9
  class Util
10
10
 
11
11
  # Return a string representing the gem version
12
- # For example "1.4.4.1"
12
+ # For example "1.8.3"
13
13
  def self.version
14
14
  hash = YAML.load_file File.expand_path('../../../version.yml', __FILE__)
15
- [hash[:major], hash[:minor], hash[:tiny], hash[:patch]].join('.')
15
+ [hash[:major], hash[:minor], hash[:patch]].join('.')
16
16
  end
17
17
 
18
18
  # Yields a HTTP connection over SSL to Web Translate It.
data/readme.md CHANGED
@@ -59,6 +59,7 @@ Execute `wti --help` to see the usage:
59
59
  See `wti <command> --help` for more information on a specific command.
60
60
 
61
61
  [options] are:
62
+ --config, -c <s>: Path to a translation.yml file (default: .wti)
62
63
  --version, -v: Print version and exit
63
64
  --help, -h: Show this message
64
65
 
data/version.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 8
4
- :tiny: 2
5
4
  :patch: 3
5
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2.3
4
+ version: 1.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-09 00:00:00.000000000 Z
12
+ date: 2011-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
16
- requirement: &70355353286620 !ruby/object:Gem::Requirement
16
+ requirement: &70137380190740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70355353286620
24
+ version_requirements: *70137380190740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &70355353286060 !ruby/object:Gem::Requirement
27
+ requirement: &70137380190240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.16.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70355353286060
35
+ version_requirements: *70137380190240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &70355353324140 !ruby/object:Gem::Requirement
38
+ requirement: &70137380189780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.2.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70355353324140
46
+ version_requirements: *70137380189780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70355353323660 !ruby/object:Gem::Requirement
49
+ requirement: &70137380189320 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 2.6.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70355353323660
57
+ version_requirements: *70137380189320
58
58
  description:
59
59
  email: edouard@atelierconvivialite.com
60
60
  executables: