gmusic 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,16 @@
1
+ === 0.2.1 / 2011-07-23
2
+
3
+ * song_list return by google has a tbody now
4
+
5
+ === 0.2.0 / 2011-07-23
6
+
7
+ * use bundler to manage gems
8
+ * update to rspec 2
9
+
10
+ === 0.1.0 / 2010-02-22
11
+
12
+ * Feature #56: parse the downloading related information of the song
13
+ * Feature #57: parse the lyrics of the song
14
+ * Feature #58: parse the search result
15
+ * Feature #59: provide a search API
16
+
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'jeweler'
4
+ gem 'rspec'
5
+
6
+ gem 'hpricot'
data/Gemfile.lock ADDED
@@ -0,0 +1,27 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ hpricot (0.8.4)
7
+ jeweler (1.6.4)
8
+ bundler (~> 1.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ rake (0.9.2)
12
+ rspec (2.6.0)
13
+ rspec-core (~> 2.6.0)
14
+ rspec-expectations (~> 2.6.0)
15
+ rspec-mocks (~> 2.6.0)
16
+ rspec-core (2.6.4)
17
+ rspec-expectations (2.6.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.6.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ hpricot
26
+ jeweler
27
+ rspec
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = GMusic
2
2
 
3
- GMusic provides APIs to search songs from http://music.g.cn. There are three query conditions supported by GMusic, which are title, artist and album of a song. GMusic delivers query requests to Google and collects the search result returned from Google.
3
+ GMusic provides a serias of APIs to search songs from http://music.g.cn. Title and aritist are supported now.
4
4
 
5
5
  == SYNOPSIS:
6
6
 
@@ -16,8 +16,8 @@ GMusic provides APIs to search songs from http://music.g.cn. There are three que
16
16
 
17
17
  == REQUIREMENTS:
18
18
 
19
- * jeweler (1.4.0) http://technicalpickles.github.com/jeweler
20
- * hpricot (0.8.2) http://github.com/whymirror/hpricot
19
+ * jeweler http://technicalpickles.github.com/jeweler
20
+ * hpricot http://github.com/whymirror/hpricot
21
21
 
22
22
  == INSTALL:
23
23
 
data/Rakefile CHANGED
@@ -20,20 +20,10 @@ rescue LoadError
20
20
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
21
  end
22
22
 
23
- require 'spec/rake/spectask'
24
- Spec::Rake::SpecTask.new(:spec) do |spec|
25
- spec.libs << 'lib' << 'spec'
26
- spec.spec_files = FileList['spec/**/*_spec.rb']
23
+ require 'rspec/core/rake_task'
24
+ RSpec::Core::RakeTask.new(:spec) do |spec|
27
25
  end
28
26
 
29
- Spec::Rake::SpecTask.new(:rcov) do |spec|
30
- spec.libs << 'lib' << 'spec'
31
- spec.pattern = 'spec/**/*_spec.rb'
32
- spec.rcov = true
33
- end
34
-
35
- task :spec => :check_dependencies
36
-
37
27
  task :default => :spec
38
28
 
39
29
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.1
data/lib/gmusic.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'rubygems'
2
+ require 'bundler/setup'
3
+
2
4
  require 'hpricot'
3
5
  require 'open-uri'
4
6
 
data/lib/gmusic/parser.rb CHANGED
@@ -4,7 +4,7 @@ module GMusic
4
4
  def parse url
5
5
  songs = []
6
6
  doc = Hpricot(open(url))
7
- (doc/'#song_list > tr').each do |tr|
7
+ (doc/'#song_list > tbody > tr').each do |tr|
8
8
  begin
9
9
  song = {}
10
10
  id = tr.attributes["id"].gsub(/row/, '')
data/spec/gmusic_spec.rb CHANGED
@@ -27,17 +27,17 @@ describe "Gmusic" do
27
27
  songs.size.should == 1
28
28
  end
29
29
 
30
- it "should return 5 full matched items" do
30
+ it "should return 6 full matched items" do
31
31
  parsed = GMusic::SongListParser.parse path_of('g-search-thankyou.html')
32
32
  dowload_info = GMusic::DownloadInfoParser.parse path_of('g-download.html')
33
33
  lyrics = GMusic::LyricsParser.parse path_of('g-lyrics.html')
34
34
 
35
35
  GMusic::SongListParser.should_receive(:parse).and_return(parsed)
36
- GMusic::DownloadInfoParser.should_receive(:parse).exactly(5).times.and_return(dowload_info)
37
- GMusic::LyricsParser.should_receive(:parse).exactly(5).times.and_return(lyrics)
36
+ GMusic::DownloadInfoParser.should_receive(:parse).exactly(6).times.and_return(dowload_info)
37
+ GMusic::LyricsParser.should_receive(:parse).exactly(6).times.and_return(lyrics)
38
38
 
39
39
  songs = GMusic.search(:title => 'thank you', :artist => 'dido')
40
40
 
41
- songs.size.should == 5
41
+ songs.size.should == 6
42
42
  end
43
43
  end
data/spec/parser_spec.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
3
 
3
4
  module GMusic
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'rspec'
3
5
  require 'gmusic'
4
- require 'spec'
5
- require 'spec/autorun'
6
6
 
7
- Spec::Runner.configure do |config|
8
-
7
+ RSpec.configure do |config|
8
+ config.mock_with :rspec
9
9
  end
10
10
 
11
11
  def path_of(file)
metadata CHANGED
@@ -1,60 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gmusic
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 0
9
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Tower He
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-02-22 00:00:00 +08:00
12
+ date: 2011-07-23 00:00:00.000000000 +08:00
18
13
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jeweler
17
+ requirement: &85340560 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *85340560
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: &85340250 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *85340250
37
+ - !ruby/object:Gem::Dependency
21
38
  name: hpricot
39
+ requirement: &85339950 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
22
46
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 8
30
- - 2
47
+ version_requirements: *85339950
48
+ - !ruby/object:Gem::Dependency
49
+ name: hpricot
50
+ requirement: &85339680 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
31
55
  version: 0.8.2
32
56
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
57
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 2
44
- - 9
58
+ version_requirements: *85339680
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: &85339410 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
45
66
  version: 1.2.9
46
67
  type: :development
47
- version_requirements: *id002
48
- description: "gmusic provides APIs to search songs from http://music.g.cn. There are three query conditions supported by gmusic, which are title, artist and album of a song. gmusic delivers query requests to Google and collects the search result returned from Google. "
68
+ prerelease: false
69
+ version_requirements: *85339410
70
+ description: ! 'gmusic provides APIs to search songs from http://music.g.cn. There
71
+ are three query conditions supported by gmusic, which are title, artist and album
72
+ of a song. gmusic delivers query requests to Google and collects the search result
73
+ returned from Google. '
49
74
  email: towerhe@gmail.com
50
75
  executables: []
51
-
52
76
  extensions: []
53
-
54
- extra_rdoc_files:
77
+ extra_rdoc_files:
55
78
  - LICENSE
56
79
  - README.rdoc
57
- files:
80
+ files:
81
+ - CHANGELOG
82
+ - Gemfile
83
+ - Gemfile.lock
58
84
  - LICENSE
59
85
  - README.rdoc
60
86
  - Rakefile
@@ -67,34 +93,26 @@ files:
67
93
  has_rdoc: true
68
94
  homepage: http://github.com/towerhe/gmusic
69
95
  licenses: []
70
-
71
96
  post_install_message:
72
- rdoc_options:
73
- - --charset=UTF-8
74
- require_paths:
97
+ rdoc_options: []
98
+ require_paths:
75
99
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
- version: "0"
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
90
112
  requirements: []
91
-
92
113
  rubyforge_project:
93
- rubygems_version: 1.3.6
114
+ rubygems_version: 1.3.9.2
94
115
  signing_key:
95
116
  specification_version: 3
96
117
  summary: Search songs from http://music.g.cn
97
- test_files:
98
- - spec/gmusic_spec.rb
99
- - spec/parser_spec.rb
100
- - spec/spec_helper.rb
118
+ test_files: []