geekdict 0.0.4 → 0.0.5

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: 8b34d25becd3be9a26746e8289dd7d39b607a528
4
- data.tar.gz: f9fba2e1d374c506424e1aff1282b7ceda8ff9c1
3
+ metadata.gz: 053b8b18ce1f41931acf408ccadfe262b49eda16
4
+ data.tar.gz: 48154697b0204e6b8a5270b3f97081720327f888
5
5
  SHA512:
6
- metadata.gz: b74fc4484acf5733ddde44e2eb77d2705b85160def6fdcd67d71810a131f96adc530c8b71eb31512915341426ff44568bc39b5fb2738c54d87a86da02629441c
7
- data.tar.gz: ec043b6dfacad6311d1206fc2e08b9b48f6a00af8b808ea5eaa253c4614eef4b0fcc16f05383b510d0d37bcbd15cde268014ddc0a4bebf27489f06ff43f7fa0b
6
+ metadata.gz: a5790f2bf30bdc36a1dd831dcd5d561ca560cb681afc5dfc25581ed73c1c145d71e62ed591333ee1f02d6c25b30f9b50d090b6e7ca8c1d7022266889af64bc49
7
+ data.tar.gz: 03d3cf70aafe5064d6d8bd7efb9278ffb3c092351f512dd463e74a613129e4c982794ba5ca999275ff728eb37b4c64dd5bca70352b4bfa78782df74667fe079d
data/README.md CHANGED
@@ -35,21 +35,24 @@ Use *help* command to get detail information.
35
35
  geekdict t
36
36
 
37
37
  Options:
38
- -d, [--debug], [--no-debug]
38
+ -d, [--debug], [--no-debug]
39
+ -o, [--open], [--no-open]
39
40
 
40
41
  Translate a word
41
42
 
42
43
 
44
+ Development
45
+ ----------
46
+ ```
47
+ bin/console
48
+ pry>GeekDict::CLI.start(['t','test'])
49
+
43
50
  TODOs
44
51
  -----
45
52
  It's under active development until it satisfy my needs. Below are something in my mind:
46
53
  * geekdict list : List all words you have searched
47
54
  * geekdict remove : Remove word you know from your new words list
48
55
  * Use google translate engine as alternative, as well as supporting other target language. Low priority, only focus on Chinese.
49
- * A simple website
50
- - Provide own translate service to translate and save new words
51
- - A command line interface to do the same thing like this
52
- - A nice web page to show all your new words, which could be a good place to review the new words and remember them.
53
56
 
54
57
  License
55
58
  -------
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "geekdict"
16
16
 
17
17
  s.files = %w[LICENSE README.md geekdict.gemspec Gemfile Rakefile]
18
- s.files += Dir.glob("bin/**/*")
18
+ s.files += Dir.glob("bin/geekdict")
19
19
  s.files += Dir.glob("lib/**/*.rb")
20
20
  s.files += Dir.glob("spec/**/*")
21
21
  s.test_files = Dir.glob("spec/**/*")
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.require_paths = ["lib"]
24
24
 
25
25
  s.add_development_dependency "rake"
26
+ s.add_development_dependency "pry"
26
27
  s.add_development_dependency "rspec", "~> 2.13.0"
27
28
 
28
29
  s.add_runtime_dependency "thor", "~> 0.19.1"
@@ -6,13 +6,20 @@ module GeekDict
6
6
 
7
7
  desc "t", "Translate a word"
8
8
  option :debug, :aliases=>'-d', :type=>:boolean,:default=>false
9
+ option :open, :aliases => '-o', :type => :boolean, :default=> false
9
10
  def t(word)
10
11
  GeekDict.debugger options[:debug]
11
12
  LocalHistory.save word
12
- result = GeekDict::Youdao.translate word
13
- output = result.join "\n"
14
- puts output
15
- output
13
+ if options[:open]
14
+ page = GeekDict::Youdao.url word
15
+ puts "Open Web page : #{page}"
16
+ `open #{page}`
17
+ else
18
+ result = GeekDict::Youdao.translate word
19
+ output = result.join "\n"
20
+ puts output
21
+ output
22
+ end
16
23
  end
17
24
 
18
25
  end
@@ -1,3 +1,3 @@
1
1
  module GeekDict
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -10,6 +10,10 @@ module GeekDict
10
10
 
11
11
  module_function
12
12
 
13
+ def url(word)
14
+ "http://dict.youdao.com/search?q=#{word}"
15
+ end
16
+
13
17
  def translate(word)
14
18
  @debugger = GeekDict.debugger
15
19
  client = HTTPClient.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geekdict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruce Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-11 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -118,4 +132,3 @@ test_files:
118
132
  - spec/cli_spec.rb
119
133
  - spec/debugger_spec.rb
120
134
  - spec/youdao/api_spec.rb
121
- has_rdoc: