sooner 0.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/Gemfile +5 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +39 -0
- data/app/controllers/sooner/subscribers_controller.rb +34 -0
- data/app/models/sooner/subscriber.rb +42 -0
- data/app/views/sooner/subscribers/edit.html.erb +25 -0
- data/app/views/sooner/subscribers/index.html.erb +1 -0
- data/app/views/sooner/subscribers/new.html.erb +9 -0
- data/config/locales/en.yml +11 -0
- data/lib/generators/sooner/sooner_generator.rb +31 -0
- data/lib/generators/sooner/templates/migration.rb +18 -0
- data/lib/generators/sooner_install/sooner_install_generator.rb +27 -0
- data/lib/generators/sooner_install/templates/README +25 -0
- data/lib/generators/sooner_install/templates/sooner.rb +135 -0
- data/lib/generators/sooner_views/sooner_views_generator.rb +61 -0
- data/lib/sooner/rails.rb +33 -0
- data/lib/sooner/version.rb +3 -0
- data/lib/sooner.rb +30 -0
- metadata +82 -0
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2010 Sooner
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
|
8
|
+
Rake::TestTask.new(:test) do |t|
|
9
|
+
t.libs << 'lib'
|
10
|
+
t.libs << 'test'
|
11
|
+
t.pattern = 'test/**/*_test.rb'
|
12
|
+
t.verbose = false
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :test
|
16
|
+
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'Sooner'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README.rdoc')
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
+
end
|
24
|
+
|
25
|
+
spec = Gem::Specification.new do |s|
|
26
|
+
s.name = "sooner"
|
27
|
+
s.summary = "Insert Sooner summary."
|
28
|
+
s.description = "Insert Sooner description."
|
29
|
+
s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
|
30
|
+
s.version = "0.0.1"
|
31
|
+
end
|
32
|
+
|
33
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Install the gem #{spec.name}-#{spec.version}.gem"
|
37
|
+
task :install do
|
38
|
+
system("gem install pkg/#{spec.name}-#{spec.version}.gem --no-ri --no-rdoc")
|
39
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Sooner
|
2
|
+
class SubscribersController < ApplicationController
|
3
|
+
|
4
|
+
def index
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
def new
|
9
|
+
@subscriber = Subscriber.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
@subscriber = Subscriber.new(params[:subscriber])
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
if @subscriber.save
|
17
|
+
format.html { render :nothing => true }
|
18
|
+
format.js do
|
19
|
+
render :update do |page|
|
20
|
+
page.replace_html "message", "Successfully Inserted"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
else
|
24
|
+
format.html { render :nothing => true }
|
25
|
+
format.js do
|
26
|
+
render :update do |page|
|
27
|
+
page.replace_html "message", "UnSuccessfully Inserted"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Sooner
|
2
|
+
class Subscriber < ActiveRecord::Base
|
3
|
+
|
4
|
+
#validates :email, :presence => true#, :email_format => true
|
5
|
+
#validates :uniqueness => true #, :if => Sooner.db_store
|
6
|
+
|
7
|
+
#attr_accessor :request
|
8
|
+
#alias :original_save :save
|
9
|
+
|
10
|
+
# def save
|
11
|
+
# if Sooner.db_store
|
12
|
+
# db_store
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# if Sooner.csv_store
|
16
|
+
# csv_store
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# end
|
20
|
+
|
21
|
+
#------------------------ private ----------------------
|
22
|
+
#private
|
23
|
+
|
24
|
+
# writes email addresses to database
|
25
|
+
# def db_store
|
26
|
+
# self.original_save
|
27
|
+
# end
|
28
|
+
|
29
|
+
# writes email addresses to CSV file
|
30
|
+
# def csv_store
|
31
|
+
# require 'ftools'
|
32
|
+
# begin
|
33
|
+
# file = File.open("public/#{ Sooner.csv_file.nil? ? 'subscribers.csv' : Sooner.csv_file }", "a")
|
34
|
+
# file << "#{ email }\n"
|
35
|
+
# file.close
|
36
|
+
# rescue Exception => e
|
37
|
+
# self.errors.add_to_base(e.message + " (CSV)")
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
10
|
+
<%= f.password_field :password %></p>
|
11
|
+
|
12
|
+
<p><%= f.label :password_confirmation %><br />
|
13
|
+
<%= f.password_field :password_confirmation %></p>
|
14
|
+
|
15
|
+
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
16
|
+
<%= f.password_field :current_password %></p>
|
17
|
+
|
18
|
+
<p><%= f.submit "Update" %></p>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<h3>Cancel my account</h3>
|
22
|
+
|
23
|
+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
24
|
+
|
25
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Welcome To Sooner Launching
|
@@ -0,0 +1,11 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
not_found: "not found"
|
5
|
+
already_confirmed: "was already confirmed"
|
6
|
+
not_locked: "was not locked"
|
7
|
+
|
8
|
+
sooner:
|
9
|
+
failure:
|
10
|
+
succesfull: 'You need to sign in or sign up before continuing.'
|
11
|
+
unsuccessfull: 'You have to confirm your account before continuing.'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails/generators/migration'
|
2
|
+
|
3
|
+
class SoonerGenerator < Rails::Generators::NamedBase
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
desc "Generates a model with the given NAME (if one does not exist) with sooner " <<
|
7
|
+
"configuration plus a migration file and sooner routes."
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@_sooner_source_root ||= File.expand_path("../templates", __FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.orm_has_migration?
|
14
|
+
Rails::Generators.options[:rails][:orm] == :active_record
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.next_migration_number(dirname)
|
18
|
+
if ActiveRecord::Base.timestamped_migrations
|
19
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
20
|
+
else
|
21
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class_option :orm
|
26
|
+
class_option :migration, :type => :boolean, :default => orm_has_migration?
|
27
|
+
|
28
|
+
def create_migration_file
|
29
|
+
migration_template 'migration.rb', 'db/migrate/sooner_create_#{[name]}.rb'
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class SoonerCreate<%= table_name.camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= table_name %> do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email
|
6
|
+
#Any additional fields here
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :<%= table_name %>, :name, :unique => true
|
12
|
+
add_index :<%= table_name %>, :email, :unique => true
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :<%= table_name %>
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class SoonerInstallGenerator < Rails::Generators::Base
|
2
|
+
desc "Creates a Sooner initializer and copy locale files to your application."
|
3
|
+
|
4
|
+
class_option :orm
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
@_sooner_source_root ||= File.expand_path("../templates", __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
def copy_initializer
|
11
|
+
template "sooner.rb", "config/initializers/sooner.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_locale
|
15
|
+
copy_file "../../../../config/locales/en.yml", "config/locales/sooner.en.yml"
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_readme
|
19
|
+
readme "README"
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def readme(path)
|
25
|
+
say File.read(File.expand_path(path, self.class.source_root))
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Some setup you must do manually if you haven't yet:
|
5
|
+
|
6
|
+
1. Setup default url options for your specific environment. Here is an
|
7
|
+
example of development environment:
|
8
|
+
|
9
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
10
|
+
|
11
|
+
This is a required Rails configuration. In production it must be the
|
12
|
+
actual host of your application
|
13
|
+
|
14
|
+
2. Ensure you have defined root_url to *something* in your config/routes.rb.
|
15
|
+
For example:
|
16
|
+
|
17
|
+
root :to => "home#index"
|
18
|
+
|
19
|
+
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
|
20
|
+
For example:
|
21
|
+
|
22
|
+
<p class="notice"><%= notice %></p>
|
23
|
+
<p class="alert"><%= alert %></p>
|
24
|
+
|
25
|
+
===============================================================================
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# Use this hook to configure Sooner mailer, warden hooks and so forth. The first
|
2
|
+
# four configuration values can also be set straight in your models.
|
3
|
+
Sooner.setup do |config|
|
4
|
+
# Configure the e-mail address which will be shown in SoonerMailer.
|
5
|
+
config.mailer_sender = "please-change-me@config-initializers-Sooner.com"
|
6
|
+
|
7
|
+
# ==> ORM configuration
|
8
|
+
# Load and configure the ORM. Supports :active_record (default), :mongoid
|
9
|
+
# (bson_ext recommended) and :data_mapper (experimental).
|
10
|
+
# require 'sooner/orm/<%= options[:orm] %>'
|
11
|
+
|
12
|
+
config.db_store = true
|
13
|
+
config.csv_store = true
|
14
|
+
|
15
|
+
# ==> Configuration for any authentication mechanism
|
16
|
+
# Configure which keys are used when authenticating an user. By default is
|
17
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
18
|
+
# authenticating an user, both parameters are required. Remember that those
|
19
|
+
# parameters are used only when authenticating and not when retrieving from
|
20
|
+
# session. If you need permissions, you should implement that in a before filter.
|
21
|
+
config.csv_file = ""
|
22
|
+
|
23
|
+
# Tell if authentication through request.params is enabled. True by default.
|
24
|
+
# config.params_authenticatable = true
|
25
|
+
|
26
|
+
# Tell if authentication through HTTP Basic Auth is enabled. True by default.
|
27
|
+
# config.http_authenticatable = true
|
28
|
+
|
29
|
+
# The realm used in Http Basic Authentication
|
30
|
+
# config.http_authentication_realm = "Application"
|
31
|
+
|
32
|
+
# ==> Configuration for :database_authenticatable
|
33
|
+
# Invoke `rake secret` and use the printed value to setup a pepper to generate
|
34
|
+
# the encrypted password. By default no pepper is used.
|
35
|
+
# config.pepper = "rake secret output"
|
36
|
+
|
37
|
+
# Configure how many times you want the password re-encrypted. Default is 10.
|
38
|
+
# config.stretches = 10
|
39
|
+
|
40
|
+
# Define which will be the encryption algorithm. Supported algorithms are :sha1
|
41
|
+
# (default), :sha512 and :bcrypt. Sooner also supports encryptors from others
|
42
|
+
# authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set
|
43
|
+
# stretches above to 20 for default behavior) and :restful_authentication_sha1
|
44
|
+
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
|
45
|
+
# config.encryptor = :sha1
|
46
|
+
|
47
|
+
# ==> Configuration for :confirmable
|
48
|
+
# The time you want to give your user to confirm his account. During this time
|
49
|
+
# he will be able to access your application without confirming. Default is nil.
|
50
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
51
|
+
# You can use this to let your user access some features of your application
|
52
|
+
# without confirming the account, but blocking it after a certain period
|
53
|
+
# (ie 2 days).
|
54
|
+
# config.confirm_within = 2.days
|
55
|
+
|
56
|
+
# ==> Configuration for :rememberable
|
57
|
+
# The time the user will be remembered without asking for credentials again.
|
58
|
+
# config.remember_for = 2.weeks
|
59
|
+
|
60
|
+
# ==> Configuration for :validatable
|
61
|
+
# Range for password length
|
62
|
+
# config.password_length = 6..20
|
63
|
+
|
64
|
+
# Regex to use to validate the email address
|
65
|
+
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
66
|
+
|
67
|
+
# ==> Configuration for :timeoutable
|
68
|
+
# The time you want to timeout the user session without activity. After this
|
69
|
+
# time the user will be asked for credentials again.
|
70
|
+
# config.timeout_in = 10.minutes
|
71
|
+
|
72
|
+
# ==> Configuration for :lockable
|
73
|
+
# Defines which strategy will be used to lock an account.
|
74
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
75
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
76
|
+
# config.lock_strategy = :failed_attempts
|
77
|
+
|
78
|
+
# Defines which strategy will be used to unlock an account.
|
79
|
+
# :email = Sends an unlock link to the user email
|
80
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
81
|
+
# :both = Enables both strategies
|
82
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
83
|
+
# config.unlock_strategy = :both
|
84
|
+
|
85
|
+
# Number of authentication tries before locking an account if lock_strategy
|
86
|
+
# is failed attempts.
|
87
|
+
# config.maximum_attempts = 20
|
88
|
+
|
89
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
90
|
+
# config.unlock_in = 1.hour
|
91
|
+
|
92
|
+
# ==> Configuration for :token_authenticatable
|
93
|
+
# Defines name of the authentication token params key
|
94
|
+
# config.token_authentication_key = :auth_token
|
95
|
+
|
96
|
+
# ==> Scopes configuration
|
97
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
98
|
+
# "sessions/users/new". It's turned off by default because it's slower if you
|
99
|
+
# are using only default views.
|
100
|
+
# config.scoped_views = true
|
101
|
+
|
102
|
+
# By default, Sooner detects the role accessed based on the url. So whenever
|
103
|
+
# accessing "/users/sign_in", it knows you are accessing an User. This makes
|
104
|
+
# routes as "/sign_in" not possible, unless you tell Sooner to use the default
|
105
|
+
# scope, setting true below.
|
106
|
+
# Note that Sooner does not generate default routes. You also have to
|
107
|
+
# specify them in config/routes.rb
|
108
|
+
# config.use_default_scope = true
|
109
|
+
|
110
|
+
# Configure the default scope used by Sooner. By default it's the first Sooner
|
111
|
+
# role declared in your routes.
|
112
|
+
# config.default_scope = :user
|
113
|
+
|
114
|
+
# ==> Navigation configuration
|
115
|
+
# Lists the formats that should be treated as navigational. Formats like
|
116
|
+
# :html, should redirect to the sign in page when the user does not have
|
117
|
+
# access, but formats like :xml or :json, should return 401.
|
118
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
119
|
+
# should add them to the navigational formats lists. Default is [:html]
|
120
|
+
# config.navigational_formats = [:html, :iphone]
|
121
|
+
|
122
|
+
# ==> Warden configuration
|
123
|
+
# If you want to use other strategies, that are not (yet) supported by Sooner,
|
124
|
+
# you can configure them inside the config.warden block. The example below
|
125
|
+
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
126
|
+
#
|
127
|
+
# config.warden do |manager|
|
128
|
+
# manager.oauth(:twitter) do |twitter|
|
129
|
+
# twitter.consumer_secret = <YOUR CONSUMER SECRET>
|
130
|
+
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
131
|
+
# twitter.options :site => 'http://twitter.com'
|
132
|
+
# end
|
133
|
+
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
134
|
+
# end
|
135
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class SoonerViewsGenerator < Rails::Generators::Base
|
2
|
+
desc "Copies all Sooner views to your application."
|
3
|
+
|
4
|
+
argument :scope, :required => false, :default => nil, :desc => "The scope to copy views to"
|
5
|
+
|
6
|
+
class_option :template_engine, :type => :string, :aliases => "-t", :default => "erb",
|
7
|
+
:desc => "Template engine for the views. Available options are 'erb' and 'haml'."
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@_sooner_source_root ||= File.expand_path("../../../../app/views", __FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_views
|
14
|
+
case options[:template_engine]
|
15
|
+
when "haml"
|
16
|
+
verify_haml_existence
|
17
|
+
verify_haml_version
|
18
|
+
create_and_copy_haml_views
|
19
|
+
else
|
20
|
+
directory "sooner", "app/views/#{scope || 'sooner'}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def verify_haml_existence
|
27
|
+
begin
|
28
|
+
require 'haml'
|
29
|
+
rescue LoadError
|
30
|
+
say "HAML is not installed, or it is not specified in your Gemfile."
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def verify_haml_version
|
36
|
+
unless Haml.version[:major] == 2 and Haml.version[:minor] >= 3 or Haml.version[:major] >= 3
|
37
|
+
say "To generate HAML templates, you need to install HAML 2.3 or above."
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_and_copy_haml_views
|
43
|
+
require 'tmpdir'
|
44
|
+
html_root = "#{self.class.source_root}/sooner"
|
45
|
+
|
46
|
+
Dir.mktmpdir("sooner-haml.") do |haml_root|
|
47
|
+
Dir["#{html_root}/**/*"].each do |path|
|
48
|
+
relative_path = path.sub(html_root, "")
|
49
|
+
source_path = (haml_root + relative_path).sub(/erb$/, "haml")
|
50
|
+
|
51
|
+
if File.directory?(path)
|
52
|
+
FileUtils.mkdir_p(source_path)
|
53
|
+
else
|
54
|
+
`html2haml -r #{path} #{source_path}`
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
directory haml_root, "app/views/#{scope || 'sooner'}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/sooner/rails.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#require 'devise/rails/routes'
|
2
|
+
#require 'devise/rails/warden_compat'
|
3
|
+
|
4
|
+
# Include UrlHelpers in ActionController and ActionView as soon as they are loaded.
|
5
|
+
#ActiveSupport.on_load(:action_controller) { include Devise::Controllers::UrlHelpers }
|
6
|
+
#ActiveSupport.on_load(:action_view) { include Devise::Controllers::UrlHelpers }
|
7
|
+
|
8
|
+
module Sooner
|
9
|
+
class Engine < ::Rails::Engine
|
10
|
+
config.sooner = Sooner
|
11
|
+
|
12
|
+
config.after_initialize do
|
13
|
+
flash = [:successfull, :unsuccessful]
|
14
|
+
|
15
|
+
translations = begin
|
16
|
+
I18n.available_locales
|
17
|
+
I18n.backend.send(:translations)
|
18
|
+
rescue Exception => e # Do not care if something fails
|
19
|
+
{}
|
20
|
+
end
|
21
|
+
|
22
|
+
translations.each do |locale, translations|
|
23
|
+
keys = flash & (translations[:sooner][:sessions].keys) rescue []
|
24
|
+
|
25
|
+
if keys.any?
|
26
|
+
ActiveSupport::Deprecation.warn "The following I18n messages in 'devise.sessions' " <<
|
27
|
+
"for locale '#{locale}' are deprecated: #{keys.to_sentence}. Please move them to " <<
|
28
|
+
"'sooner.failure' instead."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/sooner.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Sooner
|
2
|
+
|
3
|
+
# True values used to check params
|
4
|
+
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
5
|
+
|
6
|
+
# Custom domain for cookies. Not set by default
|
7
|
+
mattr_accessor :db_store
|
8
|
+
@@db_store = true
|
9
|
+
|
10
|
+
# Used to encrypt password. Please generate one with rake secret.
|
11
|
+
mattr_accessor :csv_store
|
12
|
+
@@csv_store = true
|
13
|
+
|
14
|
+
# The number of times to encrypt password.
|
15
|
+
mattr_accessor :csv_file
|
16
|
+
@@csv_file = 'subscribers.csv'
|
17
|
+
|
18
|
+
# Address which sends Devise e-mails.
|
19
|
+
mattr_accessor :mailer_sender
|
20
|
+
@@mailer_sender = nil
|
21
|
+
|
22
|
+
# Default way to setup Sooner. Run rails generate sooner_install to create
|
23
|
+
# a fresh initializer with all configuration values.
|
24
|
+
def self.setup
|
25
|
+
yield self
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
#require 'sooner/rails'
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sooner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors: []
|
12
|
+
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-06 00:00:00 +03:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Insert Sooner description.
|
22
|
+
email:
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- README.rdoc
|
31
|
+
- Gemfile
|
32
|
+
- MIT-LICENSE
|
33
|
+
- Rakefile
|
34
|
+
- app/controllers/sooner/subscribers_controller.rb
|
35
|
+
- app/views/sooner/subscribers/edit.html.erb
|
36
|
+
- app/views/sooner/subscribers/index.html.erb
|
37
|
+
- app/views/sooner/subscribers/new.html.erb
|
38
|
+
- app/models/sooner/subscriber.rb
|
39
|
+
- config/locales/en.yml
|
40
|
+
- lib/generators/sooner/sooner_generator.rb
|
41
|
+
- lib/generators/sooner/templates/migration.rb
|
42
|
+
- lib/generators/sooner_install/templates/sooner.rb
|
43
|
+
- lib/generators/sooner_install/templates/README
|
44
|
+
- lib/generators/sooner_install/sooner_install_generator.rb
|
45
|
+
- lib/generators/sooner_views/sooner_views_generator.rb
|
46
|
+
- lib/sooner.rb
|
47
|
+
- lib/sooner/rails.rb
|
48
|
+
- lib/sooner/version.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage:
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.3.7
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Insert Sooner summary.
|
81
|
+
test_files: []
|
82
|
+
|