Module: Libspotify
- Defined in:
- lib/libspotify.rb
Constant Summary collapse
- VERSION =
"12.1.51"- GEM_VERSION =
"#{VERSION}.4"- PLATFORMS =
Maps platform to libspotify binary name.
{ "universal-darwin" => %w"universal-darwin", "x86-linux" => %w"x86-linux", "x86_64-linux" => %w"x86_64-linux", "arm-linux" => %w"armv6-linux armv6hf-linux", "x86-mingw32" => %w"x86-windows.dll", }
Class Method Summary collapse
-
.binary_path ⇒ String
Full path to libspotify binary.
-
.release_name ⇒ String
Name of libspotify binary.
Class Method Details
.binary_path ⇒ String
Returns full path to libspotify binary.
16 17 18 |
# File 'lib/libspotify.rb', line 16 def binary_path File.("../bin/#{release_name}", File.dirname(__FILE__)) end |
.release_name ⇒ String
Returns name of libspotify binary.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/libspotify.rb', line 21 def release_name host_platform = Gem::Platform.new(host_string) _, binaries = PLATFORMS.find do |platform, _| Gem::Platform.new(platform) === host_platform end binaries ||= [] binary = if binaries.length == 1 binaries[0] elsif host_cpu =~ /armv(\d+)(hf)?/ host_version = $1.to_i host_hf = $2 matches = PLATFORMS["arm-linux"].select do |bin| version, hf = bin.match(/armv(\d+)(hf)?/)[1..2] hf == host_hf && version.to_i <= host_version end matches.max_by { |bin| bin[/armv(\d+)/, 1].to_i } else nil # no rules for matching binaries, what to do? end binary || host_string end |