recognition 0.3.5 → 0.3.6
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.
@@ -0,0 +1,23 @@
|
|
1
|
+
module Recognition
|
2
|
+
module Generators
|
3
|
+
class VoucherGenerator < Rails::Generators::Base
|
4
|
+
def scaffold
|
5
|
+
generate 'scaffold voucher code amount:integer reusable:boolean expires_at:datetime'
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_defaults
|
9
|
+
line = "t.boolean :reusable"
|
10
|
+
gsub_file Dir.glob("db/migrate/*_create_vouchers.rb").first, /(#{Regexp.escape(line)})/mi do |match|
|
11
|
+
"#{match}, default: fals"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_stanza
|
16
|
+
line = "class Voucher < ActiveRecord::Base"
|
17
|
+
gsub_file 'app/models/voucher.rb', /(#{Regexp.escape(line)})/mi do |match|
|
18
|
+
"#{match}\n acts_as_voucher code_length: 20 \n"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/recognition/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recognition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/generators/recognition/install_generator.rb
|
150
150
|
- lib/generators/recognition/templates/recognition.rb
|
151
151
|
- lib/generators/recognition/templates/recognition.yml
|
152
|
+
- lib/generators/recognition/voucher_generator.rb
|
152
153
|
- lib/recognition/action_controller_extension.rb
|
153
154
|
- lib/recognition/active_record_extension.rb
|
154
155
|
- lib/recognition/activerecord/model.rb
|
@@ -180,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
181
|
version: '0'
|
181
182
|
segments:
|
182
183
|
- 0
|
183
|
-
hash:
|
184
|
+
hash: 3949866912608946474
|
184
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
186
|
none: false
|
186
187
|
requirements:
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
segments:
|
191
192
|
- 0
|
192
|
-
hash:
|
193
|
+
hash: 3949866912608946474
|
193
194
|
requirements: []
|
194
195
|
rubyforge_project:
|
195
196
|
rubygems_version: 1.8.23
|