torrentify-cli 0.2 → 0.3

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: 1ce03ced786b2c161dfb41df62387b99078497d8
4
- data.tar.gz: e827ed9fa52c54875d545662dccb37768fbe0352
3
+ metadata.gz: 401b7c17957df9a764af5404cad1922b9f5b4256
4
+ data.tar.gz: 24c22ba5c2fd81866c62f568fdb00882f197aa29
5
5
  SHA512:
6
- metadata.gz: 6548ee15e2719d0b6218f4ebb6784d575c2d0129db4b3ad92fbbf332e6f616c80124f80cfb839a1372155360a0dc5e776e17aaba73b13ffdf2ed397017f25fc9
7
- data.tar.gz: 1f5437db4e3503b2227b657e81a4d812ff6ef7c7180046050ddd3976c4f1bfde297efca14454e21847833e2f4c4693890e839b402640db7fb6e95d2f458a3088
6
+ metadata.gz: baca6e020be2dc007e0e0190db6ec95b176d6095416d45ae943c6fbe92047aabbc272316ec8042d817863a92c1054752aea043654ac7a5cdd0dadb3c01cab70a
7
+ data.tar.gz: 3884e471265ff2b6b7a404665f9149bec7ac2cd093e9f02fd386a3e2a96488f82d7f0f3bd0d78de99b2c00a86f5848ad633c4fb32baee2fa730c8909a3a5c277
@@ -13,4 +13,7 @@ Style/ClassVars:
13
13
  Enabled: false
14
14
 
15
15
  Metrics/MethodLength:
16
+ Enabled: false
17
+
18
+ Metrics/AbcSize:
16
19
  Enabled: false
@@ -0,0 +1,2 @@
1
+ imdb_user_id:
2
+ - ur32409321
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ desc 'Clean, test and install app'
6
6
  task :default => [:test, :install]
7
7
 
8
8
  desc 'test'
9
- task :test => [:clean, :unitTest, :rubocop]
9
+ task :test => [:clean, :unitTest, :specTest, :rubocop]
10
10
 
11
11
  desc 'Remove coverage and pkg dirs before compilation'
12
12
  task :clean do
@@ -3,5 +3,5 @@
3
3
  require_relative '../lib/menu'
4
4
 
5
5
  begin
6
- Menu.start
6
+ Menu.new.start
7
7
  end
@@ -3,24 +3,69 @@
3
3
  require 'rubygems'
4
4
  require 'commander/import'
5
5
  require 'torrentify'
6
+ require 'yaml'
6
7
 
7
- program :version, '0.1'
8
- program :description, 'Terminal-client for webscraping torrent-sites'
8
+ # :name is optional, otherwise uses the basename of this executable
9
+ class Menu
10
+ program :name, 'Torrentify'
11
+ program :version, '1.0.0'
12
+ program :description, 'Interface for searching through torrentsites.'
13
+ def initialize(torrentify = Torrentify)
14
+ @torrentify = torrentify
15
+ end
16
+
17
+ attr_accessor :torrentify
9
18
 
10
- # Module responsible for client communication
11
- module Menu
12
- def self.start
19
+ def start
13
20
  command :search do |c|
14
- c.syntax = 'torrentify-cli search [options]'
15
- c.summary = ''
16
- c.description = ''
17
- c.example 'description', 'command example'
18
- c.option '--some-switch', 'Some switch that does something'
21
+ c.syntax = 'search foo'
22
+ c.description = 'Search for torrents '
23
+ c.option '--search-engine PIRATEBAY', String, 'Search piratebay'
24
+ c.option '--search-engine ISOHUNT', String, 'Search isohunt'
25
+ c.option '--search-engine KICKASS', String, 'Search kickass'
26
+ c.option '--search-engine EXTRATORRENT', String, 'Search extratorrent'
27
+ c.option '--search-engine ALL', String, 'Default. Searches all sites'
28
+ c.action do |args, options|
29
+ options.default :search_engine => 'ALL'
30
+ results = @torrentify.search args.join(' '), options.search_engine
31
+ results.each do |result|
32
+ puts '---------------------------------'
33
+ puts 'new search-engine'
34
+ puts '---------------------------------'
35
+ result.each do |torrent|
36
+ puts torrent
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ command :imdb do |c|
43
+ c.syntax = 'imdb userid'
44
+ c.description = 'Searches torrents for all movies on imdb watchlist'
19
45
  c.action do |args|
20
- search_param = args.join(' ')
21
- puts search_param
22
- Torrentify.search(search_param)
23
- # Do something or c.when_called Torrentify-cli::Commands::Search
46
+ imdb_user_id = ''
47
+ if args.first.nil?
48
+ yaml = YAML.load_file('.settings.yml')
49
+ imdb_user_id = yaml['imdb_user_id'].first
50
+ else
51
+ imdb_user_id = args.first
52
+ end
53
+ results = @torrentify.imdb_watchlist(imdb_user_id)
54
+ results.each do |result|
55
+ search_result = @torrentify.search_all_return_best(result)
56
+ puts search_result
57
+ end
58
+ end
59
+ end
60
+
61
+ command :bar do |c|
62
+ c.syntax = 'foobar bar [options]'
63
+ c.description = 'Display bar with optional prefix and suffix'
64
+ c.option '--prefix STRING', String, 'Adds a prefix to bar'
65
+ c.option '--suffix STRING', String, 'Adds a suffix to bar'
66
+ c.action do |_args, options|
67
+ options.default :prefix => '(', :suffix => ')'
68
+ say "#{options.prefix}bar#{options.suffix}"
24
69
  end
25
70
  end
26
71
  end
@@ -0,0 +1,15 @@
1
+ require_relative 'spec_helper'
2
+ require 'yaml'
3
+
4
+ RSpec.describe 'Settings' do
5
+ context 'load yml-file' do
6
+ it 'should not raise exception' do
7
+ # expect { YAML.load_file('.settings.yml') }.to_not raise_error
8
+ end
9
+
10
+ it 'should contain imdb_user_id' do
11
+ result = YAML.load_file('.settings.yml')
12
+ expect(result['imdb_user_id'].first).to eql('ur32409321')
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'spec_helper'
2
+ require_relative '../lib/menu'
3
+
4
+ RSpec.describe Menu do
5
+ context 'start' do
6
+ it '#start should be accessible' do
7
+ menu = double(Menu)
8
+ allow(menu).to receive(:start).and_return('hej')
9
+
10
+ result = menu.start
11
+
12
+ expect(result).to eql('hej')
13
+ end
14
+
15
+ it '#start should call torrentify' do
16
+ ARGV.replace %w{search a pigeon sat on a branch reflecting}
17
+
18
+ s = capture_stdout do
19
+ result = Menu.new.start
20
+ end
21
+
22
+ # expect(torrentify).to receive(:search).with('asd').and_return('då')
23
+
24
+ # expect(s.string).to eql('asd')
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ # Capture of stdout to STDOUT var
31
+ module Kernel
32
+ def capture_stdout
33
+ out = StringIO.new
34
+ $stdout = out
35
+ yield
36
+ return out
37
+ ensure
38
+ $stdout = STDOUT
39
+ end
40
+ end
@@ -0,0 +1,6 @@
1
+ require 'simplecov'
2
+ SimpleCov.add_filter 'vendor'
3
+ SimpleCov.add_filter 'test'
4
+ SimpleCov.command_name 'Spec tests'
5
+ SimpleCov.start
6
+ require 'rspec'
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'torrentify-cli'
7
- spec.version = 0.2
7
+ spec.version = 0.3
8
8
  spec.authors = ['david eriksson']
9
9
  spec.email = ['davideriksson@swedenmail.com']
10
10
 
11
- spec.summary = %w(A terminal client for searching through torrent-sites)
12
- spec.description = %w(A terminal client for searching through torrent-sites)
11
+ spec.summary = 'A terminal client for searching through torrent-sites'
12
+ spec.description = 'A terminal client for searching through torrent-sites'
13
13
  spec.homepage = 'http://seppaleinen.github.io/torrentify-cli'
14
14
 
15
15
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
27
  spec.require_paths = ['lib']
28
28
 
29
- spec.add_runtime_dependency 'commander', '4.3.5'
30
- spec.add_runtime_dependency 'torrentify', '0.3'
29
+ spec.add_runtime_dependency 'commander'
30
+ spec.add_runtime_dependency 'torrentify', '0.5'
31
31
  spec.add_development_dependency 'simplecov', '>= 0.7.1', '< 1.0.0'
32
32
  spec.add_development_dependency 'bundler', '~> 1.10.6'
33
33
  spec.add_development_dependency 'rake', '~> 10.4.2'
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'coveralls', '0.8.2'
36
36
  spec.add_development_dependency 'rspec', '3.3.0'
37
37
  spec.add_development_dependency 'test-unit', '3.1.3'
38
- spec.add_development_dependency 'rubocop', '~> 0.33.0'
38
+ spec.add_development_dependency 'rubocop', '~> 0.34.0'
39
39
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torrentify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - david eriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-05 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.3.5
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.3.5
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: torrentify
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.3'
33
+ version: '0.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.3'
40
+ version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -148,15 +148,15 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: 0.33.0
151
+ version: 0.34.0
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 0.33.0
159
- description: '["A", "terminal", "client", "for", "searching", "through", "torrent-sites"]'
158
+ version: 0.34.0
159
+ description: A terminal client for searching through torrent-sites
160
160
  email:
161
161
  - davideriksson@swedenmail.com
162
162
  executables:
@@ -167,6 +167,7 @@ files:
167
167
  - ".coveralls.yml"
168
168
  - ".gitignore"
169
169
  - ".rubocop.yml"
170
+ - ".settings.yml"
170
171
  - ".travis.yml"
171
172
  - Gemfile
172
173
  - LICENSE
@@ -174,6 +175,9 @@ files:
174
175
  - Rakefile
175
176
  - bin/torrentify
176
177
  - lib/menu.rb
178
+ - spec/load_settings_spec.rb
179
+ - spec/menu_spec.rb
180
+ - spec/spec_helper.rb
177
181
  - test/fake_test.rb
178
182
  - test/test_helper.rb
179
183
  - torrentify-cli.gemspec
@@ -200,7 +204,10 @@ rubyforge_project:
200
204
  rubygems_version: 2.4.6
201
205
  signing_key:
202
206
  specification_version: 4
203
- summary: '["A", "terminal", "client", "for", "searching", "through", "torrent-sites"]'
207
+ summary: A terminal client for searching through torrent-sites
204
208
  test_files:
209
+ - spec/load_settings_spec.rb
210
+ - spec/menu_spec.rb
211
+ - spec/spec_helper.rb
205
212
  - test/fake_test.rb
206
213
  - test/test_helper.rb