termit 2.10.0 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/termit.rb +2 -1
- data/lib/termit/can_output.rb +11 -0
- data/lib/termit/data_fetcher.rb +2 -3
- data/lib/termit/speech_synthesizer.rb +3 -4
- data/lib/termit/text_response_handler.rb +2 -3
- data/lib/termit/user_input_parser.rb +2 -3
- data/lib/termit/version.rb +1 -1
- data/spec/spec_helper.rb +8 -1
- data/termit.gemspec +4 -3
- metadata +43 -31
- data/lib/termit/modules/delegation.rb +0 -11
- data/spec/termit/modules/delegation_spec.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f9e75aad9af89e1be49518db8d9129ebb104272
|
4
|
+
data.tar.gz: 2c3e0822b554f04d58483f24c8cbd158c559ae01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 829b061686a547dd4a6f8df76a1ac5e78fa9ed4c7f167579237117c384b94b9ab7ff1e297d2cc1eb2ea3b49a6f7f6ed9cce385e47592ec0b1f53796744cf2656
|
7
|
+
data.tar.gz: 282600673f4bbf3e0734e973da7824ab882b835111ee5716fd74e8da1cc1e9fb89bb85af9f17c9fd902ebae71170eec329780413f1239ad25535b7c7780fcf6b
|
data/README.md
CHANGED
@@ -62,6 +62,8 @@ export LANG=es
|
|
62
62
|
git(){[[ "$@" = commit\ -m* ]]&&termit en $LANG ${${@:$#}//./} -t;command git $@}
|
63
63
|
```
|
64
64
|
|
65
|
+
I am no shell ninja so if you know how to make it work in bash then please submit a PR.
|
66
|
+
|
65
67
|
|
66
68
|
## Language codes:
|
67
69
|
* english - en
|
@@ -73,7 +75,7 @@ git(){[[ "$@" = commit\ -m* ]]&&termit en $LANG ${${@:$#}//./} -t;command git $@
|
|
73
75
|
* russian - ru
|
74
76
|
* automatic source language detection - auto
|
75
77
|
|
76
|
-
To find all available language codes visit
|
78
|
+
To find all available language codes visit https://developers.google.com/translate/v2/using_rest#language-params.
|
77
79
|
|
78
80
|
## Requirements
|
79
81
|
|
data/lib/termit.rb
CHANGED
data/lib/termit/data_fetcher.rb
CHANGED
@@ -4,9 +4,8 @@ require 'uri'
|
|
4
4
|
|
5
5
|
module Termit
|
6
6
|
class DataFetcher
|
7
|
-
|
8
|
-
|
9
|
-
delegate :display_no_internet_msg, to: @output_manager
|
7
|
+
include CanOutput
|
8
|
+
delegate :display_no_internet_msg, to: :output_manager
|
10
9
|
|
11
10
|
def initialize url, text
|
12
11
|
@url = url
|
@@ -1,9 +1,8 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
module Termit
|
3
3
|
class SpeechSynthesizer
|
4
|
-
|
5
|
-
|
6
|
-
delegate :display_player_error_and_quit, to: @output_manager
|
4
|
+
include CanOutput
|
5
|
+
delegate :display_player_error_and_quit, to: :output_manager
|
7
6
|
|
8
7
|
def initialize options
|
9
8
|
check_sound_player
|
@@ -23,5 +22,5 @@ module Termit
|
|
23
22
|
display_player_error_and_quit
|
24
23
|
end
|
25
24
|
end
|
26
|
-
|
25
|
+
end
|
27
26
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
module Termit
|
3
3
|
class TextResponseHandler
|
4
|
-
|
5
|
-
|
6
|
-
delegate :display_synonyms, :display_translation, to: @output_manager
|
4
|
+
include CanOutput
|
5
|
+
delegate :display_synonyms, :display_translation, to: :output_manager
|
7
6
|
|
8
7
|
def initialize text, synonyms_wanted
|
9
8
|
@text = decode text
|
@@ -1,10 +1,9 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
module Termit
|
3
3
|
class UserInputParser
|
4
|
-
|
5
|
-
@output_manager = Termit::OutputManager.new
|
4
|
+
include CanOutput
|
6
5
|
|
7
|
-
delegate :display_error_info_and_quit, :display_help_and_quit, :display_version_and_quit, to:
|
6
|
+
delegate :display_error_info_and_quit, :display_help_and_quit, :display_version_and_quit, to: :output_manager
|
8
7
|
|
9
8
|
def initialize user_input
|
10
9
|
@user_input = user_input
|
data/lib/termit/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -4,13 +4,20 @@ require 'vcr'
|
|
4
4
|
require 'webmock/rspec'
|
5
5
|
require 'coveralls'
|
6
6
|
Coveralls.wear!
|
7
|
-
|
8
7
|
require_relative '../lib/termit'
|
9
8
|
|
10
9
|
RSpec.configure do |config|
|
11
10
|
original_stderr = $stderr
|
12
11
|
original_stdout = $stdout
|
13
12
|
|
13
|
+
config.mock_with :rspec do |c|
|
14
|
+
c.syntax = [:should, :expect]
|
15
|
+
end
|
16
|
+
|
17
|
+
config.expect_with :rspec do |c|
|
18
|
+
c.syntax = [:should, :expect]
|
19
|
+
end
|
20
|
+
|
14
21
|
# redirect output to file
|
15
22
|
config.before(:suite) do
|
16
23
|
$stderr = File.new(File.join(File.dirname(__FILE__), 'output.txt'), 'w')
|
data/termit.gemspec
CHANGED
@@ -16,9 +16,10 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^(spec)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
gem.license = "MIT"
|
19
|
-
gem.
|
20
|
-
gem.add_development_dependency "
|
21
|
-
gem.add_development_dependency "
|
19
|
+
gem.add_dependency "delegate_it"
|
20
|
+
gem.add_development_dependency "rspec"
|
21
|
+
gem.add_development_dependency "vcr"
|
22
|
+
gem.add_development_dependency "webmock"
|
22
23
|
gem.add_development_dependency "rake"
|
23
24
|
gem.add_development_dependency "coveralls"
|
24
25
|
gem.add_development_dependency "nyan-cat-formatter"
|
metadata
CHANGED
@@ -1,101 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: termit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.
|
4
|
+
version: 2.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: delegate_it
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- -
|
31
|
+
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: '0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- -
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: vcr
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: webmock
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: coveralls
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: nyan-cat-formatter
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
|
-
description:
|
98
|
-
from your terminal.
|
111
|
+
description: " Termit is an easy way to use all the Google Translate goodies straight
|
112
|
+
from your terminal. "
|
99
113
|
email:
|
100
114
|
- p.urbanek89@gmail.com
|
101
115
|
executables:
|
@@ -103,18 +117,18 @@ executables:
|
|
103
117
|
extensions: []
|
104
118
|
extra_rdoc_files: []
|
105
119
|
files:
|
106
|
-
- .gitignore
|
107
|
-
- .rspec
|
108
|
-
- .travis.yml
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
109
123
|
- Gemfile
|
110
124
|
- LICENSE.txt
|
111
125
|
- README.md
|
112
126
|
- Rakefile
|
113
127
|
- bin/termit
|
114
128
|
- lib/termit.rb
|
129
|
+
- lib/termit/can_output.rb
|
115
130
|
- lib/termit/data_fetcher.rb
|
116
131
|
- lib/termit/main.rb
|
117
|
-
- lib/termit/modules/delegation.rb
|
118
132
|
- lib/termit/output_manager.rb
|
119
133
|
- lib/termit/sound_response_handler.rb
|
120
134
|
- lib/termit/speech_synthesizer.rb
|
@@ -130,7 +144,6 @@ files:
|
|
130
144
|
- spec/spec_helper.rb
|
131
145
|
- spec/termit/data_fetcher_spec.rb
|
132
146
|
- spec/termit/main_spec.rb
|
133
|
-
- spec/termit/modules/delegation_spec.rb
|
134
147
|
- spec/termit/output_manager_spec.rb
|
135
148
|
- spec/termit/sound_response_handler_spec.rb
|
136
149
|
- spec/termit/speech_synthesizer_spec.rb
|
@@ -149,17 +162,17 @@ require_paths:
|
|
149
162
|
- lib
|
150
163
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
164
|
requirements:
|
152
|
-
- -
|
165
|
+
- - ">="
|
153
166
|
- !ruby/object:Gem::Version
|
154
167
|
version: '0'
|
155
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
169
|
requirements:
|
157
|
-
- -
|
170
|
+
- - ">="
|
158
171
|
- !ruby/object:Gem::Version
|
159
172
|
version: '0'
|
160
173
|
requirements: []
|
161
174
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.4.6
|
163
176
|
signing_key:
|
164
177
|
specification_version: 4
|
165
178
|
summary: Google Translate in your terminal
|
@@ -171,7 +184,6 @@ test_files:
|
|
171
184
|
- spec/spec_helper.rb
|
172
185
|
- spec/termit/data_fetcher_spec.rb
|
173
186
|
- spec/termit/main_spec.rb
|
174
|
-
- spec/termit/modules/delegation_spec.rb
|
175
187
|
- spec/termit/output_manager_spec.rb
|
176
188
|
- spec/termit/sound_response_handler_spec.rb
|
177
189
|
- spec/termit/speech_synthesizer_spec.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class DummyDelegate
|
4
|
-
def hello
|
5
|
-
'Hello there'
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class DummyDelegator
|
10
|
-
extend ::Delegation
|
11
|
-
@delegate = ::DummyDelegate.new
|
12
|
-
|
13
|
-
delegate :hello, to: @delegate
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
describe "Delegation module" do
|
18
|
-
describe "functionality" do
|
19
|
-
subject do
|
20
|
-
DummyDelegator.new
|
21
|
-
end
|
22
|
-
|
23
|
-
it "enables delegating to target objects" do
|
24
|
-
expect(subject.hello).to eq 'Hello there'
|
25
|
-
end
|
26
|
-
|
27
|
-
it "still raises error if method is not defined" do
|
28
|
-
expect { subject.goodbye }.to raise_error(NoMethodError)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|