This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3f4c69a
Showing
22 changed files
with
519 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
:orm: activerecord | ||
:test: none | ||
:mock: none | ||
:script: none | ||
:renderer: none | ||
:stylesheet: none | ||
:namespace: Embadge | ||
:migration_format: number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
log/**/* | ||
tmp/**/* | ||
vendor/gems/* | ||
!vendor/gems/cache/ | ||
.sass-cache/* | ||
db/*.db | ||
.*.sw* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Padrino supports Ruby version 1.9 and later | ||
# ruby '2.1.0' | ||
|
||
# Distribute your app as a gem | ||
# gemspec | ||
|
||
# Server requirements | ||
# gem 'thin' # or mongrel | ||
# gem 'trinidad', :platform => 'jruby' | ||
|
||
# Optional JSON codec (faster performance) | ||
# gem 'oj' | ||
|
||
# Project requirements | ||
gem 'rake' | ||
|
||
# Component requirements | ||
gem 'activerecord', '>= 3.1', :require => 'active_record' | ||
gem 'sqlite3' | ||
|
||
# Test requirements | ||
|
||
# Padrino Stable Gem | ||
gem 'padrino', '0.13.1' | ||
|
||
# Or Padrino Edge | ||
# gem 'padrino', :github => 'padrino/padrino-framework' | ||
|
||
# Or Individual Gems | ||
# %w(core support gen helpers cache mailer admin).each do |g| | ||
# gem 'padrino-' + g, '0.13.1' | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activemodel (4.2.1) | ||
activesupport (= 4.2.1) | ||
builder (~> 3.1) | ||
activerecord (4.2.1) | ||
activemodel (= 4.2.1) | ||
activesupport (= 4.2.1) | ||
arel (~> 6.0) | ||
activesupport (4.2.1) | ||
i18n (~> 0.7) | ||
json (~> 1.7, >= 1.7.7) | ||
minitest (~> 5.1) | ||
thread_safe (~> 0.3, >= 0.3.4) | ||
tzinfo (~> 1.1) | ||
arel (6.0.3) | ||
builder (3.2.2) | ||
enumerable-lazy (0.0.1) | ||
i18n (0.7.0) | ||
json (1.8.3) | ||
mail (2.6.4.rc2) | ||
mime-types (>= 1.16, < 4) | ||
mime-types (2.4.3) | ||
minitest (5.7.0) | ||
moneta (0.7.20) | ||
mustermann19 (0.4.0) | ||
enumerable-lazy | ||
padrino (0.13.1) | ||
padrino-admin (= 0.13.1) | ||
padrino-cache (= 0.13.1) | ||
padrino-core (= 0.13.1) | ||
padrino-gen (= 0.13.1) | ||
padrino-helpers (= 0.13.1) | ||
padrino-mailer (= 0.13.1) | ||
padrino-support (= 0.13.1) | ||
padrino-admin (0.13.1) | ||
padrino-core (= 0.13.1) | ||
padrino-helpers (= 0.13.1) | ||
padrino-cache (0.13.1) | ||
moneta (~> 0.7.0) | ||
padrino-core (= 0.13.1) | ||
padrino-helpers (= 0.13.1) | ||
padrino-core (0.13.1) | ||
activesupport (>= 3.1) | ||
mustermann19 | ||
padrino-support (= 0.13.1) | ||
rack-protection (>= 1.5.0) | ||
sinatra (~> 1.4.6) | ||
thor (~> 0.18) | ||
padrino-gen (0.13.1) | ||
bundler (~> 1.0) | ||
padrino-core (= 0.13.1) | ||
padrino-helpers (0.13.1) | ||
i18n (~> 0.6, >= 0.6.7) | ||
padrino-support (= 0.13.1) | ||
tilt (~> 1.4.1) | ||
padrino-mailer (0.13.1) | ||
mail (~> 2.5) | ||
padrino-core (= 0.13.1) | ||
padrino-support (0.13.1) | ||
activesupport (>= 3.1) | ||
rack (1.6.0) | ||
rack-protection (1.5.3) | ||
rack | ||
rake (10.4.2) | ||
sinatra (1.4.6) | ||
rack (~> 1.4) | ||
rack-protection (~> 1.4) | ||
tilt (>= 1.3, < 3) | ||
sqlite3 (1.3.11) | ||
thor (0.18.1) | ||
thread_safe (0.3.5) | ||
tilt (1.4.1) | ||
tzinfo (1.2.2) | ||
thread_safe (~> 0.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
activerecord (>= 3.1) | ||
padrino (= 0.13.1) | ||
rake | ||
sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'bundler/setup' | ||
require 'padrino-core/cli/rake' | ||
|
||
PadrinoTasks.use(:database) | ||
PadrinoTasks.use(:activerecord) | ||
PadrinoTasks.init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module Embadge | ||
class App < Padrino::Application | ||
use ConnectionPoolManagement | ||
register Padrino::Mailer | ||
register Padrino::Helpers | ||
|
||
enable :sessions | ||
|
||
## | ||
# Caching support. | ||
# | ||
# register Padrino::Cache | ||
# enable :caching | ||
# | ||
# You can customize caching store engines: | ||
# | ||
# set :cache, Padrino::Cache.new(:LRUHash) # Keeps cached values in memory | ||
# set :cache, Padrino::Cache.new(:Memcached) # Uses default server at localhost | ||
# set :cache, Padrino::Cache.new(:Memcached, :server => '127.0.0.1:11211', :exception_retry_limit => 1) | ||
# set :cache, Padrino::Cache.new(:Memcached, :backend => memcached_or_dalli_instance) | ||
# set :cache, Padrino::Cache.new(:Redis) # Uses default server at localhost | ||
# set :cache, Padrino::Cache.new(:Redis, :host => '127.0.0.1', :port => 6379, :db => 0) | ||
# set :cache, Padrino::Cache.new(:Redis, :backend => redis_instance) | ||
# set :cache, Padrino::Cache.new(:Mongo) # Uses default server at localhost | ||
# set :cache, Padrino::Cache.new(:Mongo, :backend => mongo_client_instance) | ||
# set :cache, Padrino::Cache.new(:File, :dir => Padrino.root('tmp', app_name.to_s, 'cache')) # default choice | ||
# | ||
|
||
## | ||
# Application configuration options. | ||
# | ||
# set :raise_errors, true # Raise exceptions (will stop application) (default for test) | ||
# set :dump_errors, true # Exception backtraces are written to STDERR (default for production/development) | ||
# set :show_exceptions, true # Shows a stack trace in browser (default for development) | ||
# set :logging, true # Logging in STDOUT for development and file for production (default only for development) | ||
# set :public_folder, 'foo/bar' # Location for static assets (default root/public) | ||
# set :reload, false # Reload application files (default in development) | ||
# set :default_builder, 'foo' # Set a custom form builder (default 'StandardFormBuilder') | ||
# set :locale_path, 'bar' # Set path for I18n translations (default your_apps_root_path/locale) | ||
# disable :sessions # Disabled sessions by default (enable if needed) | ||
# disable :flash # Disables sinatra-flash (enabled by default if Sinatra::Flash is defined) | ||
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application) | ||
# | ||
|
||
## | ||
# You can configure for a specified environment like: | ||
# | ||
# configure :development do | ||
# set :foo, :bar | ||
# disable :asset_stamp # no asset timestamping for dev | ||
# end | ||
# | ||
|
||
## | ||
# You can manage errors like: | ||
# | ||
# error 404 do | ||
# render 'errors/404' | ||
# end | ||
# | ||
# error 500 do | ||
# render 'errors/500' | ||
# end | ||
# | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
Dir.chdir(File.dirname(__FILE__)+'/..') | ||
|
||
# Start the app with Padrino::Server | ||
require 'bundler/setup' | ||
require 'padrino-core/cli/launcher' | ||
|
||
ARGV.unshift('start') if ARGV.first.nil? || ARGV.first.start_with?('-') | ||
Padrino::Cli::Launcher.start ARGV | ||
|
||
# Start the app with Rack::Server | ||
#require "rack" | ||
#Rack::Server.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env rackup | ||
# encoding: utf-8 | ||
|
||
# This file can be used to start Padrino, | ||
# just execute it from the command line. | ||
|
||
require File.expand_path("../config/boot.rb", __FILE__) | ||
|
||
run Padrino.application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## | ||
# This file mounts each app in the Padrino project to a specified sub-uri. | ||
# You can mount additional applications using any of these commands below: | ||
# | ||
# Padrino.mount('blog').to('/blog') | ||
# Padrino.mount('blog', :app_class => 'BlogApp').to('/blog') | ||
# Padrino.mount('blog', :app_file => 'path/to/blog/app.rb').to('/blog') | ||
# | ||
# You can also map apps to a specified host: | ||
# | ||
# Padrino.mount('Admin').host('admin.example.org') | ||
# Padrino.mount('WebSite').host(/.*\.?example.org/) | ||
# Padrino.mount('Foo').to('/foo').host('bar.example.org') | ||
# | ||
# Note 1: Mounted apps (by default) should be placed into the project root at '/app_name'. | ||
# Note 2: If you use the host matching remember to respect the order of the rules. | ||
# | ||
# By default, this file mounts the primary app which was generated with this project. | ||
# However, the mounted app can be modified as needed: | ||
# | ||
# Padrino.mount('AppName', :app_file => 'path/to/file', :app_class => 'BlogApp').to('/') | ||
# | ||
|
||
## | ||
# Setup global project settings for your apps. These settings are inherited by every subapp. You can | ||
# override these settings in the subapps as needed. | ||
# | ||
Padrino.configure_apps do | ||
# enable :sessions | ||
set :session_secret, 'ac2bf22d4285cabbdb6146b0a5cd2eae3452fde141a23b0cfa59d1eaa53477b3' | ||
set :protection, :except => :path_traversal | ||
set :protect_from_csrf, true | ||
end | ||
|
||
# Mounts the core application for this project | ||
Padrino.mount('Embadge::App', :app_file => Padrino.root('app/app.rb')).to('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Defines our constants | ||
RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV) | ||
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT) | ||
|
||
# Load our dependencies | ||
require 'bundler/setup' | ||
Bundler.require(:default, RACK_ENV) | ||
|
||
## | ||
# ## Enable devel logging | ||
# | ||
# Padrino::Logger::Config[:development][:log_level] = :devel | ||
# Padrino::Logger::Config[:development][:log_static] = true | ||
# | ||
# ## Enable logging of source location | ||
# | ||
# Padrino::Logger::Config[:development][:source_location] = true | ||
# | ||
# ## Configure your I18n | ||
# | ||
# I18n.default_locale = :en | ||
# I18n.enforce_available_locales = false | ||
# | ||
# ## Configure your HTML5 data helpers | ||
# | ||
# Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog) | ||
# text_field :foo, :dialog => true | ||
# Generates: <input type="text" data-dialog="true" name="foo" /> | ||
# | ||
# ## Add helpers to mailer | ||
# | ||
# Mail::Message.class_eval do | ||
# include Padrino::Helpers::NumberHelpers | ||
# include Padrino::Helpers::TranslationHelpers | ||
# end | ||
|
||
## | ||
# Add your before (RE)load hooks here | ||
# | ||
Padrino.before_load do | ||
end | ||
|
||
## | ||
# Add your after (RE)load hooks here | ||
# | ||
Padrino.after_load do | ||
end | ||
|
||
Padrino.load! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
## | ||
# You can use other adapters like: | ||
# | ||
# ActiveRecord::Base.configurations[:development] = { | ||
# :adapter => 'mysql2', | ||
# :encoding => 'utf8', | ||
# :reconnect => true, | ||
# :database => 'your_database', | ||
# :pool => 5, | ||
# :username => 'root', | ||
# :password => '', | ||
# :host => 'localhost', | ||
# :socket => '/tmp/mysql.sock' | ||
# } | ||
# | ||
ActiveRecord::Base.configurations[:development] = { | ||
:adapter => 'sqlite3', | ||
:database => Padrino.root('db', 'embadge_development.db') | ||
|
||
} | ||
|
||
ActiveRecord::Base.configurations[:production] = { | ||
:adapter => 'sqlite3', | ||
:database => Padrino.root('db', 'embadge_production.db') | ||
|
||
} | ||
|
||
ActiveRecord::Base.configurations[:test] = { | ||
:adapter => 'sqlite3', | ||
:database => Padrino.root('db', 'embadge_test.db') | ||
|
||
} | ||
|
||
# Setup our logger | ||
ActiveRecord::Base.logger = logger | ||
|
||
if ActiveRecord::VERSION::MAJOR.to_i < 4 | ||
# Raise exception on mass assignment protection for Active Record models. | ||
ActiveRecord::Base.mass_assignment_sanitizer = :strict | ||
|
||
# Log the query plan for queries taking more than this (works | ||
# with SQLite, MySQL, and PostgreSQL). | ||
ActiveRecord::Base.auto_explain_threshold_in_seconds = 0.5 | ||
end | ||
|
||
# Doesn't include Active Record class name as root for JSON serialized output. | ||
ActiveRecord::Base.include_root_in_json = false | ||
|
||
# Store the full class name (including module namespace) in STI type column. | ||
ActiveRecord::Base.store_full_sti_class = true | ||
|
||
# Use ISO 8601 format for JSON serialized times and dates. | ||
ActiveSupport.use_standard_json_time_format = true | ||
|
||
# Don't escape HTML entities in JSON, leave that for the #json_escape helper | ||
# if you're including raw JSON in an HTML page. | ||
ActiveSupport.escape_html_entities_in_json = false | ||
|
||
# Now we can establish connection with our db. | ||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Padrino.env]) | ||
|
||
# Timestamps are in the utc by default. | ||
ActiveRecord::Base.default_timezone = :utc |
Oops, something went wrong.