iciba 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/bin/fy CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'iciba'
4
4
  require 'optparse'
5
- require 'readability'
6
5
  require 'fileutils'
7
6
 
8
7
  $links = false
@@ -46,17 +45,8 @@ end
46
45
  regex = /https?:\/\/[\S]+/
47
46
  links = ARGV.first.scan(regex)
48
47
 
49
- def loop_through_links(links)
50
- puts links.inspect
51
- links.each do |l|
52
- text = Readability::Document.new(Iciba::Tools.download(l).force_encoding("UTF-8")).content.gsub('<p>', '').gsub('</p>', "\r\n").gsub('</div>', '').gsub('<div>', '')
53
- puts wrap_text(text) unless text == ''
54
- puts '------------------------------------------------------------------------------------' unless text == ''
55
- end
56
- end
57
48
  # puts ARGV.join(' ')
58
49
  pinyin = ($pinyin ? true : false)
59
50
  extended = ($extended ? true : false)
60
51
  input_text = ARGV.join(' ').dup.encode("UTF-8")
61
- Iciba::Fanyi.new(input_text, 'auto', true, extended, pinyin)
62
- loop_through_links(links) if ($links && links.size > 0)
52
+ Iciba::Fanyi.new(input_text, 'auto', true, extended, pinyin)
@@ -17,10 +17,8 @@ Gem::Specification.new do |gem|
17
17
  # gem.add_dependency(%q<curb>, [">= 0"])
18
18
  gem.add_dependency('rest-client')
19
19
  gem.add_dependency(%q<hashie>, [">= 0"])
20
- gem.add_dependency(%q<yajl-ruby>, [">= 0"])
21
- gem.add_dependency(%q<nokogiri>, [">= 0"])
20
+ gem.add_dependency(%q<multi_json>, [">= 0"])
22
21
  gem.add_dependency(%q<hpricot>, [">= 0"])
23
- gem.add_dependency(%q<ruby-readability>, [">= 0"])
24
22
  gem.add_dependency(%q<string_to_pinyin>, ['>= 0'])
25
23
  gem.add_development_dependency(%q<pry>, ['>= 0'])
26
24
  end
@@ -1,8 +1,7 @@
1
1
  # coding: utf-8
2
- require 'yajl'
2
+ require 'multi_json'
3
3
  require 'hashie'
4
4
  require 'rest_client'
5
- require 'nokogiri'
6
5
  require 'hpricot'
7
6
  module Iciba
8
7
  module Tools
@@ -13,11 +12,11 @@ module Iciba
13
12
  end
14
13
 
15
14
  def self.parse(data)
16
- Hashie::Mash.new Yajl::Parser.new.parse(data)
15
+ Hashie::Mash.new MultiJson.load(data)
17
16
  end
18
17
 
19
18
  def self.encode(data)
20
- Yajl::Encoder.encode(data)
19
+ MultiJson.dump(data)
21
20
  end
22
21
 
23
22
 
@@ -1,3 +1,3 @@
1
1
  module Iciba
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iciba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -44,23 +44,7 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: yajl-ruby
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: nokogiri
47
+ name: multi_json
64
48
  requirement: !ruby/object:Gem::Requirement
65
49
  none: false
66
50
  requirements:
@@ -91,22 +75,6 @@ dependencies:
91
75
  - - ! '>='
92
76
  - !ruby/object:Gem::Version
93
77
  version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: ruby-readability
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :runtime
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
78
  - !ruby/object:Gem::Dependency
111
79
  name: string_to_pinyin
112
80
  requirement: !ruby/object:Gem::Requirement