web_translate_it 2.6.4 → 2.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 186304899ba3932f5c4152b0a02bc34fbdb47d0392c88d8931e30976e66ea916
4
- data.tar.gz: 90cdef9f2d193d4d00a34a2362a7af85e2f7fb010d0455f47c1991935d7e0b85
3
+ metadata.gz: 6cef77421b30d347178a38e6fe50300e44d41a2c47fe46736ad79d76bc891374
4
+ data.tar.gz: e3d93cec2762262b06a8eb5aa2f71a901eb5ba77ff09b1e2f85462f765617501
5
5
  SHA512:
6
- metadata.gz: 9d78a7788bec607b0722bce91668ea89bfb6c05c6c2c5a1baaeb34fbfbc446f16817ac84f5a902c7edb6860fe626f6de2fd03dde9dd6cb96076c3f703fccb1a0
7
- data.tar.gz: 22ae36a655963dfc12092951c2aee41fa29612e1a69ae05ce0bb79b9361ce1eb81755cdaf3a7b53152e46971d5af322989424f22ff6eb9428f7b961fb1dcbcd0
6
+ metadata.gz: 154b48ea91ca07bc107ff3b551678bf152a791db84432be020d1e3f3444c7f0830f303f5a222947fdbf1178638648df973f1c2ff8755c8db30e22c8916808c75
7
+ data.tar.gz: 1bbf7533a388aeec98f9d0541c1839d95d18ed99d0cf2ccb4bb6400cb0852ddd8d98d04e4d29315b55c05790e70095db5d5a418ac47a1b47234ca84da495cf5b
data/bin/wti CHANGED
@@ -97,7 +97,7 @@ when 'rmlocale'
97
97
  end
98
98
  when 'status'
99
99
  Optimist.options do
100
- banner "wti status - Fetch and display project statistics.\nReturns 100 if untranslated segments exist in project\nReturns 101 if unproofread segments exist in project."
100
+ banner "wti status [filename] - Fetch and display project statistics.\nReturns 100 if untranslated segments exist in project\nReturns 101 if unproofread segments exist in project."
101
101
  opt :config, 'Path to a configuration file', short: '-c', default: '.wti'
102
102
  opt :debug, 'Display debug information'
103
103
  end
data/history.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## Version 2.7.0 / 2022-10-10
2
+
3
+ * New: Ability to see translation statistics per file.
4
+ - `wti status` gives the whole translation project statistics.
5
+ - `wti status path/to/file` gives the file translation statistics.
6
+ * Update readme file (installation instructions and add link to Docker package).
7
+ * Fix Rspec ExampleWording offences.
8
+
1
9
  ## Version 2.6.4 / 2022-09-22
2
10
 
3
11
  * Move development dependencies to Gemfile and commit Gemfile.lock to version control.
@@ -353,8 +353,15 @@ module WebTranslateIt
353
353
  true
354
354
  end
355
355
 
356
- def status # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
357
- stats = YAML.load(Project.fetch_stats(configuration.api_key))
356
+ def status # rubocop:todo Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
357
+ if parameters.any?
358
+ file = configuration.files.find { |f| parameters.first.strip == f.file_path }
359
+ abort "File '#{parameters.first}' not found." unless file
360
+
361
+ file_id = file.master_id || file.id
362
+ puts "Statistics for '#{parameters.first}':"
363
+ end
364
+ stats = YAML.load(Project.fetch_stats(configuration.api_key, file_id))
358
365
  completely_translated = true
359
366
  completely_proofread = true
360
367
  stats.each do |locale, values|
@@ -31,12 +31,13 @@ module WebTranslateIt
31
31
  success
32
32
  end
33
33
 
34
- def self.fetch_stats(api_key) # rubocop:todo Metrics/MethodLength
34
+ def self.fetch_stats(api_key, file_id = nil) # rubocop:todo Metrics/MethodLength
35
+ url = file_id.nil? ? "/api/projects/#{api_key}/stats.yaml" : "/api/projects/#{api_key}/stats.yaml?file=#{file_id}"
35
36
  success = true
36
37
  tries ||= 3
37
38
  begin
38
39
  WebTranslateIt::Connection.new(api_key) do |http|
39
- request = Net::HTTP::Get.new("/api/projects/#{api_key}/stats.yaml")
40
+ request = Net::HTTP::Get.new(url)
40
41
  WebTranslateIt::Util.add_fields(request)
41
42
  return Util.handle_response(http.request(request), true)
42
43
  end
data/readme.md CHANGED
@@ -3,7 +3,8 @@
3
3
  [RubyDoc](https://www.rubydoc.info/gems/web_translate_it/) |
4
4
  [Report a bug](https://github.com/webtranslateit/webtranslateit/issues) |
5
5
  [Support](https://webtranslateit.com/support) |
6
- [WebTranslateIt.com Homepage](https://webtranslateit.com)
6
+ [WebTranslateIt.com Homepage](https://webtranslateit.com) |
7
+ [Docker Package](https://github.com/webtranslateit/wti-docker/pkgs/container/wti-docker)
7
8
 
8
9
  wti lets you easily sync your language files with [WebTranslateIt.com](https://webtranslateit.com), a web-based tool to translation software.
9
10
 
@@ -11,7 +12,7 @@ wti lets you easily sync your language files with [WebTranslateIt.com](https://w
11
12
 
12
13
  ### wti...
13
14
 
14
- * wti is a **command-line tool**. It works on all operating systems: Windows, Linux, MacOS X...
15
+ * wti is a **command-line tool**. It works on all operating systems: Windows, Linux, MacOS X, ... It is also available as a [Docker package](https://github.com/webtranslateit/wti-docker/pkgs/container/wti-docker).
15
16
  * wti is really easy to use. It was inspired by git. Use `wti push` and `wti pull` to sync your language files with WebTranslateIt.com.
16
17
 
17
18
  ### Optionally, wti does...
@@ -24,12 +25,12 @@ wti lets you easily sync your language files with [WebTranslateIt.com](https://w
24
25
 
25
26
  ## Installation
26
27
 
27
- You will also need ruby to run `wti`. On Linux or a Mac, it’s already installed. Install [RubyInstaller](http://rubyinstaller.org/) if you’re using Windows. [See detailed installation instructions for Windows users](https://github.com/webtranslateit/webtranslateit/wiki/Install-wti-on-Windows).
28
+ You will also need ruby to run `wti`. We require ruby version 2.6 or newer. On Linux or a Mac, it’s already installed. Install [RubyInstaller](http://rubyinstaller.org/) if you’re using Windows. [See detailed installation instructions for Windows users](https://github.com/webtranslateit/webtranslateit/wiki/Install-wti-on-Windows).
28
29
 
29
30
  ``` bash
30
31
  $ gem install web_translate_it
31
- Fetching: web_translate_it-2.1.3.gem (100%)
32
- Successfully installed web_translate_it-2.1.3
32
+ Fetching: web_translate_it-2.6.4.gem (100%)
33
+ Successfully installed web_translate_it-2.6.4
33
34
  1 gem installed
34
35
  ```
35
36
 
@@ -37,26 +38,14 @@ At this point you should have the `wti` executable working:
37
38
 
38
39
  ``` bash
39
40
  $ wti -v
40
- wti version 2.2.1
41
+ wti version 2.6.4
41
42
  ```
42
43
 
43
- On some Linux distributions you may get the following error:
44
-
45
- ``` bash
46
- $ wti
47
- If 'wti' is not a typo you can use command-not-found to lookup the package that contains it, like this:
48
- cnf wti
49
- ```
50
-
51
- The reason is that the wti file is named in another way: `/usr/bin/wti.ruby2.1` so you will have to create a symlink to make wti run.
52
-
53
- ``` bash
54
- # ln -s /usr/bin/wti.ruby2.1 /usr/bin/wti
55
- ```
44
+ We also provide `wti` as a Docker packages. [See our packages and instructions to install](https://github.com/webtranslateit/wti-docker/pkgs/container/wti-docker).
56
45
 
57
46
  ## Configuration
58
47
 
59
- Now that the tool is installed, you’ll have to configure your project. Basically, `wti` is to be run on a project root directory, and looks for a `.wti` file containing your project information. The command `wti init` lets your create your `.wti` file.
48
+ Now that `wti` is installed, you’ll have to configure your project. Basically, `wti` is to be run on a project root directory, and looks for a `.wti` file containing your project information. The command `wti init` lets your create your `.wti` file.
60
49
 
61
50
  ``` bash
62
51
  $ wti init proj_pvt_V8skdjsdDDA4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json