hallon 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +0 -2
- data/CHANGELOG +14 -0
- data/Gemfile +3 -1
- data/Rakefile +3 -1
- data/hallon.gemspec +2 -3
- data/lib/hallon.rb +1 -0
- data/lib/hallon/error.rb +1 -1
- data/lib/hallon/ext/ffi.rb +1 -3
- data/lib/hallon/ext/object.rb +13 -0
- data/lib/hallon/link.rb +11 -1
- data/lib/hallon/version.rb +1 -1
- data/spec/hallon/ffi_spec.rb +1 -1
- data/spec/hallon/image_spec.rb +41 -23
- data/spec/hallon/observable_spec.rb +2 -4
- data/spec/spec_helper.rb +7 -0
- data/spec/support/cover_me.rb +6 -4
- metadata +21 -31
data/.rspec
CHANGED
data/CHANGELOG
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
Hallon’s Changelog
|
2
2
|
==================
|
3
3
|
|
4
|
+
v0.2.1
|
5
|
+
------------------
|
6
|
+
- Fix compatibility with v1.8
|
7
|
+
|
8
|
+
v0.2.0
|
9
|
+
------------------
|
10
|
+
- Alias Session#process_events_on to Session#wait_until
|
11
|
+
- Have Error.maybe_raise return error code
|
12
|
+
- Use mockspotify gem (https://rubygems.org/gems/mockspotify) for testing
|
13
|
+
|
14
|
+
v0.1.1
|
15
|
+
------------------
|
16
|
+
Don’t show the README in the gem description.
|
17
|
+
|
4
18
|
v0.1.0
|
5
19
|
------------------
|
6
20
|
Initial, first, release! This version is merely made to
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -8,7 +8,9 @@ require 'yard'
|
|
8
8
|
YARD::Rake::YardocTask.new
|
9
9
|
|
10
10
|
require 'rspec/core/rake_task'
|
11
|
-
RSpec::Core::RakeTask.new('spec')
|
11
|
+
RSpec::Core::RakeTask.new('spec') do |task|
|
12
|
+
task.ruby_opts = '-W2'
|
13
|
+
end
|
12
14
|
|
13
15
|
desc "Run the full test suite and generate a coverage report"
|
14
16
|
task 'spec:cov' => ['clean', 'spec:full'] do
|
data/hallon.gemspec
CHANGED
@@ -16,15 +16,14 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.version = Hallon::VERSION
|
18
18
|
gem.platform = Gem::Platform::RUBY
|
19
|
-
gem.required_ruby_version = '~> 1.
|
19
|
+
gem.required_ruby_version = '~> 1.8'
|
20
20
|
|
21
21
|
gem.add_dependency 'spotify', '~> 8.0.5'
|
22
|
-
gem.add_development_dependency 'mockspotify', '~> 0.1.
|
22
|
+
gem.add_development_dependency 'mockspotify', '~> 0.1.4'
|
23
23
|
gem.add_development_dependency 'rake', '~> 0.8'
|
24
24
|
gem.add_development_dependency 'rspec', '~> 2'
|
25
25
|
gem.add_development_dependency 'autotest-standalone'
|
26
26
|
gem.add_development_dependency 'autotest-growl'
|
27
|
-
gem.add_development_dependency 'cover_me'
|
28
27
|
gem.add_development_dependency 'yard'
|
29
28
|
gem.add_development_dependency 'rdiscount'
|
30
29
|
end
|
data/lib/hallon.rb
CHANGED
data/lib/hallon/error.rb
CHANGED
data/lib/hallon/ext/ffi.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
class Object
|
2
|
+
unless defined?(singleton_class)
|
3
|
+
def singleton_class
|
4
|
+
class << self; self; end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
unless method_defined?(:define_singleton_method)
|
9
|
+
def define_singleton_method(*args, &b)
|
10
|
+
singleton_class.send(:define_method, *args, &b)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/hallon/link.rb
CHANGED
@@ -76,7 +76,17 @@ module Hallon
|
|
76
76
|
# @param [#to_str] other
|
77
77
|
# @return [Integer]
|
78
78
|
def <=>(other)
|
79
|
-
|
79
|
+
if other.respond_to?(:to_str)
|
80
|
+
to_str <=> other.to_str
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# True if this link equals `other.to_str`
|
85
|
+
#
|
86
|
+
# @param [#to_str] other
|
87
|
+
# @return [Boolean]
|
88
|
+
def ==(other)
|
89
|
+
(self <=> other) == 0
|
80
90
|
end
|
81
91
|
|
82
92
|
# String representation of the given Link.
|
data/lib/hallon/version.rb
CHANGED
data/spec/hallon/ffi_spec.rb
CHANGED
data/spec/hallon/image_spec.rb
CHANGED
@@ -2,35 +2,53 @@
|
|
2
2
|
require 'ostruct'
|
3
3
|
|
4
4
|
describe Hallon::Image, :session => true do
|
5
|
-
let(:session) {
|
6
|
-
let(:image) do
|
7
|
-
Hallon::Session.should_receive(:instance).and_return double.stub(:pointer => nil)
|
8
|
-
|
9
|
-
image = Spotify.mock_image(
|
10
|
-
"3ad93423add99766e02d563605c6e76ed2b0e450".gsub(/../) { |x| x.to_i(16).chr },
|
11
|
-
:jpeg,
|
12
|
-
File.size(fixture_image_path),
|
13
|
-
File.read(fixture_image_path),
|
14
|
-
:ok
|
15
|
-
)
|
16
|
-
|
17
|
-
Hallon::Image.new(image)
|
18
|
-
end
|
5
|
+
let(:session) { OpenStruct.new(:pointer => nil) }
|
19
6
|
|
20
|
-
|
7
|
+
describe "an image instance" do
|
8
|
+
let(:image) do
|
9
|
+
Hallon::Session.should_receive(:instance).and_return session
|
21
10
|
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
image = Spotify.mock_image(
|
12
|
+
"3ad93423add99766e02d563605c6e76ed2b0e450".gsub(/../) { |x| x.to_i(16).chr },
|
13
|
+
:jpeg,
|
14
|
+
File.size(fixture_image_path),
|
15
|
+
File.read(fixture_image_path),
|
16
|
+
:ok
|
17
|
+
)
|
25
18
|
|
26
|
-
|
27
|
-
it "should correspond to the fixture image" do
|
28
|
-
image.data.should eq File.read(fixture_image_path, :encoding => 'binary')
|
19
|
+
Hallon::Image.new(image)
|
29
20
|
end
|
30
21
|
|
31
|
-
|
32
|
-
|
22
|
+
subject { image }
|
23
|
+
|
24
|
+
its(:status) { should be :ok }
|
25
|
+
its(:format) { should be :jpeg }
|
26
|
+
its(:id) { should eq "3ad93423add99766e02d563605c6e76ed2b0e450" }
|
27
|
+
|
28
|
+
describe "#data" do
|
29
|
+
subject { image.data }
|
30
|
+
|
31
|
+
it "should correspond to the fixture image" do
|
32
|
+
should eq File.open(fixture_image_path, 'r:binary', &:read)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a binary encoding" do
|
36
|
+
pending "ruby 1.8 does not support String#encoding" unless subject.respond_to?(:encoding)
|
37
|
+
subject.encoding.name.should eq 'ASCII-8BIT'
|
38
|
+
end
|
33
39
|
end
|
40
|
+
|
41
|
+
describe "#to_link" do
|
42
|
+
it "should retrieve the Spotify URI" do
|
43
|
+
image.to_link.should eq Hallon::Link.new("spotify:image:#{image.id}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "created from an uri" do
|
49
|
+
let(:image) { Hallon::Image.new("spotify:image:c78f091482e555bd2ffacfcd9cbdc0714b221663", session) }
|
50
|
+
subject { image }
|
51
|
+
its(:id) { should eq "c78f091482e555bd2ffacfcd9cbdc0714b221663" }
|
34
52
|
end
|
35
53
|
|
36
54
|
describe "callbacks" do
|
@@ -4,10 +4,8 @@ describe Hallon::Observable do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
describe "instance methods" do
|
7
|
-
|
8
|
-
|
9
|
-
it { should include :on }
|
10
|
-
it { should include :trigger }
|
7
|
+
it { should respond_to :on }
|
8
|
+
it { should respond_to :trigger }
|
11
9
|
end
|
12
10
|
|
13
11
|
describe "#on" do
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/cover_me.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
CoverMe
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
if defined?(CoverMe)
|
2
|
+
CoverMe.config do |c|
|
3
|
+
c.project.root = Dir.pwd
|
4
|
+
c.at_exit = proc {} # default hook opens coverage/ folder, ANNOYING!
|
5
|
+
c.file_pattern = [%r"#{c.project.root}/lib/.+\.rb"]
|
6
|
+
end
|
5
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-07-
|
12
|
+
date: 2011-07-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spotify
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157240440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: 8.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157240440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mockspotify
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157239880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.1.
|
32
|
+
version: 0.1.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157239880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &2157239180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.8'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2157239180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &2157232320 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2157232320
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: autotest-standalone
|
60
|
-
requirement: &
|
60
|
+
requirement: &2157231660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2157231660
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: autotest-growl
|
71
|
-
requirement: &
|
71
|
+
requirement: &2157230760 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,21 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: cover_me
|
82
|
-
requirement: &2153169940 !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- - ! '>='
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: *2153169940
|
79
|
+
version_requirements: *2157230760
|
91
80
|
- !ruby/object:Gem::Dependency
|
92
81
|
name: yard
|
93
|
-
requirement: &
|
82
|
+
requirement: &2157230240 !ruby/object:Gem::Requirement
|
94
83
|
none: false
|
95
84
|
requirements:
|
96
85
|
- - ! '>='
|
@@ -98,10 +87,10 @@ dependencies:
|
|
98
87
|
version: '0'
|
99
88
|
type: :development
|
100
89
|
prerelease: false
|
101
|
-
version_requirements: *
|
90
|
+
version_requirements: *2157230240
|
102
91
|
- !ruby/object:Gem::Dependency
|
103
92
|
name: rdiscount
|
104
|
-
requirement: &
|
93
|
+
requirement: &2157229660 !ruby/object:Gem::Requirement
|
105
94
|
none: false
|
106
95
|
requirements:
|
107
96
|
- - ! '>='
|
@@ -109,7 +98,7 @@ dependencies:
|
|
109
98
|
version: '0'
|
110
99
|
type: :development
|
111
100
|
prerelease: false
|
112
|
-
version_requirements: *
|
101
|
+
version_requirements: *2157229660
|
113
102
|
description:
|
114
103
|
email: kim@burgestrand.se
|
115
104
|
executables: []
|
@@ -134,6 +123,7 @@ files:
|
|
134
123
|
- lib/hallon.rb
|
135
124
|
- lib/hallon/error.rb
|
136
125
|
- lib/hallon/ext/ffi.rb
|
126
|
+
- lib/hallon/ext/object.rb
|
137
127
|
- lib/hallon/ext/spotify.rb
|
138
128
|
- lib/hallon/image.rb
|
139
129
|
- lib/hallon/link.rb
|
@@ -172,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
162
|
requirements:
|
173
163
|
- - ~>
|
174
164
|
- !ruby/object:Gem::Version
|
175
|
-
version: '1.
|
165
|
+
version: '1.8'
|
176
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
167
|
none: false
|
178
168
|
requirements:
|