termit 2.11.2 → 2.12.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: ebd731a4cb47111fc3419a6084c47b1d9ad9c66a
4
- data.tar.gz: bcc69e165160097b0266e141e3cb7091c9b413a5
3
+ metadata.gz: e075ba37fe770128b167d0abd852d14aee4e02e6
4
+ data.tar.gz: d2dbc52fb9bf43d989b10a4d7a29dc5803b9e465
5
5
  SHA512:
6
- metadata.gz: 4479f29a077a32d4f833b466609b451f5e3b32eacd1e789720f36252240e615d9c8b79edaf4118707566c8cd9b988f21967bd84b4cd12b0767c1f16239b2f025
7
- data.tar.gz: 1fecff40c2c52943ae22e119b18909ea577bb731dbe81909eb0b2544db279b65dbad2c5e4c28b7b6d03ea0999161ea96458374563e961bdf2ec84b2b5fc91348
6
+ metadata.gz: 30383a79af0f3f5f3c68a8c18369491900ef52f0b2e44459443d6f55e996e85ead16ac6cbc6669d4ec986285a05bf00a71e3539291410433ea99e52929b5075a
7
+ data.tar.gz: a8b8902566927731f1e548d0efc867f7d38ac8ee58b7cd487862f910f28949521e57810fe60ba0626ea37463b32d2fb9bd7220a8823025b2668afb21538a0f51
data/README.md CHANGED
@@ -52,19 +52,36 @@ termit es en muchacho -s
52
52
  => Synonyms: boy, lad, youngster, laddie, cully
53
53
  ```
54
54
 
55
- #### Learning language when committing to git (zsh only)
56
- Idea by [Nedomas](https://news.ycombinator.com/item?id=7545747) . See and hear your messages translated to target lang every time you commit:
55
+ #### Learning language when committing to git
56
+
57
+ 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.
58
+
59
+ ##### Override the `git` command (zsh only)
57
60
 
58
61
  In **~/.zshrc**
59
- ```bash
62
+
63
+ ``` bash
60
64
  export LANG=es
61
65
  git(){[[ "$@" = commit\ -m* ]]&&termit en $LANG ${${@:$#}//./} -t;command git $@}
62
66
  ```
63
67
 
64
68
  I am no shell ninja so if you know how to make it work in bash then please submit a PR.
65
69
 
70
+ ##### Using a post-commit hook
71
+
72
+ Add a file named `post-commit` to your project's `.git/hooks` directory, with this in it:
73
+
74
+ ```bash
75
+ termit en es "`git log -1 --pretty=format:'%s'`" -t
76
+ ```
77
+
78
+ Remember to switch the languages according to your preference.
79
+
80
+ If you want this to be in every one of your git repositories, see [this Stack Overflow answer](http://stackoverflow.com/a/8842663/249801).
81
+
66
82
 
67
83
  ## Language codes:
84
+
68
85
  * english - en
69
86
  * polish - pl
70
87
  * french - fr
@@ -1,11 +1,15 @@
1
1
  #encoding: UTF-8
2
2
  require 'net/http'
3
3
  require 'uri'
4
+ require 'openssl'
4
5
 
5
6
  module Termit
6
7
  class DataFetcher
7
8
  include CanOutput
8
9
  delegate :display_no_internet_msg, to: :output_manager
10
+ silence_warnings do
11
+ ::OpenSSL::SSL::VERIFY_PEER = ::OpenSSL::SSL::VERIFY_NONE
12
+ end
9
13
 
10
14
  def initialize url, text
11
15
  @url = url
@@ -0,0 +1,9 @@
1
+ module Kernel
2
+ def silence_warnings
3
+ original_verbosity = $VERBOSE
4
+ $VERBOSE = nil
5
+ result = yield
6
+ $VERBOSE = original_verbosity
7
+ return result
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Termit
2
- VERSION = "2.11.2"
2
+ VERSION = "2.12.0"
3
3
  end
data/lib/termit.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'delegate_it'
2
+ require 'termit/suppress_warnings'
2
3
  require 'termit/output_manager'
3
4
  require 'termit/can_output'
4
5
  require 'termit/user_input_parser'
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: 2.11.2
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: delegate_it
@@ -132,6 +132,7 @@ files:
132
132
  - lib/termit/output_manager.rb
133
133
  - lib/termit/sound_response_handler.rb
134
134
  - lib/termit/speech_synthesizer.rb
135
+ - lib/termit/suppress_warnings.rb
135
136
  - lib/termit/text_response_handler.rb
136
137
  - lib/termit/text_translator.rb
137
138
  - lib/termit/url_constructor.rb