fast_track 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fast_track.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Farley Knight
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # FastTrack
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fast_track'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fast_track
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/track ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'fast_track'
6
+
7
+ FileUtils.rm_rf("tmp")
8
+ FileUtils.mkdir("tmp")
9
+
10
+ Dir.chdir("tmp") do
11
+ FastTrack.new.start
12
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fast_track/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fast_track"
8
+ spec.version = FastTrack::VERSION
9
+ spec.authors = ["Farley Knight"]
10
+ spec.email = ["farleyknight@gmail.com"]
11
+ spec.summary = %q{Create Rails apps quickly.}
12
+ spec.description = %q{Leverage the Rails generator to architect new Rails apps with lots of default gems, templates, and other recipes, quickly.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1 @@
1
+ # ??
@@ -0,0 +1,22 @@
1
+ class FastTrack
2
+ class AwesomeDefaults < Track
3
+ gemfile do
4
+ gem_group :development do
5
+ gem 'better_errors'
6
+ gem 'binding_of_caller'
7
+ gem 'quiet_assets'
8
+ gem 'pry'
9
+ gem 'pry-rails'
10
+ end
11
+
12
+ gem_group :test do
13
+ gem 'rspec-rails'
14
+ gem 'factory_girl_rails'
15
+ gem 'database_cleaner'
16
+ gem 'email_spec'
17
+ gem 'pry'
18
+ gem 'pry-rails'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,41 @@
1
+ class FastTrack
2
+ class BackboneOnRails
3
+ rubygem "backbone-on-rails"
4
+ github_url "https://github.com/meleyal/backbone-on-rails"
5
+ github_description "
6
+ A simple gem for using Backbone.js with Rails (>= 3.1),
7
+ based on thoughtbot's 'Backbone.js on Rails'.
8
+
9
+ http://git.io/backbone-on-rails
10
+ "
11
+
12
+ gemfile do
13
+ gem 'backbone-on-rails'
14
+ end
15
+
16
+ def invoke
17
+ generate "backbone:install"
18
+ end
19
+ end
20
+
21
+ class BackboneRails
22
+ rubygem "backbone-rails"
23
+ github_url "https://github.com/aflatter/backbone-rails"
24
+
25
+ github_description "
26
+ Developing javascript applications on top of rails just got faster thanks to the Rails 3.1 asset pipeline. Like jquery-rails, this gem bundles some javascript files to make them available to your application:
27
+
28
+ * backbone
29
+ * underscore
30
+ * json2
31
+ "
32
+
33
+ gemfile do
34
+ gem "rails-backbone"
35
+ end
36
+
37
+ def invoke
38
+ generate "backbone:install"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,20 @@
1
+ class FastTrack
2
+ class BetterExceptions
3
+ author ""
4
+ description "Render your http errors in your layout reducing the need for static files."
5
+ github_url "https://github.com/eric1234/better_exception_app"
6
+ rubygem_url "https://rubygems.org/gems/better_exception_app"
7
+
8
+ gemfile do
9
+ gem_group :production do
10
+ gem 'better_exception_app'
11
+ end
12
+ end
13
+
14
+ def invoke
15
+ remove_file "public/404.html"
16
+ remove_file "public/422.html"
17
+ remove_file "public/500.html"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ class FastTrack
2
+ # https://github.com/EppO/rolify/wiki/Tutorial
3
+ class Cancan < Track
4
+ gemfile do
5
+ gem 'cancan'
6
+ end
7
+
8
+ before_migrate do
9
+ generate "cancan:ability"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,30 @@
1
+ class FastTrack
2
+ # TODO: This should take a YAML file and merge it with the defaults!
3
+ class Config < Hash
4
+ # TODO: This config file should have nested information for each
5
+ # class.. For example:
6
+ #
7
+ # >> config = {
8
+ # >> devise: {user_class: "User"}
9
+ # >> }
10
+ #
11
+ # Should probably map to
12
+ #
13
+ # >> config.devise.user_class?
14
+ #
15
+
16
+ # The user class for Devise.
17
+ # By default it's just "User"
18
+ def user_class
19
+ self[:user_class] || "user"
20
+ end
21
+
22
+ def profile_class
23
+ self[:profile_class] || "profile"
24
+ end
25
+
26
+ def skip_views
27
+ self[:skip_views] || false
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,94 @@
1
+ class FastTrack
2
+ # Vanilla Devise
3
+ class Devise < Track
4
+ gemfile do
5
+ gem 'devise'
6
+ end
7
+
8
+ before_migrate do
9
+ generate "devise:install"
10
+ generate "devise", config.user_class
11
+ end
12
+
13
+ def invoke
14
+ end
15
+ end
16
+
17
+ # Devise with views
18
+ class DeviseWithViews < Track
19
+ gemfile do
20
+ gem 'devise'
21
+ end
22
+
23
+ before_migrate do
24
+ generate "devise:install"
25
+ generate "devise", config.user_class
26
+ generate "devise:views"
27
+ end
28
+
29
+ def invoke
30
+ end
31
+ end
32
+
33
+ # Devise User with a Profile class, for storing personal information about the user.
34
+ class DeviseWithProfile < Track
35
+ gemfile do
36
+ gem 'devise'
37
+ end
38
+
39
+ before_migrate do
40
+ generate "devise:install"
41
+ generate "devise", config.user_class
42
+ generate "devise:views"
43
+ end
44
+
45
+ def invoke
46
+ model config.profile_class, {
47
+ "first_name" => "string",
48
+ "last_name" => "string",
49
+ "favorite_color" => "string",
50
+ "#{config.user_class}_id" => "integer"
51
+ }
52
+ end
53
+ end
54
+
55
+ # TODO
56
+ #
57
+ # A User object has_one of...
58
+ #
59
+ # * Member object
60
+ # * Admin object
61
+ class DevisePlusAdmin < Track
62
+ gemfile do
63
+ gem 'devise'
64
+ end
65
+
66
+ before_migrate do
67
+ generate "devise:install"
68
+ generate "devise", config.user_class
69
+ end
70
+
71
+ def invoke
72
+ end
73
+ end
74
+
75
+ # TODO
76
+ # A User object has_one of...
77
+ #
78
+ # * Member object
79
+ # * Moderator object
80
+ # * Admin object
81
+ class DeviseThreeTier < Track
82
+ gemfile do
83
+ gem 'devise'
84
+ end
85
+
86
+ before_migrate do
87
+ generate "devise:install"
88
+ generate "devise", config.user_class
89
+ end
90
+
91
+ def invoke
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,7 @@
1
+ class FastTrack
2
+
3
+ # TODO
4
+ # Deploy an Errbit instance to Heroku, for error tracking
5
+ class ErrbitHeroku
6
+ end
7
+ end
@@ -0,0 +1,47 @@
1
+ class FastTrack
2
+ class GemInstaller
3
+ def run(generator)
4
+ FastTrack.tracks.each do |klass|
5
+ unless klass.gemfile_block.blank?
6
+ generator.instance_eval(&klass.gemfile_block)
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ class BeforeMigrate
13
+ def run(generator)
14
+ FastTrack.tracks.each do |klass|
15
+ unless klass.before_migrate_block.blank?
16
+ generator.instance_eval(&klass.before_migrate_block)
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ class Runner
23
+ def run(generator)
24
+ FastTrack.tracks.each do |klass|
25
+ if klass.instance_methods.include? :invoke
26
+ klass.new(generator).invoke
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ class Generator < Rails::Generators::AppGenerator
33
+ include TrackMethods
34
+
35
+ source_root Rails::Generators::AppGenerator.source_root
36
+
37
+ def fasttrack
38
+ FastTrack::GemInstaller.new.run(self)
39
+ run("bundle install")
40
+
41
+ FastTrack::Runner.new.run(self)
42
+
43
+ FastTrack::BeforeMigrate.new.run(self)
44
+ rake("db:migrate")
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,24 @@
1
+ class FastTrack
2
+ class Guard < Track
3
+ end
4
+
5
+ class GuardAwesomeDefaults
6
+ gemfile do
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ gem 'guard-jasmine'
10
+ gem 'guard-livereload'
11
+ end
12
+
13
+ def template_directory
14
+ "guard_awesome_defaults"
15
+ end
16
+
17
+ def guard_file
18
+ read_file("Guardfile")
19
+ end
20
+
21
+ def invoke
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ class FastTrack
2
+ class Jquery < Track
3
+ rubygem "jquery-rails"
4
+ github_url "https://github.com/indirect/jquery-rails"
5
+
6
+ github_description "
7
+ This gem provides:
8
+
9
+ jQuery 1.7.2
10
+ jQuery UI 1.8.18 (javascript only)
11
+ the jQuery UJS adapter
12
+ assert_select_jquery to test jQuery responses in Ruby tests
13
+ "
14
+
15
+ gemfile do
16
+ gem 'jquery-rails'
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,76 @@
1
+ class FastTrack
2
+ # TODO
3
+ #
4
+ # Add Omniauth without adding any social networks
5
+ #
6
+ # Based on this gist: https://gist.github.com/schleg/993566
7
+ class Omniauth < Track
8
+ gemfile do
9
+ gem "omniauth"
10
+ end
11
+
12
+ def invoke
13
+ migration "add_name_to_users", {
14
+ "name" => "string"
15
+ }
16
+
17
+ model "Authorization", {
18
+ "provider" => "string",
19
+ "uid" => "string",
20
+ "user_id" => "integer",
21
+ "token" => "string",
22
+ "secret" => "string",
23
+ "name" => "string",
24
+ "link" => "string"
25
+ }
26
+ end
27
+ end
28
+
29
+ # TODO
30
+ # Devise + Facebook
31
+ #
32
+ class OmniauthFacebook < Track
33
+ def files
34
+ {
35
+ controller: "devise_facebook/omniauth_controller.rb",
36
+ initializer: "devise_facebook/initializer.rb",
37
+ config: "devise_facebook/facebook.yml",
38
+ user: "devise_facebook/user.rb"
39
+ }
40
+ end
41
+
42
+ gemfile do
43
+ gem "omniauth"
44
+ gem "omniauth-facebook"
45
+ end
46
+
47
+ def invoke
48
+
49
+ gsub_file "config/routes.rb", "devise_for :users", 'devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }'
50
+
51
+ migration "AddUidToUsers", {
52
+ "provider" => "string",
53
+ "uid" => "string",
54
+ "name" => "string"
55
+ }
56
+
57
+ file "app/controllers/users/omniauth_callbacks_controller.rb", open_file(:controller)
58
+ file "config/initializers/devise_facebook.rb", open_file(:initializer)
59
+ file "app/models/user.rb", open_file(:user), :force => true
60
+
61
+ # TODO: Check if facebook_config is available
62
+ # Otherwise, just give the vanilla version
63
+ # file "config/facebook.yml", replace(open_file(:config), facebook_config)
64
+ file "config/facebook.yml", open_file(:config)
65
+
66
+ rake "db:migrate"
67
+ end
68
+
69
+ def facebook_config
70
+ {
71
+ "[APP_ID]" => config[:app_id],
72
+ "[APP_SECRET]" => config[:app_secret]
73
+ }
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,12 @@
1
+ class FastTrack
2
+ # https://github.com/EppO/rolify/wiki/Tutorial
3
+ class Rolify < Track
4
+ gemfile do
5
+ gem 'rolify'
6
+ end
7
+
8
+ before_migrate do
9
+ generate "rolify:role"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,79 @@
1
+ class FastTrack
2
+ class Track
3
+ include TrackMethods
4
+
5
+ attr_accessor :generator
6
+
7
+ def initialize(generator)
8
+ @generator = generator
9
+ end
10
+
11
+ # Describe a Gemfile using `gem` and `gem_group`
12
+ def self.gemfile(&block)
13
+ @gemfile_block = block
14
+ end
15
+
16
+ def self.gemfile_block
17
+ @gemfile_block
18
+ end
19
+
20
+ # Tasks before migration
21
+ def self.before_migrate(&block)
22
+ @before_migrate_block = block
23
+ end
24
+
25
+ def self.before_migrate_block
26
+ @before_migrate_block
27
+ end
28
+
29
+ # If you need to get the base-level generator object, it's
30
+ # available here.
31
+ def g
32
+ generator
33
+ end
34
+
35
+ # Add a gem
36
+ #
37
+ # TODO: Find a way to consolidate all gems at once, so we only have to run
38
+ # `bundle install` once.
39
+ def gem(*args)
40
+ g.gem(*args)
41
+ end
42
+
43
+ # Run rake
44
+ def rake(*args)
45
+ g.rake(*args)
46
+ end
47
+
48
+ # Run any command
49
+ def run(*args)
50
+ g.run(*args)
51
+ end
52
+
53
+ alias :bundle_install! :bundle_install
54
+
55
+ def generate(*args)
56
+ g.generate(*args)
57
+ end
58
+
59
+ # Add a route to config/routes.rb
60
+ def route(*args)
61
+ g.route(*args)
62
+ end
63
+
64
+ # Add a file
65
+ def create_file(*args)
66
+ g.create_file(*args)
67
+ end
68
+
69
+ # Create a gem group
70
+ def gem_group(*args, &block)
71
+ generator.gem_group(*args, &block)
72
+ end
73
+
74
+ # Read a file from the templates directory
75
+ def read_file(file_name)
76
+ File.read(File.join(FastTrack.template_root, template_directory, file_name))
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,28 @@
1
+ class FastTrack
2
+ module TrackMethods
3
+ # Do a `bundle install`
4
+ def bundle_install
5
+ run "bundle install"
6
+ end
7
+
8
+ def config
9
+ ::FastTrack.config
10
+ end
11
+
12
+ def migration(migration_name, columns = {})
13
+ migration_columns = columns.map {|k, v| "#{k}:#{v}" }
14
+ generate "migration", migration_name, *migration_columns
15
+ end
16
+
17
+ # Do a `rake db:migrate`
18
+ def db_migrate!
19
+ rake "db:migrate"
20
+ end
21
+
22
+ # Create a model `model_name`
23
+ def model(model_name, columns = {})
24
+ model_columns = columns.map {|k, v| "#{k}:#{v}" }
25
+ generate "model", model_name, *model_columns
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,74 @@
1
+ class FastTrack
2
+ class TwitterBootstrap < Track
3
+ gemfile do
4
+ gem "twitter-bootstrap-rails"
5
+ gem "less-rails"
6
+ gem 'jquery-rails'
7
+
8
+ gem_group :assets do
9
+ gem 'less'
10
+ gem 'commonjs'
11
+ gem 'therubyracer', :platforms => :ruby
12
+ end
13
+ end
14
+
15
+ def template_directory
16
+ "twitter_bootstrap"
17
+ end
18
+
19
+ def flash_helper
20
+ read_file("bootstrap_flash_helper.rb")
21
+ end
22
+
23
+ def application_css
24
+ read_file("application.css")
25
+ end
26
+
27
+ def invoke
28
+ generate "controller Home index"
29
+ route "root to: 'home#index'"
30
+
31
+ generate "bootstrap:install less"
32
+ generate "bootstrap:layout application fixed --force"
33
+
34
+ create_file "app/helpers/bootstrap_flash_helper.rb", flash_helper
35
+ create_file "app/assets/stylesheets/application.css", application_css, force: true
36
+ end
37
+ end
38
+
39
+ # Create a layout that includes a customizable nav bar
40
+ class TwitterBootstrapNavBar < Track
41
+ def template_directory
42
+ "twitter_bootstrap_nav_bar"
43
+ end
44
+
45
+ def layout_for_application
46
+ read_file("application.html.erb")
47
+ end
48
+
49
+ def nav_bar
50
+ read_file("_navigation.html.erb")
51
+ end
52
+
53
+ def messages
54
+ read_file("_messages.html.erb")
55
+ end
56
+
57
+ def application_helper
58
+ read_file("application_helper.rb")
59
+ end
60
+
61
+ def invoke
62
+ unless FastTrack.tracks.any? {|t| t =~ "devise" }
63
+ raise "TwitterBootstrapNavBar requires Devise! Please include it in your --tracks!"
64
+ end
65
+
66
+ create_file "app/views/layouts/application.html.erb", layout_for_application, force: true
67
+ create_file "app/helpers/application_helper.rb", application_helper, force: true
68
+
69
+ # NOTE: _navigation.html.erb requires Devise to work properly!
70
+ create_file "app/views/layouts/_navigation.html.erb", nav_bar
71
+ create_file "app/views/layouts/_messages.html.erb", messages
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,3 @@
1
+ module FastTrack
2
+ VERSION = "0.0.1"
3
+ end
data/lib/fast_track.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "fast_track/version"
2
+
3
+ module FastTrack
4
+
5
+ end
@@ -0,0 +1,32 @@
1
+ # More info at https://github.com/guard/guard#readme
2
+
3
+ guard :livereload do
4
+ watch(%r{app/views/.+\.slim$})
5
+ watch(%r{app/helpers/.+\.rb})
6
+ watch(%r{public/.+\.(css|js|html)})
7
+ watch(%r{config/locales/.+\.yml})
8
+ # Rails Assets Pipeline
9
+ watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
10
+ end
11
+
12
+ guard :rspec do
13
+ watch(%r{^spec/.+_spec\.rb$})
14
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
15
+ watch('spec/spec_helper.rb') { "spec" }
16
+
17
+ # Rails example
18
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
19
+ watch(%r{^app/(.*)(\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
20
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
21
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
22
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
23
+
24
+ # Capybara request specs
25
+ watch(%r{^app/views/(.+)/.*(\.slim)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
26
+ end
27
+
28
+ guard :jasmine do
29
+ watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { 'spec/javascripts' }
30
+ watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
31
+ watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
32
+ end
@@ -0,0 +1,9 @@
1
+ /*
2
+ *= require bootstrap_and_overrides
3
+ *= require_self
4
+ *= require_tree .
5
+ */
6
+
7
+ body {
8
+ margin-top: 60px;
9
+ }
@@ -0,0 +1,23 @@
1
+ module BootstrapFlashHelper
2
+ ALERT_TYPES = [:error, :info, :success, :warning]
3
+
4
+ def bootstrap_flash
5
+ flash_messages = []
6
+ flash.each do |type, message|
7
+ # Skip empty messages, e.g. for devise messages set to nothing in a locale file.
8
+ next if message.blank?
9
+
10
+ type = :success if type == :notice
11
+ type = :error if type == :alert
12
+ next unless ALERT_TYPES.include?(type)
13
+
14
+ Array(message).each do |msg|
15
+ text = content_tag(:div,
16
+ content_tag(:button, raw("&times;"), :class => "close", "data-dismiss" => "alert") +
17
+ msg.html_safe, :class => "alert fade in alert-#{type}")
18
+ flash_messages << text if msg
19
+ end
20
+ end
21
+ flash_messages.join("\n").html_safe
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ <% flash.each do |name, msg| %>
2
+ <% if msg.is_a?(String) %>
3
+ <div class="alert alert-<%= name == :notice ? "success" : "error" %>">
4
+ <a class="close" data-dismiss="alert">&#215;</a>
5
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
6
+ </div>
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <%= link_to application_name, root_path, :class => 'brand' %>
2
+
3
+ <ul class="nav">
4
+ <% if user_signed_in? %>
5
+ <li>
6
+ <%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>
7
+ </li>
8
+ <% else %>
9
+ <li>
10
+ <%= link_to 'Login', new_user_session_path %>
11
+ </li>
12
+ <% end %>
13
+
14
+ <% if user_signed_in? %>
15
+ <li>
16
+ <%= link_to 'Edit account', edit_user_registration_path %>
17
+ </li>
18
+ <% if current_user.has_role? :admin %>
19
+ <li>
20
+ <%= link_to 'Admin', users_path %>
21
+ </li>
22
+ <% end %>
23
+ <% else %>
24
+ <li>
25
+ <%= link_to 'Sign up', new_user_registration_path %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
@@ -0,0 +1,37 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <title>
6
+ <%= content_for?(:title) ? yield(:title) : application_name %>
7
+ </title>
8
+ <meta name="description" content="<%= content_for?(:description) ? yield(:description) : application_name %>">
9
+ <%= stylesheet_link_tag "application", :media => "all" %>
10
+ <%= javascript_include_tag "application" %>
11
+ <%= csrf_meta_tags %>
12
+ <%= yield(:head) %>
13
+ </head>
14
+ <body class="<%= controller_name %> <%= action_name %>">
15
+ <div class="navbar navbar-fixed-top">
16
+ <nav class="navbar-inner">
17
+ <div class="container">
18
+ <%= render 'layouts/navigation' %>
19
+ </div>
20
+ </nav>
21
+ </div>
22
+ <div id="main" role="main">
23
+ <div class="container">
24
+ <div class="content">
25
+ <div class="row">
26
+ <div class="span12">
27
+ <%= render 'layouts/messages' %>
28
+ <%= yield %>
29
+ </div>
30
+ </div>
31
+ <footer>
32
+ </footer>
33
+ </div>
34
+ </div> <!--! end of .container -->
35
+ </div> <!--! end of #main -->
36
+ </body>
37
+ </html>
@@ -0,0 +1,5 @@
1
+ module ApplicationHelper
2
+ def application_name
3
+ Rails.application.class.parent_name
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fast_track
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Farley Knight
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
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
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
+ description: Leverage the Rails generator to architect new Rails apps with lots of
63
+ default gems, templates, and other recipes, quickly.
64
+ email:
65
+ - farleyknight@gmail.com
66
+ executables:
67
+ - track
68
+ extensions: []
69
+ extra_rdoc_files: []
70
+ files:
71
+ - .document
72
+ - .gitignore
73
+ - Gemfile
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - bin/track
78
+ - fast_track.gemspec
79
+ - lib/fast_track.rb
80
+ - lib/fast_track/app.rb
81
+ - lib/fast_track/awesome_defaults.rb
82
+ - lib/fast_track/backbone.rb
83
+ - lib/fast_track/better_exceptions.rb
84
+ - lib/fast_track/cancan.rb
85
+ - lib/fast_track/config.rb
86
+ - lib/fast_track/devise.rb
87
+ - lib/fast_track/errbit_heroku.rb
88
+ - lib/fast_track/generator.rb
89
+ - lib/fast_track/guard.rb
90
+ - lib/fast_track/jquery.rb
91
+ - lib/fast_track/omniauth.rb
92
+ - lib/fast_track/rolify.rb
93
+ - lib/fast_track/track.rb
94
+ - lib/fast_track/track_methods.rb
95
+ - lib/fast_track/twitter_bootstrap.rb
96
+ - lib/fast_track/version.rb
97
+ - lib/templates/guard_awesome_defaults/Guardfile
98
+ - lib/templates/twitter_bootstrap/application.css
99
+ - lib/templates/twitter_bootstrap/bootstrap_flash_helper.rb
100
+ - lib/templates/twitter_bootstrap_nav_bar/_messages.html.erb
101
+ - lib/templates/twitter_bootstrap_nav_bar/_navigation.html.erb
102
+ - lib/templates/twitter_bootstrap_nav_bar/application.html.erb
103
+ - lib/templates/twitter_bootstrap_nav_bar/application_helper.rb
104
+ homepage: ''
105
+ licenses:
106
+ - MIT
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ segments:
118
+ - 0
119
+ hash: 901443202263976725
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
127
+ - 0
128
+ hash: 901443202263976725
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 1.8.25
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Create Rails apps quickly.
135
+ test_files: []