torrent_search 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12ddba74cad73e48b10325bc3d675c3847ace3dd
4
- data.tar.gz: 2596e6a414aa0ab60d4a2648ea8d6949a499f1d1
3
+ metadata.gz: 0ef4bc7be29ff5011d1ef2a63b26922d9eccc7d5
4
+ data.tar.gz: 74c34e3bc9d0f3108f99bfebc0a91affa58b28de
5
5
  SHA512:
6
- metadata.gz: a277fc48659c4c2d040081f594f095bb44ac16ab03cc63bf5bab8605f30e247971dfea548b6e7659480795541776c41db38e678f3eed18924a7439d2dd6c69a2
7
- data.tar.gz: 2ed1dae9c1625eae4e7d6147404686940295344027646cc41ce2e83a256c9de5161ac16e30dcebb21c8f84294949bea0983900d72f2d2189efc7ada9edb96047
6
+ metadata.gz: f477408a4b71b82709c23f9dd06abba820a0a0ec59aa6386f6ab2ad0960cf668ef6eb9265d7d50c3ebb5e3984a0a45339937367e8b3c8f9ef0d0a41b0894d603
7
+ data.tar.gz: 837d4c862647e657e795c911bc1a28ba7859613a7b294b8576f1812eeef8c50bfff916cbb987448d4ed774de61dea0249c1ae5c6b3db066a79ab1dc8b2d8a6f1
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-19mode
5
+ - 2.0.0
6
+ branches:
7
+ only:
8
+ - master
9
+ script: rspec spec
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/torrent_search.png)](http://badge.fury.io/rb/torrent_search)
2
+ [![Build Status](https://travis-ci.org/joenas/torrent_search.png)](https://travis-ci.org/joenas/torrent_search)
2
3
  [![Dependency Status](https://gemnasium.com/joenas/torrent_search.png)](https://gemnasium.com/joenas/torrent_search)
3
-
4
+ [![Coverage Status](https://coveralls.io/repos/joenas/torrent_search/badge.png)](https://coveralls.io/r/joenas/torrent_search)
4
5
 
5
6
  # TorrentSearch
6
7
 
@@ -1,6 +1,7 @@
1
1
  require 'thor'
2
2
  require 'torrent_search/default_command'
3
3
  require 'torrent_search/cli'
4
+ require 'torrent_search/os'
4
5
 
5
6
  require "torrent_search/trackers/kick_ass/kick_ass"
6
7
 
@@ -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).perform @view
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
@@ -1,3 +1,3 @@
1
1
  module TorrentSearch
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -21,6 +21,10 @@ module TorrentSearch
21
21
  def failure(error, href)
22
22
  say "Error: #{error.message} - #{href}", :red
23
23
  end
24
+
25
+ def open?
26
+ yes? 'Open? (y/n):'
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -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
@@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "guard-rspec", ">=2.4"
31
31
  spec.add_development_dependency "vcr"
32
32
  spec.add_development_dependency "webmock"
33
+ spec.add_development_dependency 'coveralls'
33
34
 
34
35
  end
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.2
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