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 +4 -4
- data/.rubocop.yml +3 -0
- data/.settings.yml +2 -0
- data/Rakefile +1 -1
- data/bin/torrentify +1 -1
- data/lib/menu.rb +59 -14
- data/spec/load_settings_spec.rb +15 -0
- data/spec/menu_spec.rb +40 -0
- data/spec/spec_helper.rb +6 -0
- data/torrentify-cli.gemspec +6 -6
- metadata +19 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 401b7c17957df9a764af5404cad1922b9f5b4256
|
4
|
+
data.tar.gz: 24c22ba5c2fd81866c62f568fdb00882f197aa29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baca6e020be2dc007e0e0190db6ec95b176d6095416d45ae943c6fbe92047aabbc272316ec8042d817863a92c1054752aea043654ac7a5cdd0dadb3c01cab70a
|
7
|
+
data.tar.gz: 3884e471265ff2b6b7a404665f9149bec7ac2cd093e9f02fd386a3e2a96488f82d7f0f3bd0d78de99b2c00a86f5848ad633c4fb32baee2fa730c8909a3a5c277
|
data/.rubocop.yml
CHANGED
data/.settings.yml
ADDED
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
|
data/bin/torrentify
CHANGED
data/lib/menu.rb
CHANGED
@@ -3,24 +3,69 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'commander/import'
|
5
5
|
require 'torrentify'
|
6
|
+
require 'yaml'
|
6
7
|
|
7
|
-
|
8
|
-
|
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
|
-
|
11
|
-
module Menu
|
12
|
-
def self.start
|
19
|
+
def start
|
13
20
|
command :search do |c|
|
14
|
-
c.syntax = '
|
15
|
-
c.
|
16
|
-
c.
|
17
|
-
c.
|
18
|
-
c.option '--
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
data/spec/menu_spec.rb
ADDED
@@ -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
|
data/spec/spec_helper.rb
ADDED
data/torrentify-cli.gemspec
CHANGED
@@ -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.
|
7
|
+
spec.version = 0.3
|
8
8
|
spec.authors = ['david eriksson']
|
9
9
|
spec.email = ['davideriksson@swedenmail.com']
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
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'
|
30
|
-
spec.add_runtime_dependency 'torrentify', '0.
|
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.
|
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.
|
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-
|
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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
159
|
-
description:
|
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:
|
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
|