termit 3.2.0 → 3.4.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
  SHA1:
3
- metadata.gz: 2895a1d9671e3193682efb5f651ff2c2aa1deb88
4
- data.tar.gz: 81092caab71d4d3b34be10e4e7d991f82915e68d
3
+ metadata.gz: 5797f6696203fae412693a198de22f8c262441c3
4
+ data.tar.gz: 5c15c3812051b77bc0bc11d81412419d91f4a477
5
5
  SHA512:
6
- metadata.gz: 444802589298768d5f69b69aa60baeef7b66f4a69f5f3db34b10d1d87a1d5d0b60bdaa1abdee4b3f7800c3c1634970f24850a86bf6f2a468df87a482a104bb34
7
- data.tar.gz: 587c7fab7448bd2b9df80621477cfac98f854a83daa50e7f5e18e61eeb28d6244860715b889d256b7f47abd1f6325ae9c162164fd7b4be22bb1a73c26c55ce20
6
+ metadata.gz: c8912c534add29669c1d62f6387a82f9a5c223eb52f023f0285611cd1787fee6e7978e0c0d93af1bad1f41a1a5c6dd38aa7c0e59f3879e0874e3b2d925c6307d
7
+ data.tar.gz: 9929c140f731a41fa6cd994749ca156b0b60c98cd9e4f241303bb982285f11018d787d4e87f96314f65772fa082ead3a507453664c77e670cf6d8c8f04f25ee1
data/README.md CHANGED
@@ -1,25 +1,20 @@
1
- #Termit [![Build Status](https://travis-ci.org/pawurb/termit.png)](https://travis-ci.org/pawurb/termit) [![Gem Version](https://badge.fury.io/rb/termit.png)](http://badge.fury.io/rb/termit) [![Coverage Status](https://coveralls.io/repos/pawurb/termit/badge.png)](https://coveralls.io/r/pawurb/termit)
1
+ #Termit [![Build Status](https://travis-ci.org/pawurb/termit.svg)](https://travis-ci.org/pawurb/termit) [![Gem Version](https://badge.fury.io/rb/termit.svg)](http://badge.fury.io/rb/termit) [![Coverage Status](https://coveralls.io/repos/pawurb/termit/badge.svg)](https://coveralls.io/r/pawurb/termit)
2
2
 
3
- Termit is an easy way to translate stuff in your terminal. You can check out its node.js npm version [normit](https://github.com/pawurb/normit)
4
-
5
- ## Status
6
-
7
- I rewrote it to work with [Bing Translator](https://www.bing.com/translator) . Thanks to [Ragnarson](https://ragnarson.com) for supporting it !
3
+ Termit is an easy way to translate stuff in your terminal. You can check out its node.js npm version [normit](https://github.com/pawurb/normit).
8
4
 
9
5
  ## Installation
10
- ```ruby
6
+ ```bash
11
7
  gem install termit
12
8
  ```
13
9
 
14
10
  ## Usage
15
- ```ruby
11
+ ```bash
16
12
  termit 'source_language' 'target_language' 'text'
17
13
  ```
18
14
 
19
15
  Example:
20
16
 
21
- ```ruby
22
-
17
+ ```bash
23
18
  termit en es "hey cowboy where is your horse?"
24
19
  => "Hey vaquero dónde está tu caballo?"
25
20
 
@@ -28,40 +23,41 @@ termit fr en "qui est votre papa?"
28
23
  ```
29
24
 
30
25
  Parenthesis are not necessary for text data input:
31
- ```ruby
32
- termit fr ru qui est votre papa?
26
+ ```bash
27
+ termit fr ru qui est votre papa
33
28
  => "Кто твой папочка?"
34
29
  ```
35
- #### Speech synthesis
30
+
31
+ ### Speech synthesis
36
32
 
37
33
  Specify a **-t** (talk) flag to use speech synthesis (requires mpg123):
38
- ``` ruby
39
- termit en zh "hey cowboy where is your horse?" -t
40
- => "嘿,牛仔是你的马在哪里?" # and a chinese voice says something about a horse
34
+ ```bash
35
+ termit en fr "hey cowboy where is your horse?" -t
36
+ => "Hey cowboy où est votre cheval ?" # and a french voice says something about a horse
41
37
  ```
42
38
 
43
39
  You can use termit as a speech synthesizer of any supported language without having to translate anything:
44
- ``` ruby
40
+ ```bash
45
41
  termit en en "hold your horses cowboy !" -t
46
42
  => "hold your horses cowboy !" # and an english voice asks you to hold on
47
43
  ```
48
44
 
49
- #### Learning language when committing to git
45
+ ### Learning language when committing to git
50
46
 
51
47
  Idea by [Nedomas](https://news.ycombinator.com/item?id=7545747). See and hear your messages translated to target lang every time you commit. You can do this two ways: overriding the `git` command, and using a post-commit hook in git.
52
48
 
53
- ##### Override the `git` command (zsh only)
49
+ #### Override the `git` command (zsh only)
54
50
 
55
51
  In **~/.zshrc**
56
52
 
57
- ``` bash
53
+ ```bash
58
54
  export LANG=es
59
55
  git(){[[ "$@" = commit\ -m* ]]&&termit en $LANG ${${@:$#}//./} -t;command git $@}
60
56
  ```
61
57
 
62
58
  I am no shell ninja so if you know how to make it work in bash then please submit a PR.
63
59
 
64
- ##### Using a post-commit hook
60
+ #### Using a post-commit hook
65
61
 
66
62
  Add a file named `post-commit` to your project's `.git/hooks` directory, with this in it:
67
63
 
@@ -73,12 +69,10 @@ Remember to switch the languages according to your preference.
73
69
 
74
70
  If you want this to be in every one of your git repositories, see [this Stack Overflow answer](http://stackoverflow.com/a/8842663/249801).
75
71
 
76
-
77
72
  ## Language codes:
78
73
 
79
74
  To find all available language codes visit https://msdn.microsoft.com/en-us/library/hh456380.aspx
80
75
 
81
-
82
76
  ## Requirements
83
77
 
84
78
  Works with Ruby 1.9.2 and higher.
@@ -86,12 +80,18 @@ Works with Ruby 1.9.2 and higher.
86
80
  To use speech synthesis you need to have mpg123 installed.
87
81
 
88
82
  For Ubuntu:
89
-
90
- sudo apt-get install mpg123
83
+ ```bash
84
+ sudo apt-get install mpg123
85
+ ```
91
86
 
92
87
  For MacOSX:
88
+ ```bash
89
+ brew install mpg123
90
+ ```
91
+
92
+ ## Status
93
93
 
94
- brew install mpg123
94
+ It was rewritten to work with [Bing Translator](https://www.bing.com/translator) . Thanks to [Ragnarson](https://ragnarson.com) for supporting it !
95
95
 
96
96
  ## Disclaimer
97
97
 
data/bin/termit CHANGED
@@ -1,11 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
- # FIX https://github.com/rubygems/rubygems/issues/1420
5
- class Gem::Specification
6
- def this; self; end
7
- end
8
-
9
4
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')
10
5
 
11
6
  require 'termit'
@@ -14,8 +14,10 @@ module Termit
14
14
  def data
15
15
  send_request
16
16
  rescue RestClient::BadRequest
17
+ raise if ENV['DEBUG']
17
18
  display_invalid_data_msg
18
- rescue RestClient::Exception
19
+ rescue RestClient::Exception, SocketError
20
+ raise if ENV['DEBUG']
19
21
  display_error_msg
20
22
  end
21
23
 
@@ -1,3 +1,3 @@
1
1
  module Termit
2
- VERSION = "3.2.0"
2
+ VERSION = "3.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-29 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: delegate_it