honor 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/honor.gemspec +1 -1
- data/honor.sqlite3 +0 -0
- data/lib/generators/honor/install/install_generator.rb +25 -0
- data/lib/generators/{templates/active_record → honor/install/templates}/create_points.rb +0 -0
- data/lib/generators/{templates/active_record → honor/install/templates}/create_scorecards.rb +0 -0
- data/lib/honor/version.rb +1 -1
- data/spec/generators/install_generator_spec.rb +2 -2
- metadata +6 -6
- data/lib/generators/install_generator.rb +0 -40
data/CHANGELOG.md
CHANGED
data/honor.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = Honor::VERSION
|
9
9
|
gem.authors = ["Jeremy Ward"]
|
10
10
|
gem.email = ["jrmy.ward@gmail.com"]
|
11
|
-
gem.description = %q{Adds
|
11
|
+
gem.description = %q{Adds common gamification features such as points, leaderboards, and achievements to a Rails Application.}
|
12
12
|
gem.summary = %q{General gamification-centric reputation system for Rails Applications.}
|
13
13
|
gem.homepage = "https://github.com/jrmyward/honor"
|
14
14
|
|
data/honor.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails/generators/migration'
|
2
|
+
|
3
|
+
module Honor
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
desc "Generates migration for Points and Scorecard"
|
9
|
+
|
10
|
+
def self.next_migration_number(path)
|
11
|
+
unless @prev_migration_nr
|
12
|
+
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
13
|
+
else
|
14
|
+
@prev_migration_nr += 1
|
15
|
+
end
|
16
|
+
@prev_migration_nr.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def copy_migrations
|
20
|
+
migration_template 'create_points.rb', 'db/migrate/create_honor_points.rb'
|
21
|
+
migration_template 'create_scorecards.rb', 'db/migrate/create_honor_scorecards.rb'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
File without changes
|
data/lib/generators/{templates/active_record → honor/install/templates}/create_scorecards.rb
RENAMED
File without changes
|
data/lib/honor/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/install_generator'
|
4
|
+
require 'generators/honor/install/install_generator'
|
5
5
|
|
6
|
-
describe Honor::InstallGenerator do
|
6
|
+
describe Honor::Generators::InstallGenerator do
|
7
7
|
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
8
|
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -107,8 +107,8 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
-
description: Adds
|
111
|
-
|
110
|
+
description: Adds common gamification features such as points, leaderboards, and achievements
|
111
|
+
to a Rails Application.
|
112
112
|
email:
|
113
113
|
- jrmy.ward@gmail.com
|
114
114
|
executables: []
|
@@ -124,9 +124,9 @@ files:
|
|
124
124
|
- Rakefile
|
125
125
|
- honor.gemspec
|
126
126
|
- honor.sqlite3
|
127
|
-
- lib/generators/install_generator.rb
|
128
|
-
- lib/generators/templates/
|
129
|
-
- lib/generators/templates/
|
127
|
+
- lib/generators/honor/install/install_generator.rb
|
128
|
+
- lib/generators/honor/install/templates/create_points.rb
|
129
|
+
- lib/generators/honor/install/templates/create_scorecards.rb
|
130
130
|
- lib/honor.rb
|
131
131
|
- lib/honor/model_additions.rb
|
132
132
|
- lib/honor/point.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/active_record'
|
3
|
-
require 'rails/generators/migration'
|
4
|
-
|
5
|
-
module Honor
|
6
|
-
class InstallGenerator < Rails::Generators::Base
|
7
|
-
include Rails::Generators::Migration
|
8
|
-
|
9
|
-
desc "Generates migration for Points and Scorecard"
|
10
|
-
|
11
|
-
def self.orm
|
12
|
-
Rails::Generators.options[:rails][:orm]
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.source_root
|
16
|
-
File.join(File.dirname(__FILE__), 'templates', (orm.to_s unless orm.class.eql?(String)) )
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.orm_has_migration?
|
20
|
-
[:active_record].include? orm
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.next_migration_number(dirname)
|
24
|
-
if ActiveRecord::Base.timestamped_migrations
|
25
|
-
migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
26
|
-
migration_number += 1
|
27
|
-
migration_number.to_s
|
28
|
-
else
|
29
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_migration_file
|
34
|
-
if self.class.orm_has_migration?
|
35
|
-
migration_template 'create_points.rb', 'db/migrate/create_honor_points.rb'
|
36
|
-
migration_template 'create_scorecards.rb', 'db/migrate/create_honor_scorecards.rb'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|