libspotify 12.1.51.3 → 12.1.51.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +47 -16
- data/lib/libspotify.rb +81 -25
- data/libspotify.gemspec +9 -1
- data/spec/libspotify_spec.rb +21 -7
- metadata +40 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 489be49afb2afe3540e2eef1b49e9d2bfaa085bd
|
4
|
+
data.tar.gz: 5ad6fe0c0a76a8ccadfb4511567278a5e7c2bb61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7e06226a9a55bf95c30581c0255d1a2fff936c67ffa6254eade8b7a4ede9f60e6400b61f89236780753593b696b91457b57e41f3906c993b877b46836f0436d
|
7
|
+
data.tar.gz: 7db535f77197a5782746fd7c54b4051095f122bc6525053c321d12cf6914eb2c72fbae652f4165d6fa92e67156b8e721788612c180fa1d953f48be39b38bdd2e
|
data/Rakefile
CHANGED
@@ -11,27 +11,22 @@ task :build do
|
|
11
11
|
# We want the right binary location.
|
12
12
|
require_relative "lib/libspotify"
|
13
13
|
|
14
|
-
|
15
|
-
platforms =
|
16
|
-
|
17
|
-
"universal-darwin" => %w"universal-darwin",
|
18
|
-
"i686-linux" => %w"i686-linux",
|
19
|
-
"x86_64-linux" => %w"x86_64-linux",
|
20
|
-
"arm-linux" => %w"armv5-linux",
|
21
|
-
"universal-java" => %w"universal-darwin i686-linux x86_64-linux armv5-linux",
|
22
|
-
Gem::Platform::RUBY => [], # fallback platform
|
23
|
-
}
|
14
|
+
platforms = Libspotify::PLATFORMS.dup
|
15
|
+
platforms[Gem::Platform::RUBY] = [] # fallback platform
|
16
|
+
platforms["universal-java"] = platforms.values.flatten.uniq
|
24
17
|
|
25
18
|
# Maps binaries to system path.
|
26
19
|
binaries =
|
27
20
|
{
|
28
|
-
"universal-darwin" => "libspotify-12.1.51-Darwin-universal/libspotify.framework/Versions/Current/libspotify",
|
29
|
-
"
|
21
|
+
"universal-darwin" => "libspotify-12.1.51-Darwin-universal/libspotify-12.1.51-Darwin-universal/libspotify.framework/Versions/Current/libspotify",
|
22
|
+
"x86-linux" => "libspotify-12.1.51-Linux-i686-release/lib/libspotify.so",
|
30
23
|
"x86_64-linux" => "libspotify-12.1.51-Linux-x86_64-release/lib/libspotify.so",
|
31
24
|
"armv5-linux" => "libspotify-12.1.51-Linux-armv5-release/lib/libspotify.so",
|
25
|
+
"armv6hf-linux" => "libspotify-12.1.103-Linux-armv6-bcm2708hardfp-release/lib/libspotify.so",
|
32
26
|
# armv5 works on both armv6 and armv7, so we always use armv5.
|
33
|
-
|
34
|
-
|
27
|
+
"armv6-linux" => "libspotify-12.1.51-Linux-armv6-release/lib/libspotify.so",
|
28
|
+
"armv7-linux" => "libspotify-12.1.51-Linux-armv7-release/lib/libspotify.so",
|
29
|
+
"x86-windows.dll" => "libspotify-12.1.51-win32-release/lib/libspotify.dll",
|
35
30
|
}
|
36
31
|
|
37
32
|
# Load our gem specification.
|
@@ -55,7 +50,7 @@ task :build do
|
|
55
50
|
MSG
|
56
51
|
else
|
57
52
|
source_binaries.each do |binary|
|
58
|
-
src_name = "bin/#{binaries
|
53
|
+
src_name = "bin/#{binaries.fetch(binary)}"
|
59
54
|
dest_name = "bin/#{binary}"
|
60
55
|
FileUtils.cp(src_name, dest_name, verbose: true)
|
61
56
|
spec.files << dest_name
|
@@ -76,7 +71,43 @@ task :build do
|
|
76
71
|
end
|
77
72
|
|
78
73
|
puts
|
79
|
-
puts "Do not forget to push to GitHub as well."
|
74
|
+
puts "Do not forget to tag and push to GitHub as well."
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "Download all known libspotify releases and unpack them"
|
78
|
+
task :download do
|
79
|
+
urls = %w[
|
80
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.64-iOS-universal.zip
|
81
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Android-arm-release.tar.gz
|
82
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-win32-release.zip
|
83
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Darwin-universal.zip
|
84
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-i686-release.tar.gz
|
85
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-x86_64-release.tar.gz
|
86
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-armv5-release.tar.gz
|
87
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-armv6-release.tar.gz
|
88
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-armv7-release.tar.gz
|
89
|
+
https://developer.spotify.com/download/libspotify/libspotify-12.1.103-Linux-armv6-bcm2708hardfp-release.tar.gz
|
90
|
+
]
|
91
|
+
|
92
|
+
Dir.chdir "bin" do
|
93
|
+
urls.map do |url|
|
94
|
+
Thread.new do
|
95
|
+
unless File.exist?(File.basename(url))
|
96
|
+
sh "curl", "-O", "-s", url
|
97
|
+
else
|
98
|
+
puts "Skipping #{url}."
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end.map(&:join)
|
102
|
+
|
103
|
+
Dir["./*.zip"].each do |zipfile|
|
104
|
+
sh "unzip", zipfile, "-d", File.basename(zipfile, ".zip")
|
105
|
+
end
|
106
|
+
|
107
|
+
Dir["./*.tar.gz"].each do |tarfile|
|
108
|
+
sh "tar", "xvfz", tarfile
|
109
|
+
end
|
110
|
+
end
|
80
111
|
end
|
81
112
|
|
82
113
|
desc "Launch an IRB console with the gem loaded."
|
data/lib/libspotify.rb
CHANGED
@@ -1,40 +1,96 @@
|
|
1
1
|
module Libspotify
|
2
2
|
VERSION = "12.1.51"
|
3
|
-
GEM_VERSION = "#{VERSION}.
|
3
|
+
GEM_VERSION = "#{VERSION}.4"
|
4
4
|
|
5
|
-
|
5
|
+
# Maps platform to libspotify binary name.
|
6
|
+
PLATFORMS = {
|
7
|
+
"universal-darwin" => %w"universal-darwin",
|
8
|
+
"x86-linux" => %w"x86-linux",
|
9
|
+
"x86_64-linux" => %w"x86_64-linux",
|
10
|
+
"arm-linux" => %w"armv6-linux armv6hf-linux",
|
11
|
+
"x86-mingw32" => %w"x86-windows.dll",
|
12
|
+
}
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
14
|
+
class << self
|
15
|
+
# @return [String] full path to libspotify binary.
|
16
|
+
def binary_path
|
17
|
+
File.expand_path("../bin/#{release_name}", File.dirname(__FILE__))
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [String] name of libspotify binary.
|
21
|
+
def release_name
|
22
|
+
host_platform = Gem::Platform.new(host_string)
|
23
|
+
|
24
|
+
_, binaries = PLATFORMS.find do |platform, _|
|
25
|
+
Gem::Platform.new(platform) === host_platform
|
26
|
+
end
|
27
|
+
|
28
|
+
binaries ||= []
|
29
|
+
|
30
|
+
binary = if binaries.length == 1
|
31
|
+
binaries[0]
|
32
|
+
elsif host_cpu =~ /armv(\d+)(hf)?/
|
33
|
+
host_version = $1.to_i
|
34
|
+
host_hf = $2
|
35
|
+
|
36
|
+
matches = PLATFORMS["arm-linux"].select do |bin|
|
37
|
+
version, hf = bin.match(/armv(\d+)(hf)?/)[1..2]
|
38
|
+
hf == host_hf && version.to_i <= host_version
|
39
|
+
end
|
40
|
+
|
41
|
+
matches.max_by { |bin| bin[/armv(\d+)/, 1].to_i }
|
42
|
+
else
|
43
|
+
nil # no rules for matching binaries, what to do?
|
44
|
+
end
|
45
|
+
|
46
|
+
binary || host_string
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# @return [String] platform name of the host, even on jruby
|
52
|
+
def host_string
|
53
|
+
"#{host_cpu}-#{host_os}"
|
54
|
+
end
|
11
55
|
|
12
|
-
|
13
|
-
|
14
|
-
def release_name
|
15
|
-
case RbConfig::CONFIG["host_os"]
|
16
|
-
when /darwin/
|
17
|
-
"universal-darwin"
|
18
|
-
when /linux/
|
56
|
+
# @return [String] host cpu, even on jruby
|
57
|
+
def host_cpu
|
19
58
|
case RbConfig::CONFIG["host_cpu"]
|
20
59
|
when /86_64/
|
21
|
-
"x86_64
|
60
|
+
"x86_64"
|
22
61
|
when /86/
|
23
|
-
"
|
24
|
-
when /
|
25
|
-
v = $1
|
62
|
+
"x86"
|
63
|
+
when /arm/
|
26
64
|
hf = "hf" if hard_float?
|
27
|
-
"
|
65
|
+
"armv#{arm_version}#{hf}"
|
66
|
+
else
|
67
|
+
RbConfig::CONFIG["host_cpu"]
|
28
68
|
end
|
29
|
-
else
|
30
|
-
"unknown-%s-%s" % RbConfig::CONFIG.values_at("host_cpu", "host_os")
|
31
69
|
end
|
32
|
-
end
|
33
70
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
71
|
+
# @return [String] host os, even on jruby
|
72
|
+
def host_os
|
73
|
+
case RbConfig::CONFIG["host_os"]
|
74
|
+
when /darwin/
|
75
|
+
"darwin"
|
76
|
+
when /linux/
|
77
|
+
"linux"
|
78
|
+
when /mingw|mswin/
|
79
|
+
"mingw32"
|
80
|
+
else
|
81
|
+
RbConfig::CONFIG["host_os"]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [Integer, nil] ARM instruction set version
|
86
|
+
def arm_version
|
87
|
+
File.read("/proc/cpuinfo")[/ARMv(\d+)/i, 1].to_i
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [Boolean] true if on a hard floating point OS of arm
|
91
|
+
def hard_float?
|
92
|
+
`readelf -a #{RbConfig.ruby}`.match(/Tag_ABI_VFP_args/)
|
93
|
+
end
|
38
94
|
end
|
39
95
|
end
|
40
96
|
|
data/libspotify.gemspec
CHANGED
@@ -6,7 +6,13 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.authors = ["Kim Burgestrand"]
|
7
7
|
gem.email = ["kim@burgestrand.se"]
|
8
8
|
gem.summary = %q{A binary ruby gem for distribution of libspotify.}
|
9
|
-
|
9
|
+
|
10
|
+
gem.description = <<-DESCRIPTION
|
11
|
+
libspotify is a ruby gem for distribution of libspotify binaries. It allows
|
12
|
+
download of libspotify through the rubygems package manager, and provides an
|
13
|
+
API for retrieving the binary file path.
|
14
|
+
DESCRIPTION
|
15
|
+
|
10
16
|
gem.homepage = "https://github.com/Burgestrand/libspotify"
|
11
17
|
gem.require_paths = ["lib"]
|
12
18
|
gem.files = `git ls-files`.split($/)
|
@@ -14,4 +20,6 @@ Gem::Specification.new do |gem|
|
|
14
20
|
|
15
21
|
gem.version = Libspotify::GEM_VERSION
|
16
22
|
gem.platform = Gem::Platform::RUBY
|
23
|
+
gem.add_development_dependency "rspec", "~> 2.0"
|
24
|
+
gem.add_development_dependency "rake", "~> 10.0"
|
17
25
|
end
|
data/spec/libspotify_spec.rb
CHANGED
@@ -18,26 +18,33 @@ describe Libspotify do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
specify "linux-gnu:i686" do
|
21
|
-
release_name.should eq "
|
21
|
+
release_name.should eq "x86-linux"
|
22
22
|
end
|
23
23
|
|
24
24
|
specify "linux-gnu:x86_64" do
|
25
25
|
release_name.should eq "x86_64-linux"
|
26
26
|
end
|
27
27
|
|
28
|
+
specify "mingw32:i686" do
|
29
|
+
release_name.should eq "x86-windows.dll"
|
30
|
+
end
|
31
|
+
|
28
32
|
context "soft float" do
|
29
33
|
before { Libspotify.stub(hard_float?: false) }
|
30
34
|
|
31
35
|
specify "linux-gnueabi:armv5l" do
|
36
|
+
Libspotify.stub(arm_version: 5)
|
32
37
|
release_name.should eq "armv5-linux"
|
33
38
|
end
|
34
39
|
|
35
40
|
specify "linux-gnueabi:armv6l" do
|
36
|
-
|
41
|
+
Libspotify.stub(arm_version: 6)
|
42
|
+
release_name.should eq "armv6-linux"
|
37
43
|
end
|
38
44
|
|
39
45
|
specify "linux-gnueabi:armv7l" do
|
40
|
-
|
46
|
+
Libspotify.stub(arm_version: 7)
|
47
|
+
release_name.should eq "armv6-linux"
|
41
48
|
end
|
42
49
|
end
|
43
50
|
|
@@ -45,20 +52,27 @@ describe Libspotify do
|
|
45
52
|
before { Libspotify.stub(hard_float?: true) }
|
46
53
|
|
47
54
|
specify "linux-gnueabi:armv5l" do
|
55
|
+
Libspotify.stub(arm_version: 5)
|
48
56
|
release_name.should eq "armv5hf-linux"
|
49
57
|
end
|
50
58
|
|
51
59
|
specify "linux-gnueabi:armv6l" do
|
52
|
-
|
60
|
+
Libspotify.stub(arm_version: 6)
|
61
|
+
release_name.should eq "armv6hf-linux"
|
53
62
|
end
|
54
63
|
|
55
64
|
specify "linux-gnueabi:armv7l" do
|
56
|
-
|
65
|
+
Libspotify.stub(arm_version: 7)
|
66
|
+
release_name.should eq "armv6hf-linux"
|
57
67
|
end
|
58
68
|
end
|
59
69
|
|
70
|
+
specify "linux:weird-cpu" do
|
71
|
+
release_name.should eq "weird-cpu-linux"
|
72
|
+
end
|
73
|
+
|
60
74
|
specify "weird-os:weird-cpu" do
|
61
|
-
release_name.should eq "
|
75
|
+
release_name.should eq "weird-cpu-weird-os"
|
62
76
|
end
|
63
77
|
end
|
64
78
|
|
@@ -67,7 +81,7 @@ describe Libspotify do
|
|
67
81
|
end
|
68
82
|
|
69
83
|
specify "GEM_VERSION" do
|
70
|
-
Libspotify::GEM_VERSION.should
|
84
|
+
Libspotify::GEM_VERSION.should match(/\A#{Regexp.quote(Libspotify::VERSION)}/)
|
71
85
|
end
|
72
86
|
|
73
87
|
specify "VERSION" do
|
metadata
CHANGED
@@ -1,24 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libspotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.1.51.
|
4
|
+
version: 12.1.51.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kim Burgestrand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: |
|
42
|
+
libspotify is a ruby gem for distribution of libspotify binaries. It allows
|
43
|
+
download of libspotify through the rubygems package manager, and provides an
|
44
|
+
API for retrieving the binary file path.
|
14
45
|
email:
|
15
46
|
- kim@burgestrand.se
|
16
47
|
executables: []
|
17
48
|
extensions: []
|
18
49
|
extra_rdoc_files: []
|
19
50
|
files:
|
20
|
-
- .gitignore
|
21
|
-
- .rspec
|
51
|
+
- ".gitignore"
|
52
|
+
- ".rspec"
|
22
53
|
- Gemfile
|
23
54
|
- README.md
|
24
55
|
- Rakefile
|
@@ -39,17 +70,17 @@ require_paths:
|
|
39
70
|
- lib
|
40
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
72
|
requirements:
|
42
|
-
- -
|
73
|
+
- - ">="
|
43
74
|
- !ruby/object:Gem::Version
|
44
75
|
version: '0'
|
45
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
77
|
requirements:
|
47
|
-
- -
|
78
|
+
- - ">="
|
48
79
|
- !ruby/object:Gem::Version
|
49
80
|
version: '0'
|
50
81
|
requirements: []
|
51
82
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.2.2
|
53
84
|
signing_key:
|
54
85
|
specification_version: 4
|
55
86
|
summary: A binary ruby gem for distribution of libspotify.
|