Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rails_apps_composer: add README files
- Loading branch information
1 parent
1a4a22a
commit 1ded38d
Showing
13 changed files
with
239 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,63 @@ | ||
RECIPES | ||
["analytics", "core", "deployment", "devise", "email", "extras", "frontend", "gems", "git", "init", "learn_rails", "locale", "omniauth", "pages", "rails_bootstrap", "rails_devise", "rails_devise_pundit", "rails_devise_roles", "rails_foundation", "rails_mailinglist_activejob", "rails_omniauth", "rails_signup_download", "rails_stripe_checkout", "railsapps", "readme", "roles", "setup", "tests"] | ||
PREFERENCES | ||
{:git=>true, :apps4=>"rails-signup-download", :announcements=>"none", :authentication=>"devise", :authorization=>"roles", :better_errors=>true, :devise_modules=>false, :form_builder=>false, :local_env_file=>false, :pry=>false, :quiet_assets=>true, :secrets=>["mailchimp_list_id", "mailchimp_api_key"], :pages=>"users", :locale=>"none", :rubocop=>false, :dev_webserver=>"webrick", :prod_webserver=>"webrick", :database=>"sqlite", :templates=>"erb", :tests=>"rspec", :continuous_testing=>"none", :frontend=>"bootstrap3", :email=>"gmail", :dashboard=>"none"} | ||
Rails Stripe Coupons | ||
================ | ||
|
||
Rails Composer, open source, supported by subscribers. | ||
Please join RailsApps to support development of Rails Composer. | ||
Need help? Ask on Stack Overflow with the tag 'railsapps.' | ||
Problems? Submit an issue: https://github.com/RailsApps/rails_apps_composer/issues | ||
Your application contains diagnostics in this README file. | ||
Please provide a copy of this README file when reporting any issues. | ||
|
||
|
||
option Build a starter application? | ||
choose Enter your selection: [rails-signup-download] | ||
option Get on the mailing list for Rails Composer news? | ||
choose Enter your selection: [none] | ||
option Web server for development? | ||
choose Enter your selection: [webrick] | ||
option Web server for production? | ||
choose Enter your selection: [webrick] | ||
option Database used in development? | ||
choose Enter your selection: [sqlite] | ||
option Template engine? | ||
choose Enter your selection: [erb] | ||
option Test framework? | ||
choose Enter your selection: [rspec] | ||
option Continuous testing? | ||
choose Enter your selection: [none] | ||
option Front-end framework? | ||
choose Enter your selection: [bootstrap3] | ||
option Add support for sending email? | ||
choose Enter your selection: [gmail] | ||
option Authentication? | ||
choose Enter your selection: [devise] | ||
option Devise modules? | ||
choose Enter your selection: [false] | ||
option OmniAuth provider? | ||
choose Enter your selection: [] | ||
option Authorization? | ||
choose Enter your selection: [roles] | ||
option Use a form builder gem? | ||
choose Enter your selection: [false] | ||
option Add pages? | ||
choose Enter your selection: [users] | ||
option Set a locale? | ||
choose Enter your selection: [none] | ||
option Install page-view analytics? | ||
choose Enter your selection: [none] | ||
option Add a deployment mechanism? | ||
choose Enter your selection: [none] | ||
option Set a robots.txt file to ban spiders? | ||
choose Enter your selection: [] | ||
option Create a GitHub repository? (y/n) | ||
choose Enter your selection: [] | ||
option Add gem and file for environment variables? | ||
choose Enter your selection: [false] | ||
option Reduce assets logger noise during development? | ||
choose Enter your selection: [true] | ||
option Improve error reporting with 'better_errors' during development? | ||
choose Enter your selection: [true] | ||
option Use 'pry' as console replacement during development and test? | ||
choose Enter your selection: [false] | ||
option Use or create a project-specific rvm gemset? | ||
choose Enter your selection: [true] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Rails Stripe Coupons | ||
================ | ||
|
||
This application was generated with the [rails_apps_composer](https://github.com/RailsApps/rails_apps_composer) gem | ||
provided by the [RailsApps Project](http://railsapps.github.io/). | ||
|
||
Rails Composer is open source and supported by subscribers. Please join RailsApps to support development of Rails Composer. | ||
|
||
Problems? Issues? | ||
----------- | ||
|
||
Need help? Ask on Stack Overflow with the tag 'railsapps.' | ||
|
||
Your application contains diagnostics in the README file. Please provide a copy of the README file when reporting any issues. | ||
|
||
If the application doesn't work as expected, please [report an issue](https://github.com/RailsApps/rails_apps_composer/issues) | ||
and include the diagnostics. | ||
|
||
Ruby on Rails | ||
------------- | ||
|
||
This application requires: | ||
|
||
- Ruby 2.2.0 | ||
- Rails 4.2.0 | ||
|
||
Learn more about [Installing Rails](http://railsapps.github.io/installing-rails.html). | ||
|
||
Getting Started | ||
--------------- | ||
|
||
Documentation and Support | ||
------------------------- | ||
|
||
Issues | ||
------------- | ||
|
||
Similar Projects | ||
---------------- | ||
|
||
Contributing | ||
------------ | ||
|
||
Credits | ||
------- | ||
|
||
License | ||
------- |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class ProductsController < ApplicationController | ||
before_filter :authenticate_user! | ||
before_filter :identify_product | ||
|
||
def show | ||
send_file @path, :disposition => "attachment; filename=#{@file}" | ||
end | ||
|
||
private | ||
def identify_product | ||
valid_characters = "^[0-9a-zA-Z]*$".freeze | ||
unless params[:id].blank? | ||
@product_id = params[:id] | ||
@product_id = @product_id.tr("^#{valid_characters}", '') | ||
else | ||
raise "Filename missing" | ||
end | ||
unless params[:format].blank? | ||
@format = params[:format] | ||
@format = @format.tr("^#{valid_characters}", '') | ||
else | ||
raise "File extension missing" | ||
end | ||
@path = "app/views/products/#{@product_id}.#{@format}" | ||
@file = "#{@product_id}.#{@format}" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class MailingListSignupJob < ActiveJob::Base | ||
|
||
def perform(user) | ||
logger.info "signing up #{user.email}" | ||
user.subscribe | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
<h3>Welcome</h3> | ||
<p><%= link_to 'Users:', users_path %> <%= User.count %> registered</p> | ||
<% if user_signed_in? %> | ||
<% if current_user.admin? %> | ||
<h3>Admin</h3> | ||
<p><%= link_to 'User count:', users_path %> <%= User.count %></p> | ||
<% else %> | ||
<h3>You've signed up. Download a free book.</h3> | ||
<%= link_to 'Download PDF', products_path('product.pdf'), :class => 'btn btn-success btn-large' %> | ||
<% end %> | ||
<% else %> | ||
<h3>Sign up and download a free book.</h3> | ||
<%= link_to 'Sign up', new_user_registration_path, :class => 'btn btn-primary btn-large' %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# ActiveJob::Base.queue_adapter = :inline | ||
ActiveJob::Base.queue_adapter = :sucker_punch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,6 @@ | ||
Rails.application.routes.draw do | ||
root to: 'visitors#index' | ||
get 'products/:id', to: 'products#show', :as => :products | ||
devise_for :users | ||
resources :users | ||
# The priority is based upon order of creation: first created -> highest priority. | ||
# See how all your routes lay out with "rake routes". | ||
|
||
# You can have the root of your site routed with "root" | ||
# root 'welcome#index' | ||
|
||
# Example of regular route: | ||
# get 'products/:id' => 'catalog#view' | ||
|
||
# Example of named route that can be invoked with purchase_url(id: product.id) | ||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase | ||
|
||
# Example resource route (maps HTTP verbs to controller actions automatically): | ||
# resources :products | ||
|
||
# Example resource route with options: | ||
# resources :products do | ||
# member do | ||
# get 'short' | ||
# post 'toggle' | ||
# end | ||
# | ||
# collection do | ||
# get 'sold' | ||
# end | ||
# end | ||
|
||
# Example resource route with sub-resources: | ||
# resources :products do | ||
# resources :comments, :sales | ||
# resource :seller | ||
# end | ||
|
||
# Example resource route with more complex sub-resources: | ||
# resources :products do | ||
# resources :comments | ||
# resources :sales do | ||
# get 'recent', on: :collection | ||
# end | ||
# end | ||
|
||
# Example resource route with concerns: | ||
# concern :toggleable do | ||
# post 'toggle' | ||
# end | ||
# resources :posts, concerns: :toggleable | ||
# resources :photos, concerns: :toggleable | ||
|
||
# Example resource route within a namespace: | ||
# namespace :admin do | ||
# # Directs /admin/products/* to Admin::ProductsController | ||
# # (app/controllers/admin/products_controller.rb) | ||
# resources :products | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* the humans responsible & colophon */ | ||
/* humanstxt.org */ | ||
|
||
|
||
/* TEAM */ | ||
<your title>: <your name> | ||
Site: | ||
Twitter: | ||
Location: | ||
|
||
/* THANKS */ | ||
Daniel Kehoe (@rails_apps) for the RailsApps project | ||
|
||
/* SITE */ | ||
Standards: HTML5, CSS3 | ||
Components: jQuery | ||
Software: Ruby on Rails | ||
|
||
/* GENERATED BY */ | ||
Rails Composer: http://railscomposer.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
describe ProductsController do | ||
|
||
describe 'GET #show' do | ||
|
||
it "returns a PDF file" do | ||
get :show, id: 'product', format: 'pdf' | ||
expect(response.headers['Content-Type']).to have_content 'application/pdf' | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
include Warden::Test::Helpers | ||
Warden.test_mode! | ||
|
||
# Feature: Product acquisition | ||
# As a user | ||
# I want to download the product | ||
# So I can complete my acquisition | ||
feature 'Product acquisition' do | ||
|
||
after(:each) do | ||
Warden.test_reset! | ||
end | ||
|
||
# Scenario: Download the product | ||
# Given I am a user | ||
# When I click the 'Download' button | ||
# Then I should receive a PDF file | ||
scenario 'Download the product' do | ||
user = FactoryGirl.create(:user) | ||
login_as(user, scope: :user) | ||
visit root_path | ||
expect(page).to have_content 'Download a free book' | ||
click_link_or_button 'Download PDF' | ||
expect(page.response_headers['Content-Type']).to have_content 'application/pdf' | ||
end | ||
|
||
end |