sooner 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,8 +1,10 @@
1
1
  # encoding: UTF-8
2
+
2
3
  require 'rake'
3
4
  require 'rake/rdoctask'
4
5
  require 'rake/gempackagetask'
5
6
  require 'rake/testtask'
7
+ require File.join(File.dirname(__FILE__), 'lib', 'sooner', 'version')
6
8
 
7
9
  Rake::TestTask.new(:test) do |t|
8
10
  t.libs << 'lib'
@@ -26,7 +28,10 @@ spec = Gem::Specification.new do |s|
26
28
  s.summary = "PreLaunching Application for ComingSoon Pages"
27
29
  s.description = "Sooner Comingsoon Application"
28
30
  s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
29
- s.version = "0.0.3"
31
+ s.version = Sooner::VERSION.dup
32
+ s.email = "sbertel@mobithought.com"
33
+ s.homepage = "http://github.com/shenoudab/sooner"
34
+ s.author = 'Shenouda Bertel'
30
35
  end
31
36
 
32
37
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -35,4 +40,4 @@ end
35
40
  desc "Install the gem #{spec.name}-#{spec.version}.gem"
36
41
  task :install do
37
42
  system("gem install pkg/#{spec.name}-#{spec.version}.gem --no-ri --no-rdoc")
38
- end
43
+ end
@@ -11,10 +11,16 @@ module Sooner
11
11
  @subscriber = Subscriber.new(params[:sooner_subscriber])
12
12
 
13
13
  respond_to do |format|
14
- if @subscriber.save
14
+ if Sooner.csv_store
15
+ result = @subscriber.save_csv
16
+ end
17
+ if Sooner.db_store
18
+ result = @subscriber.save
19
+ end
20
+ if result
15
21
  format.html { render :partial => "subscribed" }
16
22
  else
17
- format.html { render :partial => "unsubscribed" }
23
+ format.html { render :partial => "already_subscribed" }
18
24
  end
19
25
  end
20
26
  end
@@ -5,11 +5,12 @@ module Sooner
5
5
  validates :name, :presence => true, :uniqueness => true
6
6
 
7
7
  # writes email addresses to CSV file
8
- def csv_store
8
+ def save_csv
9
9
  begin
10
10
  file = File.open("public/#{ Sooner.csv_file.nil? ? 'subscribers.csv' : Sooner.csv_file }", "a")
11
11
  file << "#{ email }\n"
12
12
  file.close
13
+ return true
13
14
  rescue Exception => e
14
15
  self.errors.add_to_base(e.message + " (CSV)")
15
16
  end
@@ -1 +1 @@
1
- <%= "UNSubscribed" %>
1
+ <%= "UnSubscribed" %>
@@ -1,18 +1,6 @@
1
1
  <h2>Add to subscriber List</h2>
2
2
 
3
3
  <%= form_for @subscriber, :url => subscribers_path do |f| %>
4
-
5
- <% if @subscriber.errors.any? %>
6
- <div id="errorExplanation">
7
- <h2><%= pluralize(@subscriber.errors.count, "error") %> prohibited this post from being saved:</h2>
8
- <ul>
9
- <% @subscriber.errors.full_messages.each do |msg| %>
10
- <li><%= msg %></li>
11
- <% end %>
12
- </ul>
13
- </div>
14
- <% end %>
15
-
16
4
  <%= f.label :name %>
17
5
  <%= f.text_field :name %>
18
6
  <br />
@@ -3,9 +3,6 @@ class SoonerInstallGenerator < Rails::Generators::Base
3
3
 
4
4
  desc "Creates a Sooner initializer and copy locale files to your application."
5
5
 
6
- class_option :orm
7
- class_option :migration, :type => :boolean, :default => orm_has_migration?
8
-
9
6
  def self.source_root
10
7
  @_sooner_source_root ||= File.expand_path("../templates", __FILE__)
11
8
  end
@@ -22,8 +19,11 @@ class SoonerInstallGenerator < Rails::Generators::Base
22
19
  end
23
20
  end
24
21
 
22
+ class_option :orm
23
+ class_option :migration, :type => :boolean, :default => orm_has_migration?
24
+
25
25
  def create_migration_file
26
- migration_template 'migration.rb', 'db/migrate/sooner_create_#{[name]}.rb'
26
+ migration_template 'migration.rb', 'db/migrate/sooner_create_subscribers.rb'
27
27
  end
28
28
 
29
29
  def copy_initializer
@@ -1,6 +1,6 @@
1
1
  class SoonerCreateSubscribers < ActiveRecord::Migration
2
2
  def self.up
3
- create_table :subscribers do |t|
3
+ create_table :subscribers, :id => false do |t|
4
4
  t.string :name
5
5
  t.string :email
6
6
  #Any additional fields here
@@ -1,135 +1,8 @@
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
1
  Sooner.setup do |config|
4
2
  # 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] %>'
3
+ config.mailer_sender = "info@sooner.com"
11
4
 
12
5
  config.db_store = true
13
6
  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
7
+ config.csv_file = "subscribers.csv"
135
8
  end
@@ -1,3 +1,3 @@
1
1
  module Sooner
2
- VERSION = "0.0.3".freeze
2
+ VERSION = "0.0.4".freeze
3
3
  end
metadata CHANGED
@@ -5,11 +5,11 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
- authors: []
12
-
11
+ authors:
12
+ - Shenouda Bertel
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
@@ -19,7 +19,7 @@ default_executable:
19
19
  dependencies: []
20
20
 
21
21
  description: Sooner Comingsoon Application
22
- email:
22
+ email: sbertel@mobithought.com
23
23
  executables: []
24
24
 
25
25
  extensions: []
@@ -49,7 +49,7 @@ files:
49
49
  - lib/sooner/email_format_validator.rb
50
50
  - lib/sooner/version.rb
51
51
  has_rdoc: true
52
- homepage:
52
+ homepage: http://github.com/shenoudab/sooner
53
53
  licenses: []
54
54
 
55
55
  post_install_message: