raffle_v1 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/MIT-LICENSE +1 -1
- data/README.md +16 -3
- data/db/seeds.rb +81 -0
- data/lib/generators/raffle_v1/install/install_generator.rb +108 -0
- data/lib/raffle_v1/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGNmZTAzNGRlMjY3MDJlN2E0MzUzOWZjMGZmMjQ1ZmU1ZDg5YTUxZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGM4Y2JmN2NkYjc4YjU2YjgwOGE0MGZmMGJlMDhmMjc2MmU2MTM1Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2M0ODY3ZjIxZjljODVmZWRkYzJhMDQwMTkzMGVjNzkxNzg5NmZiNjBiYzYw
|
10
|
+
MTIwNDU0MTU3Y2I2ZjZjYTc0OTk1NDhiNDQyNTI1MDZjZjhiYzk3MzMwNTdh
|
11
|
+
NTBmNzYyN2I2YWYzMmJmMDkxNGZjYTRmZWI0Y2FmNGYxYzQ5N2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2NmMTIxNDY2NjBiMjNmMjY0MGM4NjRkNmU0ODgxYTI3ZTVhYjE5MzlmNWNl
|
14
|
+
MGRjYjUzMzUyOThjNWQ4NzcwYWI5NzM0ZjBlZDk3YTFlMWM3ZTM5ZGU5YmM0
|
15
|
+
OGFjMmFiZWY5MTYwZDU2MzdmN2I0MTc5ODdkZjM2MDc3Nzk3OGM=
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
Raffle V1 Game **Work In Progress.
|
2
|
-
|
2
|
+
-----------------------------------
|
3
|
+
|
4
|
+
[![Code Climate](https://codeclimate.com/github/keeperofthenecklace/rafflev1.png)](https://codeclimate.com/github/keeperofthenecklace/rafflev1)
|
3
5
|
|
4
6
|
In this application the admin sets up the raffle entry
|
5
7
|
requirements. Users must meet the raffle validation requirements setup by
|
@@ -19,13 +21,24 @@ the action of randommly selecting the winners are performed.
|
|
19
21
|
|
20
22
|
A notification email is sent to all winners to inform them of their winnings.
|
21
23
|
|
22
|
-
Setting Up The Application
|
24
|
+
Setting Up The Application.
|
25
|
+
|
26
|
+
Manually add Raffle_v1 to your Rails 3.2.x application. Add Raffle_v1 to your Gemfile.
|
23
27
|
|
24
28
|
```shell
|
25
29
|
$ gem 'raffle_v1', :git => 'git://github.com/keeperofthenecklace/rafflev1.git'
|
26
30
|
```
|
27
31
|
|
28
|
-
|
32
|
+
Update your bundle
|
33
|
+
|
34
|
+
```shell
|
35
|
+
$ bundle install
|
36
|
+
```
|
37
|
+
|
38
|
+
Use the generator to copy migrations or generating seed
|
29
39
|
|
40
|
+
```shell
|
41
|
+
$ rails g raffle:install
|
42
|
+
```
|
30
43
|
|
31
44
|
If you have any question please send me an email: kotn_ep1@hotmail.com
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
8
|
+
|
9
|
+
# uncomment after Role migration has bee create
|
10
|
+
roles = Role.create([{name: "Admin User"}, {name: "Program User"}])
|
11
|
+
|
12
|
+
admin_user = Admin.new
|
13
|
+
admin_user.email = "admin@albertmckeever.com"
|
14
|
+
admin_user.password = "adminpwd$28"
|
15
|
+
admin_user.admin_types = "admin"
|
16
|
+
admin_user.save
|
17
|
+
|
18
|
+
#create first admin
|
19
|
+
Admin.create(email: 'akmckeev@albertmckeever.com', password: "Testing123", admin_types: "admin" )
|
20
|
+
|
21
|
+
Locale.create(name: 'English', short_name: 'en', description: 'American English') unless Locale.where("short_name = ?", "en").any?
|
22
|
+
Locale.create(name: 'Spanish', short_name: 'es', description: 'Espanol') unless Locale.where("short_name = ?", "es").any?
|
23
|
+
|
24
|
+
today_day = Date.today.day
|
25
|
+
today_month = Date.today.month
|
26
|
+
|
27
|
+
seed_program = Program.new
|
28
|
+
seed_program.name = "Albert McKeever Program #{today_month}-#{today_day}"
|
29
|
+
seed_program.locale = "en"
|
30
|
+
Locale.all.each do |l|
|
31
|
+
seed_program.locales << l
|
32
|
+
end
|
33
|
+
seed_program.sub_domain = "raffle" # "akm#{today_month}#{today_day}"
|
34
|
+
seed_program.vanity_domain = "raffle.#{Phoenixv2::Application.config.app_domain}" #"akm#{today_month}#{today_day}.#{Phoenixv2::Application.config.app_domain}"
|
35
|
+
seed_program.user_timeout = 20
|
36
|
+
seed_program.use_user_timeout = true
|
37
|
+
seed_program.use_failed_login_attempts = true
|
38
|
+
seed_program.locked_time = 5
|
39
|
+
seed_program.password_expirable = true
|
40
|
+
seed_program.expiration_duration = 2
|
41
|
+
seed_program.enable_password_notifier = true
|
42
|
+
seed_program.password_notifier = 1
|
43
|
+
seed_program.password_strength = 'good'
|
44
|
+
seed_program.use_security_questions = true
|
45
|
+
seed_program.num_security_questions = 1
|
46
|
+
seed_program.use_password_reuse_rules = true
|
47
|
+
seed_program.password_reuse_rules = 1
|
48
|
+
seed_program.user_requirements = "---\n- work_state\n- date_of_birth\n"
|
49
|
+
seed_program.search_fields = "---\n- email\n"
|
50
|
+
if !(Program.find_by_sub_domain(seed_program.sub_domain).present?)
|
51
|
+
seed_program.save!# rescue nil
|
52
|
+
end
|
53
|
+
|
54
|
+
program = Program.find_by_sub_domain ("raffle") #("akm#{today_month}#{today_day}")
|
55
|
+
|
56
|
+
#::AppHelper.current_program = program
|
57
|
+
term = TermsAndCondition.new(
|
58
|
+
title: 'Albert McKeever T&Cs',
|
59
|
+
akm_content: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here\', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for \'lorem ipsum\' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC.',
|
60
|
+
content: 'Customer: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here\', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for \'lorem ipsum\' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC.',
|
61
|
+
accept_text: 'I do accept the T&Cs',
|
62
|
+
decline_text: 'I don\'t accept the T&Cs',
|
63
|
+
decline_message: 'If you change your mind then contact your Program Coordinator to allow you to try again!',
|
64
|
+
active: true,
|
65
|
+
force_accept: true,
|
66
|
+
program_id: program.id
|
67
|
+
)
|
68
|
+
|
69
|
+
#term.translations.build(
|
70
|
+
#locale: "albertmckeever_test_#{today_month}-#{today_day}_en",
|
71
|
+
#title: 'Alber McKeever T&Cs',
|
72
|
+
#akm_content: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here\', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for \'lorem ipsum\' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC.',
|
73
|
+
#content: 'Customer: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here\', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for \'lorem ipsum\' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC.',
|
74
|
+
#accept_text: 'I do accept the T&Cs',
|
75
|
+
#decline_text: 'I don\'t accept the T&Cs',
|
76
|
+
#decline_message: 'If you change your mind then contact your Program Coordinator to allow you to try again!'
|
77
|
+
#)
|
78
|
+
|
79
|
+
term.save!
|
80
|
+
|
81
|
+
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'highline/import'
|
3
|
+
require 'bundler'
|
4
|
+
require 'bundler/cli'
|
5
|
+
|
6
|
+
module RaffleV1
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
class_option :migrate, :type => :boolean, :default => true, :banner => 'Run Raffle migrations'
|
9
|
+
class_option :seed, :type => :boolean, :default => true, :banner => 'load seed data (migrations must be run)'
|
10
|
+
|
11
|
+
def self.source_paths
|
12
|
+
paths = self.superclass.source_paths
|
13
|
+
paths << File.expand_path('../templates', "../../#{__FILE__}")
|
14
|
+
paths << File.expand_path('../templates', "../#{__FILE__}")
|
15
|
+
paths << File.expand_path('../templates', __FILE__)
|
16
|
+
paths.flatten
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare_options
|
20
|
+
@run_migrations = options[:migrate]
|
21
|
+
@load_seed_data = options[:seed]
|
22
|
+
|
23
|
+
unless @run_migrations
|
24
|
+
@load_seed_data = false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_files
|
29
|
+
template 'config/initializers/RaffleV1.rb', 'config/initializers/RaffleV1.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def config_raffleV1_yml
|
33
|
+
create_file "config/raffleV1.yml" do
|
34
|
+
settings = { 'version' => RaffleV1.version }
|
35
|
+
|
36
|
+
settings.to_yaml
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_unneeded_files
|
41
|
+
remove_file "public/index.html"
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_overrides_directory
|
45
|
+
empty_directory "app/overrides"
|
46
|
+
end
|
47
|
+
|
48
|
+
def install_migrations
|
49
|
+
say_status :copying, "migrations"
|
50
|
+
silence_stream(STDOUT) do
|
51
|
+
silence_warnings { rake 'railties:install:migrations' }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_database
|
56
|
+
say_status :creating, "database"
|
57
|
+
silence_stream(STDOUT) do
|
58
|
+
silence_stream(STDERR) do
|
59
|
+
silence_warnings { rake 'db:create' }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def run_migrations
|
65
|
+
if @run_migrations
|
66
|
+
say_status :running, "migrations"
|
67
|
+
quietly { rake 'db:migrate' }
|
68
|
+
else
|
69
|
+
say_status :skipping, "migrations (remember to run rake db:migrate)"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def populate_seed_data
|
74
|
+
if @load_seed_data
|
75
|
+
say_status :loading, "seed data"
|
76
|
+
quietly { rake 'db:seed' }
|
77
|
+
else
|
78
|
+
say_status :skipping, "seed data (you can always run rake db:seed)"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def notify_about_routes
|
83
|
+
insert_into_file File.join('config', 'routes.rb'), :after => "Application.routes.draw do\n" do
|
84
|
+
%Q{
|
85
|
+
mount RaffleV1::Engine, :at => '/'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
unless options[:quiet]
|
90
|
+
puts "*" * 8
|
91
|
+
puts "We added the following line to your application's config/routes.rb file"
|
92
|
+
puts " "
|
93
|
+
puts " mount RaffleV1::Engine, :at => '/'"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def complete
|
99
|
+
unless options[:quiet]
|
100
|
+
puts "*" * 8
|
101
|
+
puts "RaffleV1 has been installed successfull!"
|
102
|
+
puts " "
|
103
|
+
puts "Enjoy Our Raffle Game!"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
data/lib/raffle_v1/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raffle_v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert McKeever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -100,6 +100,8 @@ files:
|
|
100
100
|
- config/routes.rb
|
101
101
|
- db/migrate/20130326135125_create_raffle_v1_posts.rb
|
102
102
|
- db/migrate/20130326174121_create_raffle_v1_comments.rb
|
103
|
+
- db/seeds.rb
|
104
|
+
- lib/generators/raffle_v1/install/install_generator.rb
|
103
105
|
- lib/raffle_v1/engine.rb
|
104
106
|
- lib/raffle_v1/version.rb
|
105
107
|
- lib/raffle_v1.rb
|