has_ratings 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/LICENSE +1 -1
- data/README.rdoc +12 -1
- data/Rakefile +19 -17
- data/generators/has_ratings/USAGE +5 -0
- data/generators/has_ratings/has_ratings_generator.rb +9 -0
- data/{db/migrate → generators/has_ratings/templates}/001_create_rating_values.rb +0 -0
- data/{db/migrate → generators/has_ratings/templates}/002_create_ratings.rb +0 -0
- data/test/app_root/db/migrate/003_migrate_has_ratings_to_version_2.rb +2 -2
- metadata +20 -28
data/CHANGELOG.rdoc
CHANGED
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -32,6 +32,17 @@ how they are persisted.
|
|
32
32
|
Note that this is a reference implementation and, most likely, should be
|
33
33
|
modified for your own usage.
|
34
34
|
|
35
|
+
=== Installation
|
36
|
+
|
37
|
+
+has_ratings+ requires additional database tables to work. You can generate
|
38
|
+
a migration for these tables like so:
|
39
|
+
|
40
|
+
script/generate has_ratings
|
41
|
+
|
42
|
+
Then simply migrate your database:
|
43
|
+
|
44
|
+
rake db:migrate
|
45
|
+
|
35
46
|
=== Example
|
36
47
|
|
37
48
|
user = User.find(1)
|
@@ -57,4 +68,4 @@ To run against a specific version of Rails:
|
|
57
68
|
== Dependencies
|
58
69
|
|
59
70
|
* Rails 2.3 or later
|
60
|
-
* enumerate_by[http://github.com/pluginaweek/enumerate_by]
|
71
|
+
* enumerate_by[http://github.com/pluginaweek/enumerate_by] 0.4.0 or later
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
1
3
|
require 'rake/testtask'
|
2
4
|
require 'rake/rdoctask'
|
3
5
|
require 'rake/gempackagetask'
|
4
|
-
require 'rake/contrib/sshpublisher'
|
5
6
|
|
6
7
|
spec = Gem::Specification.new do |s|
|
7
8
|
s.name = 'has_ratings'
|
8
|
-
s.version = '0.3.
|
9
|
+
s.version = '0.3.1'
|
9
10
|
s.platform = Gem::Platform::RUBY
|
10
|
-
s.summary = 'Demonstrates a reference implementation for handling ratings
|
11
|
+
s.summary = 'Demonstrates a reference implementation for handling ratings in ActiveRecord'
|
12
|
+
s.description = s.summary
|
11
13
|
|
12
|
-
s.files = FileList['{app,assets,
|
14
|
+
s.files = FileList['{app,assets,generators,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
|
13
15
|
s.require_path = 'lib'
|
14
16
|
s.has_rdoc = true
|
15
17
|
s.test_files = Dir['test/**/*_test.rb']
|
@@ -53,20 +55,27 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
53
55
|
rdoc.options << '--line-numbers' << '--inline-source'
|
54
56
|
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb', 'app/**/*.rb')
|
55
57
|
end
|
56
|
-
|
58
|
+
|
59
|
+
desc 'Generate a gemspec file.'
|
60
|
+
task :gemspec do
|
61
|
+
File.open("#{spec.name}.gemspec", 'w') do |f|
|
62
|
+
f.write spec.to_ruby
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
Rake::GemPackageTask.new(spec) do |p|
|
58
67
|
p.gem_spec = spec
|
59
|
-
p.need_tar = true
|
60
|
-
p.need_zip = true
|
61
68
|
end
|
62
69
|
|
63
70
|
desc 'Publish the beta gem.'
|
64
71
|
task :pgem => [:package] do
|
72
|
+
require 'rake/contrib/sshpublisher'
|
65
73
|
Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
|
66
74
|
end
|
67
75
|
|
68
76
|
desc 'Publish the API documentation.'
|
69
77
|
task :pdoc => [:rdoc] do
|
78
|
+
require 'rake/contrib/sshpublisher'
|
70
79
|
Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
|
71
80
|
end
|
72
81
|
|
@@ -75,15 +84,8 @@ task :publish => [:pgem, :pdoc, :release]
|
|
75
84
|
|
76
85
|
desc 'Publish the release files to RubyForge.'
|
77
86
|
task :release => [:gem, :package] do
|
78
|
-
require '
|
79
|
-
|
80
|
-
ruby_forge = RubyForge.new.configure
|
81
|
-
ruby_forge.login
|
87
|
+
require 'rake/gemcutter'
|
82
88
|
|
83
|
-
|
84
|
-
|
85
|
-
puts "Releasing #{File.basename(file)}..."
|
86
|
-
|
87
|
-
ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
|
88
|
-
end
|
89
|
+
Rake::Gemcutter::Tasks.new(spec)
|
90
|
+
Rake::Task['gem:push'].invoke
|
89
91
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class HasRatingsGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
m.migration_template '001_create_rating_values.rb', 'db/migrate', :migration_file_name => 'create_rating_values'
|
5
|
+
m.sleep 1
|
6
|
+
m.migration_template '002_create_ratings.rb', 'db/migrate', :migration_file_name => 'create_ratings'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
File without changes
|
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class MigrateHasRatingsToVersion2 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../
|
3
|
+
ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../generators/has_ratings/templates", 0).migrations.each do |migration|
|
4
4
|
migration.migrate(:up)
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.down
|
9
|
-
ActiveRecord::Migrator.new(:
|
9
|
+
ActiveRecord::Migrator.new(:down, "#{Rails.root}/../../generators/has_ratings/templates", 0).migrations.each do |migration|
|
10
10
|
migration.migrate(:down)
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_ratings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-03-07 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.4.0
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: Demonstrates a reference implementation for handling ratings in ActiveRecord
|
26
26
|
email: aaron@pluginaweek.org
|
27
27
|
executables: []
|
28
28
|
|
@@ -31,36 +31,26 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
|
33
33
|
files:
|
34
|
-
- app/models
|
35
34
|
- app/models/rating.rb
|
36
35
|
- app/models/rating_value.rb
|
37
|
-
- assets/images
|
38
36
|
- assets/images/star.gif
|
39
|
-
- assets/stylesheets
|
40
37
|
- assets/stylesheets/star.css
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
38
|
+
- generators/has_ratings/USAGE
|
39
|
+
- generators/has_ratings/has_ratings_generator.rb
|
40
|
+
- generators/has_ratings/templates/001_create_rating_values.rb
|
41
|
+
- generators/has_ratings/templates/002_create_ratings.rb
|
44
42
|
- lib/has_ratings.rb
|
45
|
-
- test/factory.rb
|
46
|
-
- test/test_helper.rb
|
47
|
-
- test/functional
|
48
|
-
- test/functional/has_ratings_test.rb
|
49
|
-
- test/unit
|
50
|
-
- test/unit/rating_value_test.rb
|
51
43
|
- test/unit/rating_test.rb
|
52
|
-
- test/
|
53
|
-
- test/app_root/db
|
54
|
-
- test/app_root/db/migrate
|
44
|
+
- test/unit/rating_value_test.rb
|
55
45
|
- test/app_root/db/migrate/003_migrate_has_ratings_to_version_2.rb
|
56
46
|
- test/app_root/db/migrate/002_create_videos.rb
|
57
47
|
- test/app_root/db/migrate/001_create_users.rb
|
58
|
-
- test/app_root/config
|
59
|
-
- test/app_root/config/environment.rb
|
60
|
-
- test/app_root/app
|
61
|
-
- test/app_root/app/models
|
62
|
-
- test/app_root/app/models/user.rb
|
63
48
|
- test/app_root/app/models/video.rb
|
49
|
+
- test/app_root/app/models/user.rb
|
50
|
+
- test/app_root/config/environment.rb
|
51
|
+
- test/test_helper.rb
|
52
|
+
- test/factory.rb
|
53
|
+
- test/functional/has_ratings_test.rb
|
64
54
|
- CHANGELOG.rdoc
|
65
55
|
- init.rb
|
66
56
|
- LICENSE
|
@@ -68,6 +58,8 @@ files:
|
|
68
58
|
- README.rdoc
|
69
59
|
has_rdoc: true
|
70
60
|
homepage: http://www.pluginaweek.org
|
61
|
+
licenses: []
|
62
|
+
|
71
63
|
post_install_message:
|
72
64
|
rdoc_options: []
|
73
65
|
|
@@ -88,11 +80,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
80
|
requirements: []
|
89
81
|
|
90
82
|
rubyforge_project: pluginaweek
|
91
|
-
rubygems_version: 1.3.
|
83
|
+
rubygems_version: 1.3.5
|
92
84
|
signing_key:
|
93
|
-
specification_version:
|
94
|
-
summary: Demonstrates a reference implementation for handling ratings
|
85
|
+
specification_version: 3
|
86
|
+
summary: Demonstrates a reference implementation for handling ratings in ActiveRecord
|
95
87
|
test_files:
|
96
|
-
- test/functional/has_ratings_test.rb
|
97
|
-
- test/unit/rating_value_test.rb
|
98
88
|
- test/unit/rating_test.rb
|
89
|
+
- test/unit/rating_value_test.rb
|
90
|
+
- test/functional/has_ratings_test.rb
|