├── plugins
├── bulma_plugin.rb
├── secure_only_plugin.rb
├── raphaeljs_plugin.rb
├── ar_permalink_plugin.rb
├── 960_plugin.rb
├── googleanalytics_plugin.rb
├── pry_byebug_plugin.rb
├── ar_permalink_i18n_plugin.rb
├── watchr_plugin.rb
├── ar_textile_plugin.rb
├── codehighlighter_plugin.rb
├── access_plugin.rb
├── raphy_charts_plugin.rb
├── omniauth_plugin.rb
├── coderay_plugin.rb
├── ar_translate_plugin.rb
├── rewrite_plugin.rb
├── vcr_plugin.rb
├── factory_girl_plugin.rb
├── flash_session_plugin.rb
├── payment_plugin.rb
├── hoptoad_plugin.rb
├── recaptcha_plugin.rb
├── letter_opener_plugin.rb
├── maintenance_plugin.rb
├── twitter-login_plugin.rb
├── goatmail_plugin.rb
├── auto_locale_plugin.rb
├── pry_debugger_plugin.rb
├── bootstrap_plugin.rb
├── tripoli_plugin.rb
├── bug_plugin.rb
├── blueprint_plugin.rb
├── exception_notifier_plugin.rb
├── react-sinatra_plugin.rb
├── better_errors_plugin.rb
├── resque_plugin.rb
├── fontawesome_plugin.rb
├── jammit_plugin.rb
├── coffee_plugin.rb
├── deflect_plugin.rb
├── openid_plugin.rb
├── will_paginate_plugin.rb
├── hamlit_plugin.rb
├── barista_plugin.rb
├── heroku_plugin.rb
├── disqus_plugin.rb
├── carrierwave_plugin.rb
├── dreamhost_plugin.rb
└── camorra_plugin.rb
├── files
├── lipsiasoft
│ ├── layout.haml
│ ├── errors.haml
│ ├── base.css
│ └── index.haml
└── watchrs
│ ├── test.watchr
│ └── spec.watchr
├── templates
├── mongochist_template.rb
├── angular_template.rb
├── lipsiasoft_template.rb
├── sampleblog_template.rb
└── sampleblog_dm_template.rb
└── README.md
/plugins/bulma_plugin.rb:
--------------------------------------------------------------------------------
1 | # Simple plugin to install bulma.
2 | #
3 | get 'https://github.com/jgthms/bulma/blob/master/css/bulma.min.css', destination_root('public/stylesheets/bulma.min.css')
4 |
--------------------------------------------------------------------------------
/plugins/secure_only_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Secure Only plugin on Padrino
3 | #
4 | #
5 | SECURE_ONLY = " app.use Rack::SecureOnly, :if => Padrino.env == :production"
6 |
7 | require_dependencies 'rack-secure_only', :require => 'rack/secure_only'
8 | initializer :secure_only, SECURE_ONLY
--------------------------------------------------------------------------------
/plugins/raphaeljs_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Plugin for installing RaphaelJS into Padrino project.
3 | #
4 | # Javascript files.
5 | get 'https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael-min.js', destination_root('public/javascripts/raphael-min.js')
6 | get 'https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js', destination_root('public/javascripts/raphael.js')
7 |
--------------------------------------------------------------------------------
/files/lipsiasoft/layout.haml:
--------------------------------------------------------------------------------
1 | !!!
2 | %html{ :xmlns=>"http://www.w3.org/1999/xhtml" }
3 | %head
4 | %title=title
5 | %meta{"http-equiv" => "Content-Type", :content => "text/html", :name => "description", :content => description}
6 | =stylesheet_link_tag "reset", "text", "960", "base"
7 | =javascript_include_tag "jquery", "application"
8 | %body
9 | .container_16
10 | =yield
--------------------------------------------------------------------------------
/plugins/ar_permalink_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This module extend ActiveRecord.
3 | #
4 | # You need to add to your model a column called +:permalink+
5 | #
6 | # then use +has_permalink :title like:
7 | #
8 | # class Page < ActiveRecord::Base
9 | # has_permalink :page
10 | # end
11 | #
12 | # prereqs:
13 | # sudo gem install padrino-contrib
14 | #
15 | require_contrib('orm/active_record/permalink')
16 |
--------------------------------------------------------------------------------
/plugins/960_plugin.rb:
--------------------------------------------------------------------------------
1 | %w(reset text 960).each do |file|
2 | get "https://github.com/nathansmith/960-Grid-System/raw/master/code/css/#{file}.css", "public/stylesheets/#{file}.css"
3 | end
4 |
5 | %w(12 16 24).each do |file|
6 | get "https://github.com/nathansmith/960-Grid-System/raw/master/code/img/#{file}_col.gif", "public/images/#{file}_col.gif"
7 | end
8 |
9 | say "Now add: reset.css, text.css, 960.css in your layout!", :green
--------------------------------------------------------------------------------
/files/lipsiasoft/errors.haml:
--------------------------------------------------------------------------------
1 | -if response.status == 404
2 | -title "The page you were looking for doesn't exist (404)"
3 | %h1 The page you were looking for doesn't exist.
4 | %p You may have mistyped the address or the page may have moved.
5 | -else
6 | -title "We're sorry, but something went wrong (500)"
7 | %h1 We're sorry, but something went wrong.
8 | %p We've been notified about this issue and we'll take a look at it shortly.
--------------------------------------------------------------------------------
/plugins/googleanalytics_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get GoogleAnalytics on Padrino
3 | # prereqs:
4 | # sudo gem install rack-google-analytics
5 | # http://github.com/leehambley/rack-google-analytics
6 | #
7 | ANALYTICS = <<-ANALYTICS
8 | app.use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x'
9 | ANALYTICS
10 | require_dependencies 'rack-google-analytics', :require => 'rack/google-analytics'
11 | initializer :analytics, ANALYTICS
--------------------------------------------------------------------------------
/plugins/pry_byebug_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Make Padrino use Pry and pry-byebug
3 | #
4 |
5 | LIB = <<-LIB
6 | begin
7 | require 'pry'
8 | $VERBOSE = nil
9 | IRB = Pry
10 | $VERBOSE = false
11 | rescue LoadError
12 | end
13 | LIB
14 |
15 | create_file 'lib/pry-byebug.rb', LIB
16 |
17 | GEMFILE = <<-GEMFILE
18 | group :development, :test do
19 | gem 'pry-byebug'
20 | end
21 | GEMFILE
22 |
23 | append_file('Gemfile', GEMFILE)
24 |
--------------------------------------------------------------------------------
/plugins/ar_permalink_i18n_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This module extend ActiveRecord.
3 | #
4 | # You need to add to your model a column called +:permalink+
5 | #
6 | # then use +has_permalink :title like:
7 | #
8 | # class Page < ActiveRecord::Base
9 | # has_permalink :page, :langs => [:en, :fr, :de]
10 | # end
11 | #
12 | # prereqs:
13 | # sudo gem install padrino-contrib
14 | #
15 | require_contrib('orm/active_record/permalink_i18n')
16 |
--------------------------------------------------------------------------------
/plugins/watchr_plugin.rb:
--------------------------------------------------------------------------------
1 | # Simple Auto-Test Watchr script generation.
2 | # TODO: add other types of watchr scripts.
3 | component = fetch_component_choice(:test)
4 | if component == 'none'
5 | say "Installation cancelled. No testing framework found.", :red
6 | else
7 | test = case component; when 'rspec', 'cucumber' then 'spec'; else 'test'; end
8 | get "https://github.com/padrino/padrino-recipes/raw/master/files/watchrs/#{test}.watchr", destination_root("#{test}.watchr")
9 | end
--------------------------------------------------------------------------------
/plugins/ar_textile_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This module generate html from textile.
3 | #
4 | # In your ActiveRecord class you need only to add:
5 | #
6 | # has_textile :body, :internal_links => :page
7 | #
8 | # In your body you can write (like github) internal links:
9 | #
10 | # [[Page Name|link me]]
11 | #
12 | #
13 | # prereqs:
14 | # sudo gem install padrino-contrib
15 | # sudo gem install RedCloth
16 | #
17 | require_contrib('orm/active_record/textile')
18 | require_dependency('RedCloth')
19 |
--------------------------------------------------------------------------------
/plugins/codehighlighter_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get CodeHighlighter on Padrino
3 | # prereqs:
4 | # sudo gem install rack-codehighlighter
5 | # http://github.com/wbzyl/rack-codehighlighter
6 | #
7 | HIGHLIGHTER = <<-HIGHLIGHTER
8 | app.use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
9 | HIGHLIGHTER
10 | require_dependencies 'coderay'
11 | require_dependencies 'rack-codehighlighter', :require => 'rack/codehighlighter'
12 | initializer :codehighlighter, HIGHLIGHTER
--------------------------------------------------------------------------------
/plugins/access_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Access Plugin via rack-contrib on Padrino
3 | # prereqs:
4 | # sudo gem install rack-contrib
5 | # http://github.com/rack/rack-contrib/
6 | # http://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/access.rb
7 | #
8 | CONTRIB = <<-CONTRIB
9 | app.use Rack::Access, '/backend' => ['127.0.0.1', '192.168.1.0/24']
10 | CONTRIB
11 | require_dependencies 'rack-contrib', :require => 'rack/contrib', :git => 'git://github.com/rack/rack-contrib.git'
12 | initializer :access, CONTRIB
--------------------------------------------------------------------------------
/files/lipsiasoft/base.css:
--------------------------------------------------------------------------------
1 | /* Some basic tags */
2 | body{font-family:Georgia;color:#222222;}
3 | a{color:#222222;text-decoration:none;}
4 | a:hover{text-decoration:underline;color:#3D3D3D;}
5 | h1{font-size:26px;}
6 | h2{border-top:4px solid #CFCFCF;padding-top:15px;}
7 | h1,h2,h3,h4,h5,h6{font-weight:normal;}
8 | p{margin-top:10px;margin-bottom:10px;}
9 |
10 | /* Some basic classes */
11 | .left{float:left;}
12 | .right{float:right;}
13 |
14 | /* Debug */
15 | .container_16 {background: #fff url(/images/16_col.gif) repeat-y;}
--------------------------------------------------------------------------------
/plugins/raphy_charts_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Plugin for installing Raphy Charts (RaphaelJS based HTML5/SVG charts) into a Padrino project.
3 | # Must also install the RaphaelJS library and include both into your project views.
4 | #
5 | # Javascript files.
6 | get 'https://raw.github.com/jcarver989/raphy-charts/master/compiled/charts.js', destination_root('public/javascripts/raphy-charts.js')
7 | get 'https://raw.github.com/jcarver989/raphy-charts/master/compiled/charts.min.js', destination_root('public/javascripts/raphy-charts.min.js')
8 |
--------------------------------------------------------------------------------
/plugins/omniauth_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Authentication Plugin via omniauth on Padrino
3 | # prereqs:
4 | # http://github.com/intridea/omniauth/
5 | # http://github.com/achiu/omniauth/ working fork
6 | #
7 | OMNIAUTH = <<-OMNIAUTH
8 | app.use OmniAuth::Builder do
9 | provider :developer unless Padrino.env == :production
10 | # provider :twitter, 'consumer_key', 'consumer_secret'
11 | # provider :facebook, 'app_id', 'app_secret'
12 | end
13 | OMNIAUTH
14 | require_dependencies 'omniauth'
15 | initializer :omniauth, OMNIAUTH
16 |
--------------------------------------------------------------------------------
/plugins/coderay_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get Coderay on Padrino
3 | # prereqs:
4 | # sudo gem install coderay
5 | # sudo gem install rack-coderay
6 | # http://github.com/webficient/rack-coderay
7 | #
8 | CODERAY = <<-CODERAY
9 | app.use Rack::Coderay, "//pre[@lang]", :line_numbers => :table
10 | CODERAY
11 | require_dependencies 'coderay'
12 | require_dependencies 'rack-coderay', :require => 'rack/coderay'
13 | initializer :coderay, CODERAY
14 | get 'http://coderay.rubychan.de/stylesheets/coderay.css', destination_root('public/stylesheets/coderay.css')
--------------------------------------------------------------------------------
/plugins/ar_translate_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This is an extension for ActiveRecord where if I had:
3 | #
4 | # post.description_ru = "I'm Russian"
5 | # post.description_en = "I'm English"
6 | # post.description_it = "I'm Italian"
7 | #
8 | # with this extension if I had set:
9 | #
10 | # I18n.locale = :it
11 | #
12 | # calling directly:
13 | #
14 | # post.description
15 | #
16 | # we get:
17 | #
18 | # post.description_it => "I'm Italian"
19 | #
20 | # prereqs:
21 | # sudo gem install padrino-contrib
22 | #
23 | require_contrib('orm/active_record/translate')
24 |
--------------------------------------------------------------------------------
/plugins/rewrite_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get Rewrite on Padrino
3 | # prereqs:
4 | # sudo gem install rack-rewrite
5 | # http://github.com/jtrupiano/rack-rewrite
6 | # View the github readme for additional rewrite rules
7 | #
8 | REWRITE = <<-REWRITE
9 | app.use Rack::Rewrite do
10 | # rewrite '/wiki/John_Trupiano', '/john'
11 | # r301 '/wiki/Yair_Flicker', '/yair'
12 | # r302 '/wiki/Greg_Jastrab', '/greg'
13 | # r301 %r{/wiki/(\w+)_\w+}, '/$1'
14 | end
15 | REWRITE
16 | require_dependencies 'rack-rewrite'
17 | initializer :rewrite, REWRITE
--------------------------------------------------------------------------------
/plugins/vcr_plugin.rb:
--------------------------------------------------------------------------------
1 | # VCR Plugin
2 | #
3 | # Adds VCR to your test config using webmock.
4 | #
5 | VCR = <<-CONF
6 |
7 | VCR.config do |c|
8 | c.cassette_library_dir = File.expand_path('../fixtures/', __FILE__)
9 | c.stub_with :webmock
10 | c.default_cassette_options = { :record => :new_episodes }
11 | end
12 | CONF
13 |
14 | test = fetch_component_choice(:test)
15 | path = test == 'rspec' || test == 'cucumber' ? 'spec/spec_helper.rb' : 'test/test_config.rb'
16 |
17 | append_file destination_root(path), VCR
18 | require_dependencies 'vcr', 'webmock', :group => :test
19 |
--------------------------------------------------------------------------------
/plugins/factory_girl_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Add FactoryGirl to Padrino
3 | #
4 | LIB = <<-LIB
5 | begin
6 | require 'factory_girl'
7 | # Sequel does not have a save! method
8 | if defined?(Sequel)
9 | FactoryGirl.define do
10 | to_create { |instance| instance.save }
11 | end
12 | end
13 | FactoryGirl.find_definitions
14 | rescue LoadError
15 | end
16 | LIB
17 |
18 | create_file 'lib/factory_girl.rb', LIB
19 |
20 | GEMFILE = <<-GEMFILE
21 | group :development, :test do
22 | gem 'factory_girl'
23 | end
24 | GEMFILE
25 |
26 | append_file('Gemfile', GEMFILE)
27 |
--------------------------------------------------------------------------------
/files/lipsiasoft/index.haml:
--------------------------------------------------------------------------------
1 | -title "Custom Title"
2 | -description "A custom description here"
3 |
4 | .grid_16
5 | %p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
6 | %p Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
7 | %p Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
8 | %p Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
9 | .clear
--------------------------------------------------------------------------------
/plugins/flash_session_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # FlashMiddleware help you passing your session in the URI, when it should be in the cookie.
3 | #
4 | # This code it's only performed when:
5 | #
6 | # env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
7 | #
8 | # ==== Usage
9 | #
10 | # use FlashMiddleware, session_id
11 | #
12 | # prereqs:
13 | # sudo gem install padrino-contrib
14 | #
15 | require_contrib('flash_session')
16 | initializer("Padrino::Contrib::FlashSession")
17 | inject_into_file "app/app.rb", " # use FlashSessionMiddleware, session_id\n", :after => "Padrino::Contrib::FlashSession\n"
--------------------------------------------------------------------------------
/plugins/payment_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Payment(ActiveMerchant Wrapper) plugin on Padrino
3 | # prereqs:
4 | # sudo gem install rack-payment
5 | # http://github.com/devfu/rack-payment
6 | #
7 | PAYMENT = <<-PAYMENT
8 | app.use Rack::Payment,
9 | :gateway => 'paypal',
10 | :login => 'bob',
11 | :password => 'secret',
12 | :signature => '123abc',
13 | :test_mode => true # during real usage, set this to false
14 | app.helpers Rack::Payment::Methods
15 | PAYMENT
16 | require_dependencies 'rack-payment', :require => 'rack/payment'
17 | initializer :payment, PAYMENT
--------------------------------------------------------------------------------
/plugins/hoptoad_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get Hoptoad on Padrino
3 | # prereqs:
4 | # sudo gem install rack_hoptoad
5 | # http://github.com/atmos/rack_hoptoad
6 | #
7 | HOPTOAD = <<-HOPTOAD
8 | app.use Rack::Hoptoad, 'API_KEY_HERE' do |notifier|
9 | #notifier.report_under << 'custom'
10 | #notifier.environment_filters << %w(MY_SECRET_KEY MY_SECRET_TOKEN)
11 | end
12 | HOPTOAD
13 | require_dependencies 'rack_hoptoad', :require => 'rack/hoptoad'
14 | initializer :hoptoad, HOPTOAD
15 | inject_into_file destination_root('/app/app.rb')," enable :raise_errors\n", :after => "configure do\n"
--------------------------------------------------------------------------------
/plugins/recaptcha_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get Recaptcha on Padrino
3 | # prereqs:
4 | # sudo gem install rack-recaptcha
5 | # http://github.com/achiu/rack-recaptcha
6 | # NOTE:
7 | # if you have another sub app in the application, you must register in the apps app.rb
8 | #
9 | RECAPTCHA = <<-RECAPTCHA
10 | app.use Rack::Recaptcha,
11 | :private_key => "YOUR_PRIVATE_KEY",
12 | :public_key => "YOUR_PUBLIC_KEY",
13 | :paths => "YOUR_LOGIN_PATH(S)"
14 | app.helpers Rack::Recaptcha::Helpers
15 | RECAPTCHA
16 | require_dependencies 'rack-recaptcha', :require => 'rack/recaptcha'
17 | initializer :recatpcha, RECAPTCHA
--------------------------------------------------------------------------------
/plugins/letter_opener_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Letter Opener plugin on Padrino
3 | #
4 | # https://github.com/ryanb/letter_opener
5 | #
6 |
7 | GEMFILE = <<-GEMFILE
8 |
9 | # Letter Opener
10 | gem 'letter_opener', :group => 'development'
11 | GEMFILE
12 | append_file "Gemfile", GEMFILE
13 |
14 | CONFIG = <<-CONFIG
15 | # Setup letter_opener
16 | if Padrino.env == :development
17 | set :delivery_method, {
18 | LetterOpener::DeliveryMethod => {
19 | location: Padrino.root('tmp/letter_opener')
20 | }
21 | }
22 | end
23 | CONFIG
24 | inject_into_file destination_root('config/apps.rb'), CONFIG, :after => "Padrino.configure_apps do\n"
25 |
--------------------------------------------------------------------------------
/plugins/maintenance_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Maintanence plugin on Padrino
3 | # prereqs:
4 | # sudo gem install rack-maintenance
5 | # http://github.com/ddollar/rack-maintenance
6 | #
7 | MAINT = <<-MAINT
8 | app.use Rack::Maintenance, :file => Padrino.root('public/maintenance.html') #, :env => 'MAINTENANCE'
9 | MAINT
10 | PAGE = <<-PAGE
11 |
12 |
Site Under Maintenance
13 | This Site is Currently Under Maintenance!
14 |
15 | PAGE
16 | require_dependencies 'rack-maintenance', :require => 'rack/maintenance'
17 | initializer :maintenance, MAINT
18 | create_file destination_root('public/maintenance.html'), PAGE
--------------------------------------------------------------------------------
/plugins/twitter-login_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Twitter Login plugin on Padrino
3 | #
4 | # prereqs:
5 | # sudo gem install twitter-login
6 | # http://github.com/mislav/twitter-login
7 | #
8 | TWITTER = <<-TWITTER
9 | app.use Twitter::Login,
10 | :consumer_key => 'KEY',
11 | :secret => 'SECRET'
12 | # :login_path => '/login',
13 | # :return_to => '/'
14 | app.helpers Twitter::Login::Helpers
15 | TWITTER
16 | require_dependencies 'twitter-login', :require => 'twitter/login', :version => "= 0.3"
17 | initializer :twitter_login, TWITTER
18 | inject_into_file destination_root('app/app.rb')," enable :sessions\n", :after => "configure do\n"
19 |
--------------------------------------------------------------------------------
/plugins/goatmail_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Goatmail plugin on Padrino
3 | #
4 | # https://github.com/tyabe/goatmail
5 | #
6 | # You can view all send mail under the /inbox URL in development mode
7 |
8 | GEMFILE = <<-GEMFILE
9 | group :development do
10 | gem 'goatmail'
11 | end
12 |
13 | GEMFILE
14 | append_file("Gemfile", GEMFILE)
15 |
16 | CONFIG = <<-CONFIG
17 | if Padrino.env == :development
18 | Padrino.configure_apps do
19 | set :delivery_method, Goatmail::DeliveryMethod => {}
20 | end
21 |
22 | Padrino.mount('Goatmail::App').to('/inbox')
23 | end
24 |
25 | CONFIG
26 |
27 | inject_into_file destination_root('config/apps.rb'), CONFIG, :after => "end\n\n"
28 |
--------------------------------------------------------------------------------
/plugins/auto_locale_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This extension give to padrino the ability to change
3 | # their locale inspecting.
4 | #
5 | # ==== Usage
6 | #
7 | # class MyApp < Padrino::Application
8 | # register AutoLocale
9 | # set :locales, [:en, :ru, :de] # First locale is the default locale
10 | # end
11 | #
12 | # So when we call an url like: /ru/blog/posts this extension set for you :ru as I18n.locale
13 | #
14 | # prereqs:
15 | # sudo gem install padrino-contrib
16 | #
17 | require_contrib('auto_locale')
18 | initializer("Padrino::Contrib::AutoLocale")
19 | inject_into_file "app/app.rb", " # set :locales, [:en, :ru, :de] # First locale is the default locale\n", :after => "Padrino::Contrib::AutoLocale\n"
--------------------------------------------------------------------------------
/plugins/pry_debugger_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # PRY Debugger on Padrino
3 | #
4 |
5 | LIB = <<-LIB
6 | begin
7 | require 'pry'
8 | $VERBOSE = nil
9 | IRB = Pry
10 | $VERBOSE = false
11 | rescue LoadError
12 | end
13 | LIB
14 |
15 | create_file 'lib/pry-padrino.rb', LIB
16 |
17 | GEMFILE = <<-GEMFILE
18 | group 'test', 'development' do
19 | gem 'pry'
20 | gem 'pry-doc'
21 | gem 'pry-nav'
22 | gem 'pry-stack_explorer'
23 | gem 'bond'
24 | end
25 | gem 'plymouth', require: false, group: 'test'
26 | GEMFILE
27 |
28 | append_file('Gemfile', GEMFILE)
29 |
30 | inject_into_file destination_root('test/test_config.rb'), "require 'plymouth'",
31 | after: "require File.expand_path('../../config/boot', __FILE__)\n"
32 |
--------------------------------------------------------------------------------
/plugins/bootstrap_plugin.rb:
--------------------------------------------------------------------------------
1 | # Simple plugin to install Twitter bootstrap.
2 | #
3 | get 'https://raw.github.com/twbs/bootstrap/master/dist/css/bootstrap.css', destination_root('public/stylesheets/bootstrap.css')
4 | get 'https://raw.github.com/twbs/bootstrap/master/dist/css/bootstrap.css.map', destination_root('public/stylesheets/bootstrap.css.map')
5 | get 'https://raw.github.com/twbs/bootstrap/master/dist/css/bootstrap.min.css', destination_root('public/stylesheets/bootstrap.min.css')
6 | get 'https://raw.github.com/twbs/bootstrap/master/dist/js/bootstrap.js', destination_root('public/javascripts/bootstrap.js')
7 | get 'https://raw.github.com/twbs/bootstrap/master/dist/js/bootstrap.min.js', destination_root('public/javascripts/bootstrap.min.js')
8 |
--------------------------------------------------------------------------------
/plugins/tripoli_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Inserts Blueprint CSS into your project.
3 | # prereqs:
4 | # include the generated partial into your layout!
5 | #
6 | ERB = <<-ERB
7 | <%= stylesheet_link_tag 'tripoli' %>
8 | <%= stylesheet_link_tag 'simple' %>
9 | ERB
10 | type = fetch_component_choice(:renderer)
11 | create_file destination_root("app/views/shared/_tripoli.#{type}"), (type == 'erb' ? ERB : ERB.gsub(/(<%)|(%>)/,''))
12 | get "http://devkick.com/lab/tripoli/tripoli.simple.css", destination_root('public/stylesheets/simple.css')
13 | get "http://devkick.com/lab/tripoli/tripoli.base.css", destination_root('public/stylesheets/tripoli.css')
14 | say "Now, include the generated partial app/views/shared/_tripoli.#{type} into your layout!", :green
--------------------------------------------------------------------------------
/plugins/bug_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get rack-bug on Padrino
3 | # prereqs:
4 | # sudo gem install rack-bug
5 | # http://github.com/brynary/rack-bug
6 | #
7 | BUG = <<-BUG
8 | app.use Rack::Bug,
9 | :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"
10 | # extra configurations
11 | # :password => 'password',
12 | # :ip_masks => [IPAddr.new("2.2.2.2/0")],
13 | # :panel_classes => [
14 | # Rack::Bug::TimerPanel,
15 | # Rack::Bug::RequestVariablesPanel,
16 | # Rack::Bug::RedisPanel,
17 | # Rack::Bug::TemplatesPanel,
18 | # Rack::Bug::LogPanel,
19 | # Rack::Bug::MemoryPanel
20 | # ]
21 |
22 | BUG
23 | require_dependencies 'rack-bug', :require => 'rack/bug'
24 | initializer :bug, BUG
--------------------------------------------------------------------------------
/plugins/blueprint_plugin.rb:
--------------------------------------------------------------------------------
1 | # Inserts Blueprint CSS into your project.
2 | # prereqs:
3 | # include the generated partial into your layout!
4 | ERB = <<-ERB
5 | <%= stylesheet_link_tag 'screen', :media => 'screen,projection' %>
6 | <%= stylesheet_link_tag 'print', :media => 'print' %>
7 | ERB
8 | type = fetch_component_choice(:renderer)
9 | path = "http://github.com/joshuaclayton/blueprint-css/raw/master/blueprint/"
10 | create_file destination_root("app/views/shared/_blueprint.#{type}"), (type == 'erb' ? ERB : ERB.gsub(/(<%)|(%>)/,''))
11 | get (path + "screen.css"), destination_root('public/stylesheets/screen.css')
12 | get (path + "print.css"), destination_root('public/stylesheets/print.css')
13 | say "Now, include the generated partial app/views/shared/_blueprint.#{type} into your layout!", :green
--------------------------------------------------------------------------------
/plugins/exception_notifier_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # This is an exception notifier for Padrino::Application with
3 | # redmine bonus feature.
4 | #
5 | # ==== Usage
6 | #
7 | # class MyApp < Padrino::Application
8 | # register Padrino::Contrib::ExceptionNotifier
9 | # set :exceptions_from, "errors@localhost.local"
10 | # set :exceptions_to, "foo@bar.local"
11 | # set :exceptions_page, :errors # => views/errors.haml/erb
12 | # set :redmine, :project => "My Bugs", :tracker => "Bugs", :priority => "High"
13 | # # Uncomment this for test in development
14 | # # disable :raise_errors
15 | # # disable :show_exceptions
16 | # end
17 | #
18 | # prereqs:
19 | # sudo gem padrino-contrib
20 | #
21 | require_contrib('exception_notifier')
22 | initializer("Padrino::Contrib::ExceptionNotifier")
--------------------------------------------------------------------------------
/plugins/react-sinatra_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # React Ingegration for Padrino
3 | # @see https://github.com/namusyaka/react-sinatra
4 | #
5 | REACT_SINATRA_INIT = <<-REACT
6 | configure do
7 | React::Sinatra.configure do |config|
8 | config.use_bundled_react = true
9 | config.env = ENV['RACK_ENV'] || ENV['PADRINO_ENV']
10 | config.runtime = :execjs
11 | # Your javascript for server site should be placed in {Padrino.root}client/dist/server.js
12 | config.asset_path = %w(client/dist/server.js)
13 | config.pool_size = 5
14 | config.pool_timeout = 10
15 | end
16 |
17 | React::Sinatra::Pool.pool.reset
18 | end
19 | REACT
20 |
21 | require_dependencies 'react-sinatra'
22 | require_dependencies 'execjs'
23 | require_dependencies 'mini_racer'
24 |
25 | inject_into_file destination_root('app/app.rb'), REACT_SINATRA_INIT, :after => "enable :sessions\n"
26 |
--------------------------------------------------------------------------------
/plugins/better_errors_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Better Errors plugin on Padrino
3 | #
4 | # https://github.com/charliesome/better_errors
5 | #
6 |
7 | GEMFILE = <<-GEMFILE
8 |
9 | # Better Errors
10 | group :development do
11 | gem "better_errors"
12 | gem "binding_of_caller"
13 | end
14 |
15 | GEMFILE
16 | append_file("Gemfile", GEMFILE)
17 |
18 | CONFIG = <<-CONFIG
19 | # Setup better_errors
20 | if Padrino.env == :development
21 | require 'better_errors'
22 | Padrino::Application.use BetterErrors::Middleware
23 | BetterErrors.application_root = PADRINO_ROOT
24 | BetterErrors.logger = Padrino.logger
25 | end
26 |
27 | CONFIG
28 |
29 | SETTING = <<-SETTING
30 | # Use better_errors
31 | set :protect_from_csrf, except: %r{/__better_errors/\\w+/\\w+\\z} if RACK_ENV == :development
32 | SETTING
33 |
34 | inject_into_file destination_root('config/boot.rb'), CONFIG, :before => "Padrino.load!"
35 | inject_into_file destination_root('config/apps.rb'), SETTING, :after => "set :protect_from_csrf, true\n"
36 |
--------------------------------------------------------------------------------
/plugins/resque_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Resque Plugin for Padrino
3 | # gem install resque
4 | # https://www.github.com/defunkt/resque
5 | #
6 | INIT =<<-INIT
7 | padrino_env = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development"
8 | resque_config = YAML.load_file Padrino.root('config','resque.yml')
9 | Resque.redis = resque_config[padrino_env]
10 | INIT
11 |
12 | CONFIG =<<-CONFIG
13 | development: localhost:6379
14 | test: localhost:6379
15 | production: localhost:6379
16 | CONFIG
17 |
18 | RAKE =<<-RAKE
19 | require 'resque/tasks'
20 |
21 | namespace :resque do
22 | desc "Load the Application Development for Resque"
23 | task :setup => :environment do
24 | ENV['QUEUES'] = '*'
25 | # ENV['VERBOSE'] = '1' # Verbose Logging
26 | # ENV['VVERBOSE'] = '1' # Very Verbose Logging
27 | end
28 | end
29 | RAKE
30 |
31 | create_file destination_root('lib/resque_init.rb'), INIT
32 | create_file destination_root('config/resque.yml'), CONFIG
33 | create_file destination_root('lib/tasks/resque.rake'), RAKE
34 | require_dependencies 'resque'
35 |
--------------------------------------------------------------------------------
/templates/mongochist_template.rb:
--------------------------------------------------------------------------------
1 | # Determine whether mongoid or mongo_mapper is being used
2 | say
3 | orm = ask("Which mongo ORM do you want to use?:(mongoid/mongo_mapper)")
4 | tiny = yes?("Need tiny structure?")
5 | choices = { :test => options[:test], :stylesheet => options[:stylesheet], :renderer => options[:renderer],
6 | :script => options[:script], :orm => orm.gsub("_",""), :tiny => tiny, :mock => options[:mock],
7 | :app => options[:app] }
8 |
9 | choices.reject! { |k,v| v.nil? }
10 | project choices
11 |
12 | say "Configuring Machinist", :magenta
13 | machinist = <<-MONGO
14 | gem 'machinist', :group => 'test'
15 | gem 'machinist_mongo', :require => 'machinist/#{orm}', :group => 'test'
16 | MONGO
17 |
18 | blueprints =<<-SHAM
19 | Sham.define do
20 | end
21 | SHAM
22 |
23 | inject_into_file destination_root("Gemfile"),machinist, :after => "# Test requirements\n"
24 | create_file destination_root("test/blueprints.rb"), blueprints
25 | inject_into_file destination_root("test/test_config.rb"), "require File.join(File.dirname(__FILE__),'blueprints')\n", :after => "/boot\")\n"
26 |
27 |
28 |
--------------------------------------------------------------------------------
/plugins/fontawesome_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Plugin for installing Font Awesome CSS into Padrino project.
3 | #
4 | # CSS Stylesheets
5 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/css/font-awesome.css', destination_root('public/stylesheets/font-awesome.css')
6 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/css/font-awesome.min.css', destination_root('public/stylesheets/font-awesome.min.css')
7 | # Fonts
8 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/fonts/FontAwesome.otf', destination_root('public/fonts/FontAwesome.otf')
9 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.eot', destination_root('public/fonts/fontawesome-webfont.eot')
10 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.svg', destination_root('public/fonts/fontawesome-webfont.svg')
11 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.ttf', destination_root('public/fonts/fontawesome-webfont.ttf')
12 | get 'https://raw.github.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.woff', destination_root('public/fonts/fontawesome-webfont.woff')
13 |
--------------------------------------------------------------------------------
/plugins/jammit_plugin.rb:
--------------------------------------------------------------------------------
1 | ASSETS_YML = <<-ASSETS_YML
2 | package_assets: on
3 | package_path: assets-compiled
4 | compress_assets: true
5 | javascript_compressor: closure
6 | gzip_assets: true
7 |
8 | javascripts:
9 | application:
10 | - public/javascripts/application.js
11 | - public/javascripts/libraries/**/*.js
12 | - public/javascripts/templates/**/*.jst
13 |
14 | stylesheets:
15 | application:
16 | - public/stylesheets/**/*.css
17 | ASSETS_YML
18 |
19 | JAMMIT_REGISTER = (<<-JAMMITR).gsub(/^ {10}/, '') unless defined?(JAMMIT_REGISTER)
20 | register Jammit\n
21 | JAMMITR
22 |
23 | JAMMIT_HOOK = (<<-JAMMITH).gsub(/^ {2}/, '') unless defined?(JAMMIT_HOOK)
24 | Padrino.after_load do
25 | ::RAILS_ENV = PADRINO_ENV unless defined?(::RAILS_ENV) # jammit 0.6.0 workaround
26 | Jammit.load_configuration("\#{Padrino.root}/config/assets.yml")
27 | end
28 |
29 | JAMMITH
30 |
31 | require_dependencies 'jammit-sinatra'
32 |
33 | create_file "config/assets.yml", ASSETS_YML
34 |
35 | inject_into_file destination_root('/app/app.rb'), JAMMIT_REGISTER, :after => "register Padrino::Helpers\n"
36 |
37 | inject_into_file destination_root('config/boot.rb'), JAMMIT_HOOK, :before => "Padrino.load!"
--------------------------------------------------------------------------------
/plugins/coffee_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # CoffeeScript Plugin via rack-coffee on Padrino
3 | # prereqs:
4 | # node.js: using homebrew, $ brew install node.js
5 | # sudo gem install coffee-script
6 | # sudo gem install rack-coffee
7 | # http://github.com/mattly/rack-coffee
8 | # http://github.com/jashkenas/coffee-script
9 | #
10 | COFFEE = <<-COFFEE
11 | app.use Rack::Coffee,
12 | :root => Padrino.root('/public'),
13 | :urls => '/javascripts'
14 | # :root: the directory above urls. Defaults to Dir.pwd.
15 | # :urls: the directories in which to look for coffeescripts. May specify a string or an array of strings. Defaults to /javascripts.
16 | # :static: Whether to serve any static assets found in your urls (via Rack::File). Defaults to true; Specify false to pass through to your app.
17 | # :cache: Sets a Cache-Control header if truthy, public if set to :public
18 | # :ttl: The default max-age value for the Cache-Control header. Defaults to 86400.
19 | # :nowrap: When true, disables the top-level function wrapper that CoffeeScript uses by default.
20 | COFFEE
21 | require_dependencies 'coffee-script'
22 | require_dependencies 'rack-coffee', :require => 'rack/coffee'
23 | initializer :coffee, COFFEE
--------------------------------------------------------------------------------
/plugins/deflect_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Deflect Plugin via rack-contrib on Padrino
3 | # prereqs:
4 | # sudo gem install rack-contrib
5 | # http://github.com/rack/rack-contrib/
6 | # http://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/deflect.rb
7 | #
8 | CONTRIB = <<-CONTRIB
9 | app.use Rack::Deflect,
10 | :log => $stdout,
11 | :request_threshold => 20,
12 | :interval => 2,
13 | :block_duration => 60
14 | # :log # When false logging will be bypassed, otherwise pass an object responding to #puts
15 | # :log_format # Alter the logging format
16 | # :log_date_format # Alter the logging date format
17 | # :request_threshold # Number of requests allowed within the set :interval. Defaults to 100
18 | # :interval # Duration in seconds until the request counter is reset. Defaults to 5
19 | # :block_duration # Duration in seconds that a remote address will be blocked. Defaults to 900 (15 minutes)
20 | # :whitelist # Array of remote addresses which bypass Deflect. NOTE: this does not block others
21 | # :blacklist # Array of remote addresses immediately considered malicious
22 | CONTRIB
23 | require_dependencies 'rack-contrib', :require => 'rack/contrib', :git => 'git://github.com/rack/rack-contrib.git'
24 | initializer :deflect, CONTRIB
--------------------------------------------------------------------------------
/plugins/openid_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template for OpenID on Padrino
3 | # prereqs:
4 | # sudo gem install rack-openid
5 | # http://github.com/josh/rack-openid
6 | #
7 | OPENID = <<-OPENID
8 | app.use Rack::Session::Cookie
9 | app.use Rack::OpenID
10 | OPENID
11 | POST = <<-POST
12 | if resp = request.env["rack.openid.response"]
13 | if resp.status == :success
14 | "Welcome: \#{resp.display_identifier}"
15 | else
16 | "Error: \#{resp.status}"
17 | end
18 | else
19 | headers 'WWW-Authenticate' => Rack::OpenID.build_header(:identifier => params["openid_identifier"])
20 | throw :halt, [401, 'got openid?']
21 | end
22 | POST
23 | FORM = <<-FORM
24 | <% form_tag '/openid/login', :method => 'post' do %>
25 |
26 | <%= label_tag :openid_identifier %>
27 | <%= text_field_tag :openid_identifier %>
28 |
29 |
30 | <%= submit_tag 'Sign In' %>
31 |
32 | <% end %>
33 | FORM
34 | require_dependencies 'rack-openid', :require => 'rack/openid'
35 | initializer :openid, OPENID
36 | generate :controller, "openid get:login post:login"
37 | inject_into_file destination_root('app/controllers/openid.rb'), " render 'openid/login'\n", :after => "get :login do\n"
38 | inject_into_file destination_root('app/controllers/openid.rb'), POST, :after => "post :login do\n"
39 | create_file destination_root('app/views/openid/login.erb'), FORM
--------------------------------------------------------------------------------
/files/watchrs/test.watchr:
--------------------------------------------------------------------------------
1 | # install watchr
2 | # $ gem install watchr
3 | #
4 | # Run With:
5 | # $ watchr test.watchr
6 | #
7 |
8 | # --------------------------------------------------
9 | # Helpers
10 | # --------------------------------------------------
11 |
12 | def run(cmd)
13 | puts(cmd)
14 | system("ruby #{cmd}")
15 | end
16 |
17 | # --------------------------------------------------
18 | # Watchr Rules
19 | # --------------------------------------------------
20 | watch("^lib/(.*)\.rb") { |m| run("test/lib/#{m[1]}_test.rb") }
21 |
22 | watch("^(.*)/controllers/(.*).rb") { |m| run("test/#{m[1]}/controllers/#{m[2]}_controller_test.rb") }
23 | watch("^test/(.*)/controllers/(.*)_test.rb") { |m| run("test/#{m[1]}/controllers/#{m[2]}_test.rb") }
24 |
25 | watch("^(.*)/models/(.*).rb") { |m| run("test/#{m[1]}/models/#{m[2]}_test.rb") }
26 | watch("^test/(.*)/(.*)_test.rb") { |m| run("test/#{m[1]}/models/#{m[2]}_test.rb") }
27 |
28 | watch("test.*/test_config\.rb") { system( "padrino rake test" ) }
29 | watch("^test/(.*)_test\.rb") { |m| run("test/#{m[1]}_test.rb") }
30 |
31 | # --------------------------------------------------
32 | # Signal Handling
33 | # --------------------------------------------------
34 | # Ctrl-\
35 | Signal.trap('QUIT') do
36 | puts " --- Running all tests ---\n\n"
37 | system "padrino rake test"
38 | end
39 |
40 | # Ctrl-C
41 | Signal.trap('INT') { abort("\n") }
42 |
--------------------------------------------------------------------------------
/files/watchrs/spec.watchr:
--------------------------------------------------------------------------------
1 | # install watchr
2 | # $ gem install watchr
3 | #
4 | # Run With:
5 | # $ watchr spec.watchr
6 | #
7 |
8 | # --------------------------------------------------
9 | # Helpers
10 | # --------------------------------------------------
11 |
12 | def run(cmd)
13 | puts(cmd)
14 | system("rspec #{cmd}")
15 | end
16 |
17 | # --------------------------------------------------
18 | # Watchr Rules
19 | # --------------------------------------------------
20 | watch("^lib/(.*)\.rb") { |m| run("spec/lib/#{m[1]}_spec.rb") }
21 |
22 | watch("^(.*)/controllers/(.*).rb") { |m| run("spec/#{m[1]}/controllers/#{m[2]}_controller_spec.rb") }
23 | watch("^spec/(.*)/controllers/(.*)_spec.rb") { |m| run("spec/#{m[1]}/controllers/#{m[2]}_spec.rb") }
24 |
25 | watch("^(.*)/models/(.*).rb") { |m| run("spec/#{m[1]}/models/#{m[2]}_spec.rb") }
26 | watch("^spec/(.*)/models/(.*)_spec.rb") { |m| run("spec/#{m[1]}/models/#{m[2]}_spec.rb") }
27 |
28 | watch("spec.*/spec_helper\.rb") { system( "padrino rake spec" ) }
29 | watch("^spec/(.*)_spec\.rb") { |m| run("spec/#{m[1]}_spec.rb") }
30 |
31 | # --------------------------------------------------
32 | # Signal Handling
33 | # --------------------------------------------------
34 | # Ctrl-\
35 | Signal.trap('QUIT') do
36 | puts " --- Running all specs ---\n\n"
37 | system "padrino rake spec"
38 | end
39 |
40 | # Ctrl-C
41 | Signal.trap('INT') { abort("\n") }
42 |
--------------------------------------------------------------------------------
/plugins/will_paginate_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get will_paginate on Padrino
3 | # prereqs:
4 | #
5 | # will_paginate provides orm integration with active_record, datamapper,
6 | # and sequel out of the box.
7 | #
8 | # https://github.com/mislav/will_paginate/wiki/Installation
9 | #
10 |
11 | orm = (choice = fetch_component_choice(:orm)) =~ /sequel|activerecord|datamapper/ ? choice : ""
12 | orm = '/data_mapper' if orm == "datamapper"
13 | orm = '/active_record' if orm == "activerecord"
14 | orm = '/sequel' if orm == "sequel"
15 | inject_into_file destination_root('config/boot.rb'),
16 | " require 'will_paginate'\n" +
17 | " require 'will_paginate#{orm}'\n" +
18 | " require 'will_paginate/view_helpers/sinatra'\n" +
19 | " include WillPaginate::Sinatra::Helpers\n",
20 | :after => "before_load do\n"
21 | inject_into_file destination_root('app/app.rb'),
22 | " register WillPaginate::Sinatra\n",
23 | :after => "Padrino::Application\n"
24 | inject_into_file destination_root('Gemfile'),
25 | "gem 'will_paginate', '~>3.0'\n",
26 | :after => "Component requirements\n"
27 |
28 | say '='*65, :green
29 | say "The 'will_paginate' plugin has been installed!"
30 | say "Next, follow these steps:"
31 | say "Run 'bundle install'"
32 | say "Start (or restart) the padrino server"
33 | say '='*65, :green
34 | =begin
35 | puts '='*65
36 | puts "The 'will_paginate' plugin has been installed!"
37 | puts "Next, follow these steps:"
38 | puts "Run 'bundle install'"
39 | puts "Start (or restart) the padrino server"
40 | puts '='*65
41 | =end
42 |
--------------------------------------------------------------------------------
/plugins/hamlit_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Use hamlit instead of haml for rendering
3 | # This is basically a copy of the existing integration for slim
4 |
5 | RENDERING=<<'RUBY'
6 | module Padrino
7 | module Helpers
8 | module OutputHelpers
9 | ##
10 | # Handler for Hamlit templates.
11 | #
12 | class HamlitHandler < AbstractHandler
13 | ##
14 | # Returns true if the block is for Hamlit.
15 | #
16 | def engine_matches?(block)
17 | block.binding.eval('defined? __in_hamlit_template')
18 | end
19 | end
20 | OutputHelpers.register(:haml, HamlitHandler)
21 | end
22 | end
23 | end
24 |
25 | module Padrino
26 | module Rendering
27 | class HamlitOutputBuffer < Temple::Generators::StringBuffer
28 | define_options :buffer_class => 'SafeBuffer'
29 |
30 | def call(exp)
31 | [preamble, compile(exp), postamble].flatten.compact.join('; '.freeze)
32 | end
33 |
34 | def create_buffer
35 | "#{buffer} = #{options[:buffer_class]}.new"
36 | end
37 |
38 | def concat(str)
39 | "#{buffer}.safe_concat((#{str}))"
40 | end
41 | end
42 |
43 | class HamlitTemplate < Hamlit::Template
44 | include SafeTemplate
45 |
46 | def precompiled_preamble(locals)
47 | "__in_hamlit_template = true\n" << super
48 | end
49 | end
50 | end
51 | end
52 |
53 | Tilt.prefer(Padrino::Rendering::HamlitTemplate, :haml)
54 |
55 | Padrino::Rendering.engine_configurations[:haml] = {
56 | :generator => Padrino::Rendering::HamlitOutputBuffer,
57 | :buffer => "@_out_buf",
58 | :use_html_safe => true,
59 | }
60 | RUBY
61 |
62 | create_file destination_root('lib/padrino-hamlit.rb'), RENDERING
63 | require_dependencies 'hamlit'
64 |
65 | say "Unless you need haml, you can remove it from your Gemfile."
66 |
--------------------------------------------------------------------------------
/plugins/barista_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Barista Plugin on Padrino
3 | # prereqs:
4 | #
5 | # gem install barista
6 | #
7 | COFFEE = <<-COFFEE
8 | module BaristaInitializer
9 |
10 | def self.registered(app)
11 | # Find more options for Barista at:
12 | # https://github.com/Sutto/barista
13 | #
14 | Barista.configure do |c|
15 |
16 | # Change the root to use app/scripts
17 | #
18 | c.root = File.join(Padrino.root, "assets", "javascripts")
19 |
20 | # Change the output root, causing Barista to compile into public/coffeescripts
21 | #
22 | # c.output_root = Rails.root.join("public", "coffeescripts")
23 |
24 | # Change the output root for a framework:
25 | #
26 | # c.change_output_prefix! 'framework-name', 'output-prefix'
27 |
28 | # Or change the prefix for all frameworks, use #each_framework:
29 | #
30 | # c.each_framework do |framework|
31 | # c.change_output_prefix! framework.name, "vendor/\#{framework.name}"
32 | # end
33 |
34 |
35 | # Or, hook into the compilation:
36 | #
37 | # c.before_compilation { |path| puts "Barista: Compiling \#{path}" }
38 | # c.on_compilation { |path| puts "Barista: Successfully compiled \#{path}" }
39 | # c.on_compilation_error { |path, output| puts "Barista: Compilation of \#{path} failed with:\n\#{output}" }
40 | # c.on_compilation_with_warning { |path, output| puts "Barista: Compilation of \#{path} had a warning:\n\#{output}" }
41 | end
42 |
43 | app.register Barista::Integration::Sinatra
44 | end
45 | end
46 | COFFEE
47 |
48 | APP_INIT = <<-INIT
49 | configure :development do
50 | register BaristaInitializer
51 | end
52 | INIT
53 |
54 | create_file destination_root('lib/barista_init.rb'), COFFEE
55 | inject_into_file destination_root('app/app.rb'), APP_INIT, :after => "enable :sessions\n"
56 | require_dependencies 'barista', :group => :development
57 |
--------------------------------------------------------------------------------
/plugins/heroku_plugin.rb:
--------------------------------------------------------------------------------
1 | # Prepare app for deployment to Heroku by configuring production database,
2 | # adding required gem dependencies and adding a Rakefile with Padrino tasks.
3 | #
4 | # Based on information from http://www.padrinorb.com/guides/blog-tutorial
5 |
6 | RAKEFILE = <<-RAKEFILE
7 | require File.dirname(__FILE__) + '/config/boot.rb'
8 | require 'thor'
9 | require 'padrino-core/cli/rake'
10 |
11 | PadrinoTasks.init
12 | RAKEFILE
13 |
14 | create_file "Rakefile", RAKEFILE
15 |
16 | AR_CONFIG = <<-AR_CONFIG
17 | postgres = URI.parse(ENV['DATABASE_URL'] || '')
18 | ActiveRecord::Base.configurations[:production] = {
19 | :adapter => 'postgresql',
20 | :encoding => 'utf8',
21 | :database => postgres.user,
22 | :username => postgres.user,
23 | :password => postgres.password,
24 | :host => postgres.host
25 | }
26 | AR_CONFIG
27 |
28 | CMPASS = <<-CMPS
29 | Sass::Plugin.options[:never_update] = true if Padrino.env == :production
30 |
31 | CMPS
32 |
33 | orm = fetch_component_choice(:orm)
34 | css = fetch_component_choice(:stylesheet)
35 |
36 | adapter = case orm
37 | when 'activerecord' then 'pg'
38 | when 'datamapper' then 'dm-postgres-adapter'
39 | end
40 |
41 | append_file("Gemfile", "\n# Heroku\ngem '#{adapter}', :group => :production") if adapter
42 |
43 | case orm
44 | when 'datamapper', 'sequel'
45 | gsub_file "config/database.rb", /\"sqlite.*production.*/, "ENV['DATABASE_URL'])"
46 | when 'activerecord'
47 | gsub_file "config/database.rb", /^.+production.*\{(\n\s+\:.*){2}\n\s\}/, AR_CONFIG
48 | else
49 | say "Remember to configure your production database, if necessary.", :yellow
50 | end
51 |
52 | if css == 'compass'
53 | inject_into_file destination_root('lib/compass_plugin.rb'), CMPASS, :before => " Compass.configure_sass_plugin!"
54 | end
55 |
56 | if (val = css.match(/scss|sass/))
57 | inject_into_file destination_root("lib/#{val[0]}_init.rb"), CMPASS.gsub(/^ /,''), :before => "app.use Sass::Plugin::Rack"
58 | end
59 |
--------------------------------------------------------------------------------
/plugins/disqus_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Template to get Disqus on Padrino
3 | # prereqs:
4 | # sudo gem install disqus
5 | # http://github.com/norman/disqus
6 | # NOTE:
7 | # please see the readme of disqus for additional setup info.
8 | #
9 | DISQUS = <<-DISQUS
10 | # Configure it
11 | #
12 | # Disqus::defaults[:account] = "my_disqus_account"
13 | #
14 | # Optional, only if you're using the API Disqus::defaults[:api_key] = "my_disqus_api_key"
15 | #
16 | # Show the comment threads widget on a post page
17 | #
18 | # Loads the commenting system
19 | # disqus_thread
20 | #
21 | # # Sets the inner html to the comment count for any links on the page that
22 | # # have the anchor "disqus_thread". For example, "View Comments" below would
23 | # # be replaced by "1 comment" or "23 comments" etc.
24 | # # View Comments
25 | # # View Comments
26 | # disqus_comment_counts
27 | #
28 | # Show the combo widget on a post page
29 | #
30 | # disqus_combo(:color => "blue", :hide_mods => false, :num_items => 20)
31 | #
32 | # Show the comment count on a permalink
33 | #
34 | # link_to("Permalink", url(:posts, :id => @post, :anchor => "disqus_thread"))
35 | # disqus_comment_counts
36 | #
37 | Disqus.defaults.update({
38 | :api_key => "", # your api key
39 | :account => "", # your disqus account
40 | :developer => Padrino.env == :development, # allows threads to work on localhost
41 | :container_id => 'disqus_thread', # desired thread container
42 | :avatar_size => 48, # squared pixel size of avatars
43 | :color => "grey", # theme color: ["blue", "grey", "green", "red", "orange"]
44 | :default_tab => "popular", # default widget tab
45 | :hide_avatars => false, # hide or show avatars
46 | :hide_mods => true, # hide or show moderation
47 | :num_items => 15, # number of comments to display
48 | :show_powered_by => true, # show or hide powered by line
49 | :orientation => "horizontal" # comment orientation
50 | })
51 | DISQUS
52 | require_dependencies 'disqus'
53 | initializer :disqus, DISQUS
--------------------------------------------------------------------------------
/templates/angular_template.rb:
--------------------------------------------------------------------------------
1 | # Template for an AngularJS app. It uses bower to manage your frontend resources.
2 | opts = options.dup
3 | opts.delete :template
4 | project opts.merge(renderer: :slim)
5 | #, stylesheet: :scss, orm: :sequel, adapter: :postgres
6 |
7 | # Default routes
8 | APP_INIT = <<-APP
9 | get :index do
10 | @title = 'Index'
11 | @ng_app = "app"
12 |
13 | render :index
14 | end
15 | APP
16 | inject_into_file 'app/app.rb', APP_INIT, before: "#\n end\n"
17 |
18 | # App server
19 | inject_into_file 'Gemfile', "gem 'puma'", after: "# Server requirements\n"
20 |
21 |
22 | # Create index.slim
23 | INDEX = <<-INDEX
24 | h1 Numbers
25 | ol ng-controller="MyController"
26 | li ng-repeat="number in numbers" I'm {{ number }} :)
27 |
28 | - content_for :head do
29 | -#= stylesheet_link_tag :app
30 |
31 | - content_for :body do
32 | = javascript_include_tag :'/components/angular/angular.min', :app, defer: true
33 | INDEX
34 | create_file 'app/views/index.slim', INDEX
35 |
36 | APPLICATION = <<-LAYOUT
37 | doctype html
38 | html
39 | head
40 | meta[charset="utf-8"]
41 | meta[http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"]
42 | title = @title
43 | meta[name="viewport" content="width=device-width, initial-scale=1.0"]
44 | meta[name="author" content=""]
45 | meta[name="description" content=""]
46 | = stylesheet_link_tag '/components/normalize-css/normalize', :app
47 | = yield_content :head
48 | body ng-app="\#{@ng_app}"
49 | = yield
50 | = yield_content :body
51 | LAYOUT
52 | create_file 'app/views/layouts/application.slim', APPLICATION
53 |
54 | # Create app.js
55 | APP = <<-APP
56 | !function() {
57 | var app = angular.module('app', []);
58 |
59 | app.controller('MyController', function($scope) {
60 | $scope.numbers = [1,2,3,4,5];
61 | });
62 | }(window);
63 | APP
64 | create_file 'public/javascripts/app.js', APP
65 |
66 | # Create NPM's package.json
67 | PACKAGE = <<-PACKAGE
68 | {
69 | "name": "app",
70 | "version": "0.0.1",
71 | "dependencies": {
72 | "bower": "*"
73 | }
74 | }
75 | PACKAGE
76 | create_file 'public/package.json', PACKAGE
77 |
78 | # Create bower.json
79 | BOWER = <<-BOWER
80 | {
81 | "name": "app",
82 | "version": "0.0.1",
83 | "dependencies": {
84 | "normalize-css": "latest",
85 | "angular": "PatternConsulting/bower-angular"
86 | }
87 | }
88 | BOWER
89 | create_file 'public/bower.json', BOWER
90 |
91 | # Ignore npm/bower specific stuff
92 | IGNORE = <<-IGNORE
93 | public/node_modules
94 | public/components/**/*.*
95 | !public/components/**/*[.|-]min.*
96 | # Custom ignore excludes for libs that don't follow the .min or -min convention
97 | !public/components/normalize-css/normalize.css
98 | IGNORE
99 | append_file '.gitignore', IGNORE
100 |
101 | # TODO Fix. For some reason npm install --dev fails here if I only set devDependencies in package.json
102 | system "cd #{destination_root}/public && npm install"
103 | system "cd #{destination_root}/public && ./node_modules/bower/bin/bower install --save"
104 |
--------------------------------------------------------------------------------
/plugins/carrierwave_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Carrierwave plugin for Padrino
3 | # sudo gem install carrierwave
4 | # http://github.com/jnicklas/carrierwave
5 | #
6 | UPLOADER = <<-UPLOADER
7 | class Uploader < CarrierWave::Uploader::Base
8 |
9 | ##
10 | # Image manipulator library:
11 | #
12 | # include CarrierWave::RMagick
13 | # include CarrierWave::ImageScience
14 | # include CarrierWave::MiniMagick
15 |
16 | ##
17 | # Storage type
18 | #
19 | storage :file
20 | # configure do |config|
21 | # config.fog_credentials = {
22 | # :provider => 'XXX',
23 | # :aws_access_key_id => 'YOUR_ACCESS_KEY',
24 | # :aws_secret_access_key => 'YOUR_SECRET_KEY'
25 | # }
26 | # config.fog_directory = 'YOUR_BUCKET'
27 | # end
28 | # storage :fog
29 |
30 |
31 |
32 | ## Manually set root
33 | def root; File.join(Padrino.root,"public/"); end
34 |
35 | ##
36 | # Directory where uploaded files will be stored (default is /public/uploads)
37 | #
38 | def store_dir
39 | 'images/uploads'
40 | end
41 |
42 | ##
43 | # Directory where uploaded temp files will be stored (default is [root]/tmp)
44 | #
45 | def cache_dir
46 | Padrino.root("tmp")
47 | end
48 |
49 | ##
50 | # Default URL as a default if there hasn't been a file uploaded
51 | #
52 | # def default_url
53 | # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
54 | # end
55 |
56 | ##
57 | # Process files as they are uploaded.
58 | #
59 | # process :resize_to_fit => [740, 580]
60 |
61 | ##
62 | # Create different versions of your uploaded files
63 | #
64 | # version :header do
65 | # process :resize_to_fill => [940, 250]
66 | # version :thumb do
67 | # process :resize_to_fill => [230, 85]
68 | # end
69 | # end
70 | ##
71 | # White list of extensions which are allowed to be uploaded:
72 | #
73 | def extension_white_list
74 | %w(jpg jpeg gif png)
75 | end
76 |
77 | ##
78 | # Override the filename of the uploaded files
79 | #
80 | # def filename
81 | # "something.jpg" if original_filename
82 | # end
83 | end
84 | UPLOADER
85 | create_file destination_root('lib/uploader.rb'), UPLOADER
86 | generate :model, "upload file:text created_at:datetime"
87 |
88 | case fetch_component_choice(:orm)
89 | when 'mini_record'
90 | prepend_file destination_root('models/upload.rb'), "require 'carrierwave/orm/activerecord'\n"
91 | when 'datamapper'
92 | prepend_file destination_root('models/upload.rb'), "require 'carrierwave/datamapper'\n"
93 | inject_into_file destination_root('models/upload.rb'),", :auto_validation => false\n", :after => "property :file, Text"
94 | require_dependencies 'carrierwave-datamapper', :require => 'carrierwave/datamapper'
95 | when 'mongoid'
96 | require_dependencies 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
97 | when 'sequel'
98 | require_dependencies 'carrierwave-sequel', :require => 'carrierwave/sequel'
99 | else
100 | prepend_file destination_root('models/upload.rb'), "require 'carrierwave/orm/#{fetch_component_choice(:orm)}'\n"
101 | end
102 |
103 | require_dependencies 'carrierwave'
104 | inject_into_file destination_root('models/upload.rb')," mount_uploader :file, Uploader\n", :before => 'end'
105 |
--------------------------------------------------------------------------------
/plugins/dreamhost_plugin.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # A Plugin to prepare a Padrino app for deployment to www.dreamhost.com
3 | # With this version of plugin, you now use any version of ruby (mri)
4 | # into your dreamhost shared hosting (yes you now use also ruby 1.9.x !! yeahhh)
5 | #
6 | # IMPORTANT !!!
7 | #
8 | # To use a different ruby version, you need to install rbenv into your shell account
9 | # (i've' tested only rbenv, sorry)
10 | #
11 | # HOW TO INSTALL RBENV:
12 | #
13 | # full code: http://git.io/jLwG7g
14 | #
15 | # THANKS TO @micahchalmer !!!!
16 | # Initial setup for Ruby 1.9.3 on DreamHost shared hosting.
17 | # We assume you're already in your project's root directory, which should
18 | # also be the directory configured as "web directory" for your domain
19 | # in the DreamHost panel.
20 | #
21 | #
22 | # Install rbenv and ruby-build
23 | # $ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
24 | # $ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
25 | #
26 | # Create temporary directory--DreamHost does not allow files in /tmp to be
27 | # executed, which makes the default not work
28 | # $ mkdir ~/.rbenv/BUILD_TEMP
29 | #
30 | # DreamHost will set your GEM_HOME and GEM_PATH for you, but this conflicts
31 | # with rbenv, so we unset them here. You'll want to do this in your .bashrc
32 | # on the dreamhost account.
33 | # $ unset GEM_HOME
34 | # $ unset GEM_PATH
35 | #
36 | # Add rbenv to PATH and let it set itself up.
37 | # You probably want these two lines in your .bashrc as well:
38 | # $ export PATH=~/.rbenv/bin:"$PATH"
39 | # $ eval "$(~/.rbenv/bin/rbenv init -)"
40 | #
41 | # Decide which version of Ruby we're going to install and use.
42 | # $ NEW_RUBY_VERSION=1.9.3-p385
43 | #
44 | # Using that as the temp space, build and install ruby 1.9.3
45 | # $ TMPDIR=~/.rbenv/BUILD_TEMP rbenv install $NEW_RUBY_VERSION
46 | #
47 | # Now everything is set up properly, you should be able to set your
48 | # directory to use the new ruby:
49 | # $ rbenv local $NEW_RUBY_VERSION
50 | #
51 | # Bundler doesn't come with ruby, so install it first:
52 | # $ gem install bundler
53 | #
54 | # Then use it to install the rest of your gems:
55 | # $ bundle install
56 | #
57 | # Change value of use_rbenv to true into dispatch.fcgi
58 | #
59 | # Don't forget to make your dispatch.fcgi world-executable but not world-writable by executing
60 | # replace PADRINO_ROOT with real path of application
61 | # $ chmod 755 PADRINO_ROOT/public/dispatch.fcgi
62 |
63 | DISPATCH_FCGI = <<-DFCGI
64 | #!/bin/bash
65 | use_rbenv=false
66 | padrino_dir=`pwd`
67 | padrino_dir=${padrino_dir/public/}
68 | err_log_file="${padrino_dir}/log/dispatch_err.log"
69 |
70 | if $use_rbenv ; then
71 | unset GEM_HOME
72 | unset GEM_PATH
73 | export PATH=~/.rbenv/bin:"$PATH"
74 | eval "$(~/.rbenv/bin/rbenv init -)"
75 | exec ~/.rbenv/shims/ruby "${padrino_dir}public/dispatch_fcgi.rb" "$@" 2>>"${err_log_file}"
76 | else
77 | padrino_dir=`pwd`
78 | err_log_file="${padrino_dir}/log/dispatch_err.log"
79 | export GEM_HOME=~/.gems
80 | export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
81 | export PATH="$GEM_HOME/bin:$PATH"
82 | exec ruby "${padrino_dir}/dispatch_fcgi.rb" "$@" 2>>"${err_log_file}"
83 | fi
84 | DFCGI
85 |
86 | DISPATCH_FCGIRB = <<-DFCGIRB
87 | ENV['PADRINO_ENV'] ||= 'production'
88 | require File.expand_path("../../config/boot.rb", __FILE__)
89 | Rack::Handler::FastCGI.run(Padrino.application)
90 | DFCGIRB
91 |
92 | DOT_HTACCESS = <<-DHTX
93 |
94 | AddHandler fastcgi-script .fcgi
95 |
96 |
97 | AddHandler fcgid-script .fcgi
98 |
99 |
100 | Options +FollowSymLinks +ExecCGI
101 |
102 | RewriteEngine On
103 |
104 | RewriteCond %{REQUEST_FILENAME} !-f
105 | RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
106 | DHTX
107 |
108 | create_file destination_root('public/dispatch.fcgi'), DISPATCH_FCGI
109 | create_file destination_root('public/dispatch_fcgi.rb'), DISPATCH_FCGIRB
110 | create_file destination_root('public/.htaccess'), DOT_HTACCESS
111 |
112 | unless File.read('Gemfile').include?('fcgi')
113 | inject_into_file destination_root('Gemfile'), "\n# DreamHost.com requirements\ngem 'fcgi'\n", :after => "source :rubygems\n"
114 | end
115 |
116 | require_dependencies 'fcgi'
117 |
118 | shell.say ""
119 | shell.say "Don't forget to make your dispatch.fcgi world-executable but not world-writable by executing"
120 | shell.say "$ chmod 755 PADRINO_ROOT/public/dispatch.fcgi"
121 | shell.say ""
122 | shell.say "IMPORTANT:"
123 | shell.say "If you need to use a different ruby version, see this source code rogit"
124 | shell.say "http://git.io/jLwG7g"
125 | shell.say "and change value of use_rbenv to true into dispatch.fcgi"
126 | shell.say ""
127 |
--------------------------------------------------------------------------------
/templates/lipsiasoft_template.rb:
--------------------------------------------------------------------------------
1 | # We generate a basic project
2 | say
3 | dev = yes?("Are you using padrino-dev?").present?
4 | tiny = yes?("Do you need a tiny structure?").present?
5 | adapter = ask("SQL adapter for ActiveRecord (sqlite, mysql, postgres, none):")
6 |
7 | project :test => :none, :renderer => :haml, :script => :jquery, :orm => :activerecord, :dev => dev, :tiny => tiny, :adapter => adapter
8 |
9 | say "=> Installing exception notifier", :magenta
10 | execute_runner :plugin, :exception_notifier
11 |
12 | say
13 | exception_subject = ask("Tell me the subject of the exception email", fetch_app_name)
14 | exception_from = ask("Tell me the sender of the email", "exceptions@lipsiasoft.com")
15 | exception_to = ask("Tell me the recipient email", "help@lipsiasoft.com")
16 |
17 | exception_tpl = <<-RUBY
18 | set :exceptions_subject, "#{exception_subject}"
19 | set :exceptions_from, "#{exception_from}"
20 | set :exceptions_to, "#{exception_to}"
21 | set :exceptions_page, "#{'base/' unless tiny?}errors"
22 | RUBY
23 |
24 | say
25 | if yes?("Do you want configure exception notifier for redmine?")
26 | redmine_project = ask("Tell me the redmine project", "lipsiabug")
27 | redmine_tracker = ask("Tell me the redmine tracker", "bug")
28 | redmine_assigned = ask("Tell me what account we assign the issue", "s.crespi")
29 | exception_tpl += "\n set :redmine, { :project => \"#{redmine_project}\", :tracker => \"#{redmine_tracker}\", :assigned => \"#{redmine_assigned}\" }"
30 | end
31 |
32 | exception_tpl += "\n"
33 |
34 | inject_into_file "app/app.rb", exception_tpl, :after => "Padrino::Contrib::ExceptionNotifier\n"
35 |
36 | say "Need to check and install padrino-contrib", :yellow
37 | run_bundler # We need to install padrino-contrib
38 |
39 | say
40 | if yes?("Do you need permalinks?")
41 | execute_runner :plugin, :ar_permalink
42 | end
43 |
44 | say
45 | if yes?("Do you need a textile support?")
46 | execute_runner :plugin, :ar_textile
47 | say "Need to check and install RedCloth", :yellow
48 | run_bundler # We use redcloth so we need to install it.
49 | end
50 |
51 | say
52 | if yes?("Do you want install carrierwave?")
53 | execute_runner :plugin, :carrierwave
54 | say "Need to check and install CarrierWave", :yellow
55 | run_bundler # We need to install carrierwave & c. without that we can bootstrap our app and generate other components
56 | end
57 |
58 | say
59 | if yes?("Would you like to generate the padrino admin?")
60 | generate :admin
61 | inject_into_file "admin/app.rb", exception_tpl, :after => "Padrino::Application\n"
62 | end
63 |
64 | say
65 | if yes?("Would you like to generate the basic frontend?")
66 | execute_runner :plugin, "960"
67 |
68 | helpers_tpl = <<-RUBY
69 | def key_density(*words)
70 | words.compact.join(" ").concat(" - Padrino Ruby Web Framework").gsub(/^ - /, '')
71 | end
72 |
73 | def title(*words)
74 | @_title = key_density(*words) if words.present?
75 | @_title
76 | end
77 |
78 | def description(text=nil)
79 | @_description = truncate(text.gsub(/<\\/?[^>]*>/, '').gsub(/\\n/, ' ').strip, :length => 355) if text.present?
80 | @_description || (<<-TXT).gsub(/ {6}/, '').gsub(/\\n/, ' ').strip
81 | Padrino is a ruby framework built upon the excellent Sinatra Microframework.
82 | This framework tries hard to make it as fun and easy as possible to code much more advanced web
83 | applications by building upon the Sinatra philosophies and foundation.
84 | TXT
85 | end
86 | RUBY
87 |
88 | route_tpl = <<-RUBY
89 | get :index, :map => "/" do
90 | render "#{'base/' unless tiny?}index"
91 | end
92 | RUBY
93 |
94 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/base.css", "public/stylesheets/base.css"
95 |
96 | if tiny?
97 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/errors.haml", "app/views/errors.haml"
98 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/layout.haml", "app/views/layout.haml"
99 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/index.haml", "app/views/index.haml"
100 | inject_into_file "app/helpers.rb", helpers_tpl, :after => "helpers do\n"
101 | inject_into_file "app/controllers.rb", route_tpl, :after => "controllers do\n"
102 | inject_into_file "app/app.rb", " layout :layout\n", :after => "Padrino::Application\n"
103 | else
104 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/errors.haml", "app/views/base/errors.haml"
105 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/layout.haml", "app/views/layouts/application.haml"
106 | generate :controller, "base"
107 | get "https://github.com/padrino/padrino-recipes/raw/master/files/lipsiasoft/index.haml", "app/views/base/index.haml"
108 | inject_into_file "app/controllers/base.rb", route_tpl, :after => "controllers :base do\n"
109 | create_file "app/helpers/base.rb", "#{fetch_app_name("/app")}.helpers do\n#{helpers_tpl}\nend"
110 | end
111 | end
112 |
113 | say
114 | if yes?("Your database connection is correct (if yes we run migrations and seeds)?")
115 | rake "ar:create ar:migrate seed"
116 | end
117 |
118 | exit
--------------------------------------------------------------------------------
/templates/sampleblog_template.rb:
--------------------------------------------------------------------------------
1 | # Template for Sample Blog tutorial at http://www.padrinorb.com/guides/blog-tutorial
2 | project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord
3 |
4 | # Default routes
5 | APP_INIT = <<-APP
6 | get "/" do
7 | "Hello World!"
8 | end
9 |
10 | get :about, :map => '/about_us' do
11 | render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!"
12 | end
13 | APP
14 | inject_into_file 'app/app.rb', APP_INIT, :before => "#\n end\n"
15 |
16 | # Generating padrino admin
17 | inject_into_file 'Gemfile', "gem 'bcrypt-ruby', :require => 'bcrypt'\n", :after => "# Component requirements\n"
18 | run_bundler
19 | generate :admin
20 | rake "ar:create ar:migrate seed"
21 |
22 | # appending timestamps to post model
23 | generate :model, "post title:string body:text"
24 | inject_into_file 'db/migrate/002_create_posts.rb'," t.timestamps\n",:after => "t.text :body\n"
25 | rake 'ar:migrate'
26 |
27 | # Generating posts controller
28 | generate :controller, "posts get:index get:show"
29 | gsub_file('app/controllers/posts.rb', /^\s+\#\s+.*\n/,'')
30 | POST_INDEX_ROUTE = <<-POST
31 | @posts = Post.all.order('created_at desc')
32 | render 'posts/index'
33 | POST
34 | POST_SHOW_ROUTE = <<-POST
35 | @post = Post.find_by_id(params[:id])
36 | render 'posts/show'
37 | POST
38 | inject_into_file 'app/controllers/posts.rb', POST_INDEX_ROUTE, :after => "get :index do\n"
39 | inject_into_file 'app/controllers/posts.rb', POST_SHOW_ROUTE, :after => "get :show do\n"
40 | inject_into_file 'app/controllers/posts.rb', ", :with => :id", :after => "get :show" # doesn't run?
41 |
42 | # Generate admin_page for post
43 | generate :admin_page, "post"
44 |
45 | # Migrations to add account to post
46 | generate :migration, "AddAccountToPost account_id:integer"
47 |
48 | # Update Post Model with Validations and Associations
49 | POST_MODEL = <<-POST
50 | belongs_to :account
51 | validates_presence_of :title
52 | validates_presence_of :body
53 | POST
54 | inject_into_file 'models/post.rb', POST_MODEL, :after => "ActiveRecord::Base\n"
55 | rake 'ar:migrate'
56 |
57 | # Update admin app controller for post
58 | inject_into_file 'admin/controllers/posts.rb'," @post.account = current_account\n",:after => "new(params[:post])\n"
59 |
60 | # Include RSS Feed
61 | inject_into_file 'app/controllers/posts.rb', ", :provides => [:html, :rss, :atom]", :after => "get :index"
62 |
63 | # Create index.haml
64 | POST_INDEX = <<-POST
65 | - @title = "Welcome"
66 |
67 | - content_for :include do
68 | = feed_tag(:rss, url(:posts, :index, :format => :rss),:title => "RSS")
69 | = feed_tag(:atom, url(:posts, :index, :format => :atom),:title => "ATOM")
70 |
71 | #posts= partial 'posts/post', :collection => @posts
72 | POST
73 | create_file 'app/views/posts/index.haml', POST_INDEX
74 |
75 | # Create _post.haml
76 | POST_PARTIAL = <<-POST
77 | .post
78 | .title= link_to post.title, url_for(:posts, :show, :id => post)
79 | .date= time_ago_in_words(post.created_at || Time.now) + ' ago'
80 | .body= simple_format(post.body)
81 | .details
82 | .author Posted by \#{post.account.email}
83 | POST
84 | create_file 'app/views/posts/_post.haml', POST_PARTIAL
85 |
86 | # Create show.haml
87 | POST_SHOW = <<-POST
88 | - @title = @post.title
89 | #show
90 | .post
91 | .title= @post.title
92 | .date= time_ago_in_words(@post.created_at || Time.now) + ' ago'
93 | .body= simple_format(@post.body)
94 | .details
95 | .author Posted by \#{@post.account.email}
96 | %p= link_to 'View all posts', url_for(:posts, :index)
97 | POST
98 | create_file 'app/views/posts/show.haml', POST_SHOW
99 |
100 | APPLICATION = <<-LAYOUT
101 | !!! Strict
102 | %html
103 | %head
104 | %title= [@title, "Padrino Sample Blog"].compact.join(" | ")
105 | = stylesheet_link_tag 'reset', 'application'
106 | = javascript_include_tag 'jquery', 'application'
107 | = yield_content :include
108 | %body
109 | #header
110 | %h1 Sample Padrino Blog
111 | %ul.menu
112 | %li= link_to 'Blog', url_for(:posts, :index)
113 | %li= link_to 'About', url_for(:about)
114 | #container
115 | #main= yield
116 | #sidebar
117 | = form_tag url_for(:posts, :index), :method => 'get' do
118 | Search for:
119 | = text_field_tag 'query', :value => params[:query]
120 | = submit_tag 'Search'
121 | %p Recent Posts
122 | %ul.bulleted
123 | %li Item 1 - Lorem ipsum dolorum itsum estem
124 | %li Item 2 - Lorem ipsum dolorum itsum estem
125 | %li Item 3 - Lorem ipsum dolorum itsum estem
126 | %p Categories
127 | %ul.bulleted
128 | %li Item 1 - Lorem ipsum dolorum itsum estem
129 | %li Item 2 - Lorem ipsum dolorum itsum estem
130 | %li Item 3 - Lorem ipsum dolorum itsum estem
131 | %p Latest Comments
132 | %ul.bulleted
133 | %li Item 1 - Lorem ipsum dolorum itsum estem
134 | %li Item 2 - Lorem ipsum dolorum itsum estem
135 | %li Item 3 - Lorem ipsum dolorum itsum estem
136 | #footer
137 | Copyright (c) 2009-2010 Padrino
138 | LAYOUT
139 | create_file 'app/views/layouts/application.haml', APPLICATION
140 |
141 | get 'https://github.com/padrino/sample_blog/raw/master/public/stylesheets/reset.css', 'public/stylesheets/reset.css'
142 | get "https://github.com/padrino/sample_blog/raw/master/app/stylesheets/application.sass", 'app/stylesheets/application.sass'
143 |
--------------------------------------------------------------------------------
/templates/sampleblog_dm_template.rb:
--------------------------------------------------------------------------------
1 | # Template for Sample Blog tutorial at http://www.padrinorb.com/guides/blog-tutorial but using datamapper
2 | project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :datamapper
3 |
4 | # Default routes
5 | APP_INIT = <<-APP
6 | get "/" do
7 | "Hello World!"
8 | end
9 |
10 | get :about, :map => '/about_us' do
11 | render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!"
12 | end
13 | APP
14 | inject_into_file 'app/app.rb', APP_INIT, :before => "#\n end\n"
15 |
16 | # Generating padrino admin
17 | inject_into_file 'Gemfile', "gem 'bcrypt-ruby', :require => 'bcrypt'\n", :after => "# Component requirements\n"
18 | run_bundler
19 | generate :admin
20 | rake "dm:create dm:migrate seed"
21 |
22 | # appending timestamps to post model
23 | generate :model, "post title:string body:text created_at:datetime updated_at:datetime"
24 | inject_into_file 'db/migrate/002_create_posts.rb'," t.timestamps\n",:after => "t.text :body\n"
25 | rake 'dm:migrate'
26 |
27 | # Generating posts controller
28 | generate :controller, "posts get:index get:show"
29 | gsub_file('app/controllers/posts.rb', /^\s+\#\s+.*\n/,'')
30 | POST_INDEX_ROUTE = <<-POST
31 | @posts = Post.all(:order => :created_at.desc)
32 | render 'posts/index'
33 | POST
34 | POST_SHOW_ROUTE = <<-POST
35 | @post = Post.get(params[:id])
36 | render 'posts/show'
37 | POST
38 | inject_into_file 'app/controllers/posts.rb', POST_INDEX_ROUTE, :after => "get :index do\n"
39 | inject_into_file 'app/controllers/posts.rb', POST_SHOW_ROUTE, :after => "get :show do\n"
40 | inject_into_file 'app/controllers/posts.rb', ", :with => :id", :after => "get :show" # doesn't run?
41 |
42 | # Generate admin_page for post
43 | generate :admin_page, "post"
44 |
45 | # Migrations to add account to post
46 | generate :migration, "AddAccountToPost account_id:integer"
47 |
48 | # Update Post Model with Validations and Associations
49 | POST_MODEL = <<-POST
50 | belongs_to :account
51 | validates_presence_of :title
52 | validates_presence_of :body
53 | POST
54 | inject_into_file 'models/post.rb', POST_MODEL, :after => "DataMapper::Resource\n"
55 | rake 'dm:migrate'
56 |
57 | # Update admin app controller for post
58 | inject_into_file 'admin/controllers/posts.rb'," @post.account = current_account\n",:after => "new(params[:post])\n"
59 |
60 | # Include RSS Feed
61 | inject_into_file 'app/controllers/posts.rb', ", :provides => [:html, :rss, :atom]", :after => "get :index"
62 |
63 | # Create index.haml
64 | POST_INDEX = <<-POST
65 | - @title = "Welcome"
66 |
67 | - content_for :include do
68 | = feed_tag(:rss, url(:posts, :index, :format => :rss),:title => "RSS")
69 | = feed_tag(:atom, url(:posts, :index, :format => :atom),:title => "ATOM")
70 |
71 | #posts= partial 'posts/post', :collection => @posts
72 | POST
73 | create_file 'app/views/posts/index.haml', POST_INDEX
74 |
75 | # Create _post.haml
76 | POST_PARTIAL = <<-POST
77 | .post
78 | .title= link_to post.title, url_for(:posts, :show, :id => post.id)
79 | .date= time_ago_in_words(post.created_at || Time.now) + ' ago'
80 | .body= simple_format(post.body)
81 | .details
82 | .author Posted by \#{post.account.name}
83 | POST
84 | create_file 'app/views/posts/_post.haml', POST_PARTIAL
85 |
86 | # Create show.haml
87 | POST_SHOW = <<-POST
88 | - @title = @post.title
89 | #show
90 | .post
91 | .title= @post.title
92 | .date= time_ago_in_words(@post.created_at || Time.now) + ' ago'
93 | .body= simple_format(@post.body)
94 | .details
95 | .author Posted by \#{@post.account.name}
96 | %p= link_to 'View all posts', url_for(:posts, :index)
97 | POST
98 | create_file 'app/views/posts/show.haml', POST_SHOW
99 |
100 | APPLICATION = <<-LAYOUT
101 | !!! Strict
102 | %html
103 | %head
104 | %title= [@title, "Padrino Sample Blog"].compact.join(" | ")
105 | = stylesheet_link_tag 'reset', 'application'
106 | = javascript_include_tag 'jquery', 'application'
107 | = yield_content :include
108 | %body
109 | #header
110 | %h1 Sample Padrino Blog
111 | %ul.menu
112 | %li= link_to 'Blog', url_for(:posts, :index)
113 | %li= link_to 'About', url_for(:about)
114 | #container
115 | #main= yield
116 | #sidebar
117 | = form_tag url_for(:posts, :index), :method => 'get' do
118 | Search for:
119 | = text_field_tag 'query', :value => params[:query]
120 | = submit_tag 'Search'
121 | %p Recent Posts
122 | %ul.bulleted
123 | %li Item 1 - Lorem ipsum dolorum itsum estem
124 | %li Item 2 - Lorem ipsum dolorum itsum estem
125 | %li Item 3 - Lorem ipsum dolorum itsum estem
126 | %p Categories
127 | %ul.bulleted
128 | %li Item 1 - Lorem ipsum dolorum itsum estem
129 | %li Item 2 - Lorem ipsum dolorum itsum estem
130 | %li Item 3 - Lorem ipsum dolorum itsum estem
131 | %p Latest Comments
132 | %ul.bulleted
133 | %li Item 1 - Lorem ipsum dolorum itsum estem
134 | %li Item 2 - Lorem ipsum dolorum itsum estem
135 | %li Item 3 - Lorem ipsum dolorum itsum estem
136 | #footer
137 | Copyright (c) 2009-2010 Padrino
138 | LAYOUT
139 | create_file 'app/views/layouts/application.haml', APPLICATION
140 |
141 | get 'https://github.com/padrino/sample_blog/raw/master/public/stylesheets/reset.css', 'public/stylesheets/reset.css'
142 | get "https://github.com/padrino/sample_blog/raw/master/app/stylesheets/application.sass", 'app/stylesheets/application.sass'
143 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Preface
2 |
3 | Padrino is a Ruby framework built upon the excellent [Sinatra Microframework](http://www.sinatrarb.com). Sinatra is a
4 | DSL for creating simple web applications in Ruby with speed and minimal effort. This framework tries hard to make it as
5 | fun and easy as possible to code much more advanced web applications by building upon the Sinatra philosophies and
6 | foundation.
7 |
8 |
9 | The recipes consists of two types: *plugins* and *templates*. A plugin adds additional functionality to an existing
10 | Padrino project. A template can be used as a template for a completely new Padrino application.
11 |
12 |
13 | ## Plugins
14 |
15 | To run a plugin:
16 |
17 | ```sh
18 | $ cd
19 | $ padrino-gen plugin
20 | ```
21 |
22 |
23 | - 960: Installs the [960 grid system](https://github.com/nathansmith/960-Grid-System)
24 | - access: Access Plugin via [rack-contrib](http://github.com/rack/rack-contrib/)
25 | - ar\_permalink: Generate permalink for a specified column on ActiveRecord.
26 | - ar\_permalink\_i18n: Generate permalink for a specified multi language column(s) on ActiveRecord.
27 | - ar\_translate: Translate for you your ActiveRecord columns.
28 | - auto\_locale: Switch the I18n.locale automatically based on the URL.
29 | - barista: Simple, transparent [CoffeeScript](https://github.com/jashkenas/coffeescript) support.
30 | - bulma: [bulma](https://bulma.io "bulma") is an open source CSS framework based on Flexbox.
31 | - better\_errors: Install the [better_errors gem](https://github.com/charliesome/better_errors).
32 | - bootstrap: Install the latest [twitter bootstrap](https://github.com/twbs/bootstrap) files.
33 | - bug: (rack-bug)[http://github.com/brynary/rack-bug] debugging toolbar for Rack applications.
34 | - camorra: Install (ZURB Foundation 5 framework)[http://foundation.zurb.com/].
35 | - codehighlighter: Code highlighting via [rack-codehighlighter](https://github.com/wbzyl/rack-codehighlighter)
36 | - coffee: [CoffeeScript](https://github.com/jashkenas/coffeescript) plugin via [rack-coffee](https://github.com/mattly/rack-coffee).
37 | - deflect: Deflect (DOS protection) via [rack-contrib](http://github.com/rack/rack-contrib/).
38 | - disqus: [Disqus](https://disqus.com/) commenting system via [disqus gem](https://github.com/norman/disqus).
39 | - dreamhost: Deploy your app on [DreamHost](https://www.dreamhost.com/).
40 | - exception\_notifier: Send errors through mail or/and to [redmine](http://www.redmine.org/) via [exception_notifier](https://github.com/padrino/padrino-contrib/blob/master/lib/padrino-contrib/exception_notifier.rb).
41 | - factory\_girl: A [library](https://github.com/thoughtbot/factory_girl) for setting up Ruby objects as test data.
42 | - flash\_session: Middleware that help you in passing your session in the URI, when it should be in the cookie via [flash_session](https://github.com/padrino/padrino-contrib/blob/master/lib/padrino-contrib/flash_session.rb).
43 | - fontawesome: Installing [Font Awesome](https://github.com/FortAwesome/Font-Awesome).
44 | - goatmail: Preview mail in the browser under `/inbox` in development mode with [goatmail](https://github.com/tyabe/goatmail).
45 | - googleanalytics: [Google Analytics](https://analytics.google.com/) via [rack-google-analytic](https://github.com/kangguru/rack-google-analytics).
46 | - heroku: Prepare app for deployment to [Heroku](https://heroku.com/).
47 | - hoptoad: [HopToad](https://github.com/thoughtbot/hoptoad_notifier) notification via rack_hoptoad](https://github.com/atmos/rack_hoptoad).
48 | - jammit: Add Asset Packaging via [jammit-sinatra](https://github.com/jacquescrocker/jammit-sinatra).
49 | - letter_opener: Preview mail in the browser instead of sending vim with [letter_opener](https://github.com/ryanb/letter_opener).
50 | - maintenance: Maintenance page plugin via [rack-maintenance](http://github.com/ddollar/rack-maintenance).
51 | - omniauth: Authentication Plugin for OAuth2, Facebook, Twitter, Campfire via [omniauth](https://github.com/intridea/omniauth/).
52 | - openid: [OpenID](http://openid.net/) authentication via [rack-openid](https://github.com/josh/rack-openid).
53 | - payment: Payment Plugin via [rack-payment](https://rubygems.org/gems/rack-payment/versions/0.1.4)
54 | - pry\_byebug: Use [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug) in Padrino. Use pry_debugger plugin for MRI 1.9.3 or older.
55 | - pry\_debugger: Use [pry-debugger](https://github.com/nixme/pry-debugger) in Padrino. Use pry_byebug plugin for MRI 2.0.0 or newer.
56 | - raphy\_charts: [Raphy Charts](https://github.com/jcarver989/raphy-charts) - a RaphaelJS based HTML5/SVG charts library.
57 | - recaptcha: CAPTCHA verification using RECAPTCHA API via [rack-recaptcha](https://github.com/achiu/rack-recaptcha).
58 | - resque: Add support for the [resque](https://github.com/resque/resque) redis based background worker.
59 | - rewrite: Rewrite Rules via [rack-rewrite](https://github.com/jtrupiano/rack-rewrite).
60 | - secure\_only: Run app on https via [rack-secure_only](https://github.com/spllr/rack-secure_only).
61 | - tripoli: Add [Tripoli CSS](http://monc.se/tripoli/).
62 | - twitter-login: Twitter Login Authentication via [twitter-login](https://github.com/mislav/twitter-login)
63 | - vcr: Add [vcr](https://github.com/vcr/vcr) to your test suite.
64 | - watchr: Generates [watchr](https://github.com/mynyml/watchr) test scripts.
65 | - will\_paginate: Add support for [will_paginate](https://github.com/mislav/will_paginate).
66 | - react-sinatra: Add support for [react-sinatra](https://github.com/namusyaka/react-sinatra).
67 |
68 |
69 | If you want to contribute with a plugin please follow the convention of having `_plugin` appended to the name (i.e.
70 | `bootstrap_plugin.rb`). Don't forget to put your plugin with a short explanation to the README here.
71 |
72 |
73 | ## Templates
74 |
75 | To run a template:
76 |
77 | ```sh
78 | $ padrino-gen project my_project --template [template_path]
79 | ```
80 |
81 | The [templates folder](https://github.com/padrino/padrino-recipes/tree/master/templates) contains full project generation templates.
82 | These files follow the convention of having *_template*
83 | appended to the name (i.e **sampleblog_template.rb**). Included template are:
84 |
85 |
86 | - angular: Template for an AngularJS app. It uses bower to manage your frontend resources.
87 | - lipsiasoft: template with haml/960/exception notifier and more used by [LipsiaSOFT](http://www.lipsiasoft.com).
88 | - mongochist: templates that generate mongoid/mongomapper with machinist.
89 | - sampleblog: [sample blog tutorial](http://padrinorb.com/guides/getting-started/blog-tutorial).
90 | - sampleblog_dm: [sample blog tutorial](http://padrinorb.com/guides/getting-started/blog-tutorial) with `DataMapper`
91 | instead of `ActiveRecord`.
92 |
93 |
94 | ## Broken plugins
95 |
96 | - ar\_textile: Full support to textile with ActiveRecord.
97 | - blueprint: Install the [blueprint grid system](https://github.com/joshuaclayton/blueprint-css).
98 | - carrierwave: Plugin for [Carrierwave](https://github.com/carrierwaveuploader/carrierwave).
99 | - coderay: Code Highlighting via [rack-coderay](https://github.com/rubychan/coderay).
100 | - raphaeljs: Add [RaphaelJS](https://github.com/DmitryBaranovskiy/raphael) libraries.
101 |
102 |
103 | ## Contribute
104 |
105 | Feel free to fork and add on to these recipes! Check out the [Padrino Framework](http://www.padrinorb.com) and its
106 | [git repo](http://github.com/padrino/padrino-framework).
107 |
--------------------------------------------------------------------------------
/plugins/camorra_plugin.rb:
--------------------------------------------------------------------------------
1 | # Add some style to Padrino. Plugin to install ZURB Foundation (v5.1.0.0) on Padrino
2 | #
3 | # Created by Felipe Cabargas
4 | # Master Plugin repository: github.com/felipecabargas/camorra
5 | # Copyleft please!
6 | #
7 | # SCSS
8 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation.scss", "app/stylesheets/foundation.scss"
9 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/normalize.scss", "app/stylesheets/normalize.scss"
10 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/_functions.scss", "app/stylesheets/foundation/_functions.scss"
11 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/_settings.scss", "app/stylesheets/foundation/_settings.scss"
12 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_accordion.scss", "app/stylesheets/foundation/components/_accordion.scss"
13 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_alert-boxes.scss", "app/stylesheets/foundation/components/_alert-boxes.scss"
14 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_block-grid.scss", "app/stylesheets/foundation/components/_block-grid.scss"
15 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_breadcrumbs.scss", "app/stylesheets/foundation/components/_breadcrumbs.scss"
16 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_button-groups.scss", "app/stylesheets/foundation/components/_button-groups.scss"
17 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_buttons.scss", "app/stylesheets/foundation/components/_clearing.scss"
18 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_clearing.scss", "app/stylesheets/foundation/components/_buttons.scss"
19 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_dropdown-buttons.scss", "app/stylesheets/foundation/components/_dropdown-buttons.scss"
20 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_dropdown.scss", "app/stylesheets/foundation/components/_dropdown.scss"
21 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_flex-video.scss", "app/stylesheets/foundation/components/_flex-video.scss"
22 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_forms.scss", "app/stylesheets/foundation/components/_forms.scss"
23 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_global.scss", "app/stylesheets/foundation/components/_global.scss"
24 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_grid.scss", "app/stylesheets/foundation/components/_grid.scss"
25 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_inline-lists.scss", "app/stylesheets/foundation/components/_inline-lists.scss"
26 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_joyride.scss", "app/stylesheets/foundation/components/_joyride.scss"
27 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_keystrokes.scss", "app/stylesheets/foundation/components/_keystrokes.scss"
28 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_labels.scss", "app/stylesheets/foundation/components/_labels.scss"
29 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_magellan.scss", "app/stylesheets/foundation/components/_magellan.scss"
30 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_offcanvas.scss", "app/stylesheets/foundation/components/_offcanvas.scss"
31 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_orbit.scss", "app/stylesheets/foundation/components/_orbit.scss"
32 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_pagination.scss", "app/stylesheets/foundation/components/_pagination.scss"
33 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_panels.scss", "app/stylesheets/foundation/components/_panels.scss"
34 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_pricing-tables.scss", "app/stylesheets/foundation/components/_pricing-tables.scss"
35 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_progress-bars.scss", "app/stylesheets/foundation/components/_progress-bars.scss"
36 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_range-slider.scss", "app/stylesheets/foundation/components/_range-slider.scss"
37 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_reveal.scss", "app/stylesheets/foundation/components/_reveal.scss"
38 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_side-nav.scss", "app/stylesheets/foundation/components/_side-nav.scss"
39 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_split-buttons.scss", "app/stylesheets/foundation/components/_split-buttons.scss"
40 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_sub-nav.scss", "app/stylesheets/foundation/components/_sub-nav.scss"
41 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_switch.scss", "app/stylesheets/foundation/components/_switch.scss"
42 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_tables.scss", "app/stylesheets/foundation/components/_tables.scss"
43 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_tabs.scss", "app/stylesheets/foundation/components/_tabs.scss"
44 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_thumbs.scss", "app/stylesheets/foundation/components/_thumbs.scss"
45 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_tooltips.scss", "app/stylesheets/foundation/components/_tooltips.scss"
46 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_top-bar.scss", "app/stylesheets/foundation/components/_top-bar.scss"
47 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_type.scss", "app/stylesheets/foundation/components/_visibility.scss"
48 | get "https://raw.github.com/felipecabargas/camorra/master/assets/scss/foundation/components/_visibility.scss", "app/stylesheets/foundation/components/_type.scss"
49 |
50 |
51 | # JS
52 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation.js", "public/javascripts/foundation.js"
53 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation.min.js", "public/javascripts/foundation.min.js"
54 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/vendor/fastclick.js", "public/javascripts/vendor/fastclick.js"
55 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/vendor/jquery.cookie.js", "public/javascripts/vendor/jquery.cookie.js"
56 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/vendor/jquery.js", "public/javascripts/vendor/jquery.js"
57 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/vendor/modernizr.js", "public/javascripts/vendor/modernizr.js"
58 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/vendor/placeholder.js", "public/javascripts/vendor/placeholder.js"
59 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.abide.js", "public/javascripts/foundation/foundation.abide.js"
60 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.accordion.js", "public/javascripts/foundation/foundation.accordion.js"
61 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.alert.js", "public/javascripts/foundation/foundation.alert.js"
62 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.clearing.js", "public/javascripts/foundation/foundation.clearing.js"
63 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.dropdown.js", "public/javascripts/foundation/foundation.dropdown.js"
64 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.equalizer.js", "public/javascripts/foundation/foundation.equalizer.js"
65 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.interchange.js", "public/javascripts/foundation/foundation.interchange.js"
66 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.joyride.js", "public/javascripts/foundation/foundation.joyride.js"
67 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.js", "public/javascripts/foundation/foundation.js"
68 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.magellan.js", "public/javascripts/foundation/foundation.magellan.js"
69 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.offcanvas.js", "public/javascripts/foundation/foundation.offcanvas.js"
70 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.orbit.js", "public/javascripts/foundation/foundation.orbit.js"
71 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.reveal.js", "public/javascripts/foundation/foundation.tooltip.js"
72 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.tab.js", "public/javascripts/foundation/foundation.reveal.js"
73 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.tooltip.js", "public/javascripts/foundation/foundation.tab.js"
74 | get "https://raw.github.com/felipecabargas/camorra/master/assets/js/foundation/foundation.topbar.js", "public/javascripts/foundation/foundation.topbar.js"
75 |
76 | inject_into_file destination_root('app/stylesheets/application.scss'), "// Load normalize.scss as recommended by Zurb Foundation\n
77 | @import 'normalize';\n\n// Customize certain layout settings in foundation/_settings.scss\n@import 'foundation/settings';\n\n// Use Zurb Foundation\n@import 'foundation';\n", :after => "// @include blueprint\n"
78 |
79 | say "Hooray! Camorra is installed."
80 | say "Now you should add Foundation JS to your layout (code below works on both SLIM and HAML):"
81 | say " "
82 | say "=javascript_include_tag 'foundation/foundation.js'"
83 | say "javascript:"
84 | say " $(document).foundation();%"
85 |
--------------------------------------------------------------------------------