alphabeta 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
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.
@@ -0,0 +1,52 @@
1
+ # Alphabeta
2
+
3
+ This gem adds a simple alpha/beta landing page and signup form to attract
4
+ potential users in the early phase of app development. Instead of
5
+ waiting until your bohemoth application is picture perfect, you can
6
+ start to accumulate interest and potential beta testers.
7
+
8
+ Seeing your baby deployed and online (even with *merely* a lowly landing page) is
9
+ a great motivator to continue developing -- especially if you're doing
10
+ so in your spare time.
11
+
12
+ # Installation
13
+
14
+ Install the gem in a rails application with
15
+ ```ruby
16
+ gem install alphabeta
17
+ ```
18
+ Afterwards, mount the engine at the top of the routes.rb file:
19
+ ```ruby
20
+ mount Alphabeta::Engine => "/"
21
+ ```
22
+ This includes the engine's routes before all others, ensuring your
23
+ application will respond to the Alphabeta::Signup controller's defined actions (show/create)
24
+
25
+ Finally, copy over the migration(s) and migrate the db.
26
+ ```ruby
27
+ rake alphabeta:install:migrations
28
+ rake db:migrate
29
+ ```
30
+ Everything should now be working. You can check by starting your server with
31
+ ```ruby
32
+ rails s
33
+ ```
34
+ and navigating to `localhost:3000/`. You should see a plain signup form
35
+ with a generic welcome message and signup form.
36
+
37
+ If not, feel free to open an issue on Github.
38
+
39
+ # I18n
40
+ The gem supports internationalization by default. To change the text, be sure to edit the delivered .yml file.
41
+ These will be copied over when the install generator is called. Additional language strings can be added through the proper .yml file.
42
+
43
+ # TODO
44
+
45
+ 1. Add generator to copy over view(s) for modification in
46
+ application.
47
+ 2. Allow for configuration of template engine and provide basic templates for each (erb, haml, slim)
48
+
49
+ # License
50
+ This project rocks and is licensed under the terms and conditions of the MIT-LICENSE.
51
+
52
+
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Alphabeta'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ module Alphabeta
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,23 @@
1
+ require_dependency "alphabeta/application_controller"
2
+
3
+ module Alphabeta
4
+ class SignupController < ApplicationController
5
+
6
+ layout 'application'
7
+
8
+ def new
9
+ @signup = Alphabeta::Signup.new
10
+ end
11
+
12
+ def create
13
+ @signup = Alphabeta::Signup.new(params[:signup])
14
+ if @signup.save
15
+ SignupMailer.intro_mail(@signup.email).deliver
16
+ flash[:notice] = I18n.t('signup_successful')
17
+ redirect_to root_path
18
+ else
19
+ render action: 'new'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ module Alphabeta
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Alphabeta
2
+ module SignupHelper
3
+ end
4
+ end
@@ -0,0 +1,13 @@
1
+ module Alphabeta
2
+ class SignupMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+
5
+ def intro_mail(email)
6
+ @header = I18n.t('intro_mail.header')
7
+ @content = I18n.t('intro_mail.content')
8
+ @salutation = I18n.t('intro_mail.salutation')
9
+ @from = I18n.t('intro_mail.from')
10
+ mail(to: email, subject: I18n.t('intro_mail.subject'))
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module Alphabeta
2
+ class Signup < ActiveRecord::Base
3
+ attr_accessible :email
4
+ validates :email, presence: true, uniqueness: true
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ <h1>Alphabeta Landing</h1>
2
+
3
+ <% @signup.errors.full_messages.each do |err| %>
4
+ <%= err %>
5
+ <% end %>
6
+
7
+ <%= form_for @signup do |f| %>
8
+ <%= f.email_field :email %>
9
+ <%= f.submit I18n.t('submit') %>
10
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1><%= @header %></h1>
8
+ <p><%= @content %></p>
9
+ <p><%= @salutation %>,</p>
10
+ <p><%= @from %></p>
11
+ </body>
12
+ </html>
@@ -0,0 +1,6 @@
1
+ <%= @header %>
2
+
3
+ <%= @content %>
4
+
5
+ <%= @salutation %>,
6
+ <%= @from %>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Alphabeta</title>
5
+ <%= stylesheet_link_tag "alphabeta/application", :media => "all" %>
6
+ <%= javascript_include_tag "alphabeta/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <% if flash[:notice] %>
11
+ <p class="notice"><%= flash[:notice] %></p>
12
+ <% end %>
13
+
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -0,0 +1,9 @@
1
+ en:
2
+ signup_successful: "Thanks for signing up! We've sent an email to confirm your address, and we'll be in touch when it gets closer to launch."
3
+ submit: "Sign up"
4
+ intro_mail:
5
+ subject: "Thanks for stopping by!"
6
+ header: "It's always great to meet new people"
7
+ content: "Which is why we're so happy to have had you stop by. We have lots of exciting features and announcements coming up, which we'll share once the time is right."
8
+ salutation: "Have a great day"
9
+ from: "The developer(s) at Alphabeta"
@@ -0,0 +1,4 @@
1
+ Alphabeta::Engine.routes.draw do
2
+ root to: "signup#new"
3
+ post '/signups' => 'signup#create'
4
+ end
@@ -0,0 +1,9 @@
1
+ class CreateAlphabetaSignups < ActiveRecord::Migration
2
+ def change
3
+ create_table :alphabeta_signups do |t|
4
+ t.string :email
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ require "alphabeta/engine"
2
+
3
+ module Alphabeta
4
+ end
@@ -0,0 +1,9 @@
1
+ module Alphabeta
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Alphabeta
4
+ config.generators do |g|
5
+ g.test_framework :rspec, :view_specs => false, :helper_specs => false
6
+ g.integration_tool :rspec
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Alphabeta
2
+ VERSION = "0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :alphabeta do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,65 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
+
10
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
+
13
+ begin
14
+ require 'cucumber/rake/task'
15
+
16
+ namespace :cucumber do
17
+ Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
18
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
+ t.fork = true # You may get faster startup if you set this to false
20
+ t.profile = 'default'
21
+ end
22
+
23
+ Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
24
+ t.binary = vendored_cucumber_bin
25
+ t.fork = true # You may get faster startup if you set this to false
26
+ t.profile = 'wip'
27
+ end
28
+
29
+ Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
+ t.binary = vendored_cucumber_bin
31
+ t.fork = true # You may get faster startup if you set this to false
32
+ t.profile = 'rerun'
33
+ end
34
+
35
+ desc 'Run all features'
36
+ task :all => [:ok, :wip]
37
+
38
+ task :statsetup do
39
+ require 'rails/code_statistics'
40
+ ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
+ ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
+ end
43
+ end
44
+ desc 'Alias for cucumber:ok'
45
+ task :cucumber => 'cucumber:ok'
46
+
47
+ task :default => :cucumber
48
+
49
+ task :features => :cucumber do
50
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
51
+ end
52
+
53
+ # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
54
+ task 'test:prepare' do
55
+ end
56
+
57
+ task :stats => 'cucumber:statsetup'
58
+ rescue LoadError
59
+ desc 'cucumber rake task not available (cucumber not installed)'
60
+ task :cucumber do
61
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
62
+ end
63
+ end
64
+
65
+ end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alphabeta
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Curtis Ekstrom
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: cucumber-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: database_cleaner
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: email_spec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Rails engine to add landing page signup form to Rails app in early stages
111
+ of development.
112
+ email:
113
+ - ce@canvus.io
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - app/assets/javascripts/alphabeta/application.js
119
+ - app/assets/javascripts/alphabeta/signup.js
120
+ - app/assets/stylesheets/alphabeta/application.css
121
+ - app/assets/stylesheets/alphabeta/signup.css
122
+ - app/controllers/alphabeta/application_controller.rb
123
+ - app/controllers/alphabeta/signup_controller.rb
124
+ - app/helpers/alphabeta/application_helper.rb
125
+ - app/helpers/alphabeta/signup_helper.rb
126
+ - app/mailers/alphabeta/signup_mailer.rb
127
+ - app/models/alphabeta/signup.rb
128
+ - app/views/alphabeta/signup/new.html.erb
129
+ - app/views/alphabeta/signup_mailer/intro_mail.html.erb
130
+ - app/views/alphabeta/signup_mailer/intro_mail.text.erb
131
+ - app/views/layouts/alphabeta/application.html.erb
132
+ - config/cucumber.yml
133
+ - config/locales/en.yml
134
+ - config/routes.rb
135
+ - db/migrate/20130309200646_create_alphabeta_signups.rb
136
+ - lib/alphabeta/engine.rb
137
+ - lib/alphabeta/version.rb
138
+ - lib/alphabeta.rb
139
+ - lib/tasks/alphabeta_tasks.rake
140
+ - lib/tasks/cucumber.rake
141
+ - MIT-LICENSE
142
+ - Rakefile
143
+ - README.md
144
+ homepage: https://github.com/clekstro/alphabeta
145
+ licenses: []
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 1.8.25
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Add alpha/beta signup form to rails 3.2 application.
168
+ test_files: []