youtube-dl.rb 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: e2f3b80e2f598cbea19cdb6aa760535bd1735ef1
4
- data.tar.gz: 372eadeb8f68fe3d9bf659ea1d1528b26b028b72
3
+ metadata.gz: c8aa4aaf1fec27c155961efff901ade4498033d3
4
+ data.tar.gz: caf564fb87360422cbfaedacf413aa3dc7929a41
5
5
  SHA512:
6
- metadata.gz: 5bfdb2529020c00c0baa402acabd604e970c82cccd126aefb651ea26b39e89a15ea7d08ade283c1763785f46378fa6cced2ed3a548ea94b60bbc93ccbe8940c1
7
- data.tar.gz: 4d151900a4a7a2dd3556e01c9f4236820b27b7532a71a1200678dc9e3dfe4603da960c4d4e5b07cdba6c88fce94d99383b76c789f6fa61be8f9d5e5caf1e1acc
6
+ metadata.gz: 45a5112701f59e6b028a329000e056c70b3f1575d70cb3517c8c6ca07fc7d23c42e16c002a13df663c07bf6b64dc21b98fae3063fc07bbb7d39541cc281da4c6
7
+ data.tar.gz: 84321d4274729c199d4c9f893b71205b0c8bb46bba71f2185bdd2c2073f44ac5c464a054ad17ff3fe9d46060dbe2fa1c843d95e98a0dfd485a35027f129fae13
data/.gitignore CHANGED
File without changes
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
- before_install: 'sudo pip install youtube-dl'
1
+ before_install: 'sudo chmod 755 ./vendor/bin/youtube-dl'
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -3,25 +3,6 @@
3
3
  Ruby wrapper for [youtube-dl](http://rg3.github.io/youtube-dl/).
4
4
  [![Build Status](https://travis-ci.org/layer8x/youtube-dl.rb.svg?branch=master)](https://travis-ci.org/layer8x/youtube-dl.rb)
5
5
 
6
- ## Installing youtube-dl
7
- This gem does not ship with the `youtube-dl` command-line program (yet!) so you will need to install `youtube-dl` manually. Luckily there are three ways to do it.
8
-
9
- ### The easy way
10
- Use your distro's package manager!
11
-
12
- $ apt-get install youtube-dl
13
- $ brew install youtube-dl
14
-
15
- Or through Pip
16
-
17
- $ pip install youtube-dl
18
-
19
- ### The slightly harder way
20
- ```bash
21
- sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
22
- sudo chmod a+x /usr/local/bin/youtube-dl
23
- ```
24
-
25
6
  ## Install the gem
26
7
 
27
8
  Add this line to your application's Gemfile:
@@ -38,6 +19,9 @@ Or install it yourself as:
38
19
 
39
20
  $ gem install youtube-dl.rb
40
21
 
22
+ ## Install youtube-dl
23
+ This gem ships with the latest (working) version of youtube-dl built-in, so you don't have to install youtube-dl at all! Unless you want to.
24
+
41
25
  ## Usage
42
26
 
43
27
  Pretty simple.
@@ -67,3 +51,5 @@ YoutubeDL.download "https://www.youtube.com/watch?v=gvdf5n-zI14", options
67
51
  4. Pass test suite (`rake test`)
68
52
  5. Push to the branch (`git push origin my-new-feature`)
69
53
  6. Create a new Pull Request
54
+
55
+ Remember: commit now, commit often.
data/Rakefile CHANGED
@@ -6,3 +6,22 @@ Rake::TestTask.new do |t|
6
6
  end
7
7
 
8
8
  task :default => [:test]
9
+
10
+ namespace :binaries do
11
+ def get_binaries(version)
12
+ puts "Updating python script"
13
+ system("wget -O ./vendor/bin/youtube-dl https://yt-dl.org/downloads/#{version}/youtube-dl")
14
+ puts "Updating Windows EXE"
15
+ system("wget -O ./vendor/bin/youtube-dl.exe https://yt-dl.org/downloads/#{version}/youtube-dl.exe")
16
+ end
17
+
18
+ desc "Get latest binaries"
19
+ task :latest do
20
+ get_binaries('latest')
21
+ end
22
+
23
+ desc "Get binaries for specific version (run with `rake binaries:version[2015.07.07]`)"
24
+ task :version, [:ver] do |t, a|
25
+ get_binaries(a[:ver])
26
+ end
27
+ end
File without changes
@@ -13,7 +13,7 @@ module YoutubeDL
13
13
  def initialize(url, options=YoutubeDL::Options.new)
14
14
  @url = url
15
15
  @options = YoutubeDL::Options.new(options.to_hash)
16
- @executable_path = 'youtube-dl'
16
+ @executable_path = usable_executable_path
17
17
  end
18
18
 
19
19
  # Returns Cocaine's runner engine
@@ -68,5 +68,19 @@ module YoutubeDL
68
68
  def cocaine_line(command)
69
69
  Cocaine::CommandLine.new(@executable_path, command)
70
70
  end
71
+
72
+ # Returns a usable executable (system or vendor)
73
+ #
74
+ # @return [String] youtube-dl executable path
75
+ def usable_executable_path
76
+ system_path = `which youtube-dl`
77
+ if $?.exitstatus == 0
78
+ system_path
79
+ else
80
+ vendor_path = File.absolute_path("#{__FILE__}/../../../vendor/bin/youtube-dl")
81
+ File.chmod(775, vendor_path) unless File.executable?(vendor_path) # Make sure vendor binary is executable
82
+ vendor_path
83
+ end
84
+ end
71
85
  end
72
86
  end
@@ -1,3 +1,3 @@
1
1
  module YoutubeDL
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/youtube-dl.rb CHANGED
File without changes
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
1
3
  gem 'minitest'
2
4
  require 'minitest/autorun'
3
5
  require 'minitest/spec'
File without changes
@@ -18,13 +18,13 @@ describe YoutubeDL::Runner do
18
18
  end
19
19
 
20
20
  it 'should set executable path automatically' do
21
- assert_equal @runner.executable_path, 'youtube-dl'
21
+ assert_match 'youtube-dl', @runner.executable_path
22
22
  end
23
23
 
24
24
  it 'should parse key-values from options' do
25
25
  @runner.options.some_key = "a value"
26
26
 
27
- refute_nil @runner.to_command.match(/--some-key\s.*a value.*/)
27
+ refute_nil @runner.to_command.match(/--some-key\s.*a value.*/)
28
28
  end
29
29
 
30
30
  it 'should not include the value if value is true' do
File without changes
Binary file
Binary file
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.5.1"
27
27
  spec.add_development_dependency "purdytest"
28
+ spec.add_development_dependency "codeclimate-test-reporter"
28
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube-dl.rb
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
  - sapslaj
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-18 00:00:00.000000000 Z
12
+ date: 2015-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocaine
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: codeclimate-test-reporter
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
98
112
  description: in the spirit of pygments.rb and MiniMagick, youtube-dl.rb is a command
99
113
  line wrapper for the python script youtube-dl
100
114
  email:
@@ -117,6 +131,8 @@ files:
117
131
  - test/youtube-dl/options_test.rb
118
132
  - test/youtube-dl/runner_test.rb
119
133
  - test/youtube-dl/youtube-dl_test.rb
134
+ - vendor/bin/youtube-dl
135
+ - vendor/bin/youtube-dl.exe
120
136
  - youtube-dl.rb.gemspec
121
137
  homepage: https://github.com/layer8x/youtube-dl.rb
122
138
  licenses:
@@ -138,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
154
  version: '0'
139
155
  requirements: []
140
156
  rubyforge_project:
141
- rubygems_version: 2.2.2
157
+ rubygems_version: 2.4.8
142
158
  signing_key:
143
159
  specification_version: 4
144
160
  summary: youtube-dl wrapper for Ruby