torrent_search 0.0.2 → 0.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/.travis.yml +9 -0
- data/README.md +2 -1
- data/lib/torrent_search.rb +1 -0
- data/lib/torrent_search/controllers/download.rb +9 -1
- data/lib/torrent_search/os.rb +37 -0
- data/lib/torrent_search/services/download.rb +1 -1
- data/lib/torrent_search/version.rb +1 -1
- data/lib/torrent_search/views/download.rb +4 -0
- data/spec/spec_helper.rb +3 -8
- data/torrent_search.gemspec +1 -0
- metadata +17 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ef4bc7be29ff5011d1ef2a63b26922d9eccc7d5
|
|
4
|
+
data.tar.gz: 74c34e3bc9d0f3108f99bfebc0a91affa58b28de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f477408a4b71b82709c23f9dd06abba820a0a0ec59aa6386f6ab2ad0960cf668ef6eb9265d7d50c3ebb5e3984a0a45339937367e8b3c8f9ef0d0a41b0894d603
|
|
7
|
+
data.tar.gz: 837d4c862647e657e795c911bc1a28ba7859613a7b294b8576f1812eeef8c50bfff916cbb987448d4ed774de61dea0249c1ae5c6b3db066a79ab1dc8b2d8a6f1
|
data/.travis.yml
ADDED
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
[](http://badge.fury.io/rb/torrent_search)
|
|
2
|
+
[](https://travis-ci.org/joenas/torrent_search)
|
|
2
3
|
[](https://gemnasium.com/joenas/torrent_search)
|
|
3
|
-
|
|
4
|
+
[](https://coveralls.io/r/joenas/torrent_search)
|
|
4
5
|
|
|
5
6
|
# TorrentSearch
|
|
6
7
|
|
data/lib/torrent_search.rb
CHANGED
|
@@ -15,7 +15,15 @@ module TorrentSearch
|
|
|
15
15
|
private
|
|
16
16
|
def perform_download(torrent, path)
|
|
17
17
|
@view.downloading! torrent
|
|
18
|
-
Services::Download.new(path, torrent)
|
|
18
|
+
download = Services::Download.new(path, torrent)
|
|
19
|
+
download.perform @view
|
|
20
|
+
if download.success? && OS.os_x? && @view.open?
|
|
21
|
+
open download.filename
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def open(filename)
|
|
26
|
+
`open #{filename}`
|
|
19
27
|
end
|
|
20
28
|
|
|
21
29
|
def choose_torrent!
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'rbconfig'
|
|
2
|
+
|
|
3
|
+
module TorrentSearch
|
|
4
|
+
module OS
|
|
5
|
+
extend RbConfig
|
|
6
|
+
|
|
7
|
+
OSES = [:os_x, :windows, :linux]
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
|
|
11
|
+
def os_x?
|
|
12
|
+
match? /darwin/i
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def linux?
|
|
16
|
+
match? /linux|arch/i
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def windows?
|
|
20
|
+
match? /cygwin|mswin|mingw|bccwin|wince|emx/
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def to_s
|
|
24
|
+
CONFIG['host_os']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_sym
|
|
28
|
+
OSES.find {|os| self.send "#{os}?"} || :unknown
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
def match?(regexp)
|
|
33
|
+
!!(to_s =~ regexp)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -17,7 +17,6 @@ module TorrentSearch
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
private
|
|
21
20
|
def success?
|
|
22
21
|
response.code == 200
|
|
23
22
|
end
|
|
@@ -26,6 +25,7 @@ module TorrentSearch
|
|
|
26
25
|
File.join(@path, "#{@torrent.filename}.torrent")
|
|
27
26
|
end
|
|
28
27
|
|
|
28
|
+
private
|
|
29
29
|
def save!
|
|
30
30
|
File.open(filename, "wb") do |file|
|
|
31
31
|
file.write response.parsed_response
|
data/spec/spec_helper.rb
CHANGED
|
@@ -2,6 +2,8 @@ require 'torrent_search'
|
|
|
2
2
|
require 'rspec-given'
|
|
3
3
|
require 'vcr'
|
|
4
4
|
require 'webmock/rspec'
|
|
5
|
+
require 'coveralls'
|
|
6
|
+
Coveralls.wear!
|
|
5
7
|
|
|
6
8
|
Dir[File.dirname(__FILE__) + "/support/*.rb"].each{|file| require file}
|
|
7
9
|
|
|
@@ -9,17 +11,10 @@ RSpec.configure do |config|
|
|
|
9
11
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
10
12
|
config.run_all_when_everything_filtered = true
|
|
11
13
|
config.filter_run :focus
|
|
14
|
+
config.order = 'random'
|
|
12
15
|
|
|
13
16
|
config.before :all do
|
|
14
17
|
path = File.join(Dir.pwd, 'spec/tmp')
|
|
15
18
|
FileUtils.mkdir path unless File.exists? path
|
|
16
19
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Run specs in random order to surface order dependencies. If you find an
|
|
21
|
-
# order dependency and want to debug it, you can fix the order by providing
|
|
22
|
-
# the seed, which is printed after each run.
|
|
23
|
-
# --seed 1234
|
|
24
|
-
config.order = 'random'
|
|
25
20
|
end
|
data/torrent_search.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: torrent_search
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Neverland
|
|
@@ -164,6 +164,20 @@ dependencies:
|
|
|
164
164
|
- - '>='
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: coveralls
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - '>='
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - '>='
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '0'
|
|
167
181
|
description: Search various torrent sites
|
|
168
182
|
email:
|
|
169
183
|
- jonwestin@gmail.com
|
|
@@ -174,6 +188,7 @@ extra_rdoc_files: []
|
|
|
174
188
|
files:
|
|
175
189
|
- .gitignore
|
|
176
190
|
- .rspec
|
|
191
|
+
- .travis.yml
|
|
177
192
|
- Gemfile
|
|
178
193
|
- Guardfile
|
|
179
194
|
- LICENSE.txt
|
|
@@ -186,6 +201,7 @@ files:
|
|
|
186
201
|
- lib/torrent_search/controllers/download.rb
|
|
187
202
|
- lib/torrent_search/controllers/search.rb
|
|
188
203
|
- lib/torrent_search/default_command.rb
|
|
204
|
+
- lib/torrent_search/os.rb
|
|
189
205
|
- lib/torrent_search/result_table.rb
|
|
190
206
|
- lib/torrent_search/services/download.rb
|
|
191
207
|
- lib/torrent_search/trackers/kick_ass/kick_ass.rb
|