aetherg 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +18 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/VERSION +1 -0
- data/bin/aetherg +6 -0
- data/lib/aetherg.rb +4 -0
- data/lib/aetherg/aetherg.rb +90 -0
- data/lib/aetherg/string.rb +34 -0
- data/lib/templates/Gemfile +38 -0
- data/lib/templates/Guardfile +30 -0
- data/lib/templates/README.md +13 -0
- data/lib/templates/Rakefile +8 -0
- data/lib/templates/app/controllers/routes.rb +7 -0
- data/lib/templates/application.rb +36 -0
- data/lib/templates/boot.rb +7 -0
- data/lib/templates/config.ru +2 -0
- data/lib/templates/config/database.yml +35 -0
- data/lib/templates/config/initializer.rb +8 -0
- data/lib/templates/config/initializers/connection.rb +18 -0
- data/lib/templates/config/initializers/environment.rb +25 -0
- data/lib/templates/config/initializers/helpers.rb +4 -0
- data/lib/templates/config/initializers/redis.rb +10 -0
- data/lib/templates/config/puma.rb +165 -0
- data/lib/templates/config/redis.yml +13 -0
- data/lib/templates/config/settings.yml +13 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ed68d5df5cf41814388b8c669c85f7fe35bdf3a6
|
4
|
+
data.tar.gz: 042818893586ae21fd7881bf80bb259a20144c93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61b17c71dc5e022c30ef6a56f6142873c12af2beeac30aa6e631963dddd33428c253d2a00ea394bdd1f723f479f6fa647f3456e507fbd4856b33cf49f3bcab65
|
7
|
+
data.tar.gz: ca46e7c4cf77811af3575d387bd66c4c869b414deeb32eb97e8365c6769fcef5ce90ef7b8df525ca6c4d2fb7d2a63a0baef5cce168d9028b94f25a75fd92955a
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://ruby.taobao.org/
|
3
|
+
specs:
|
4
|
+
coderay (1.1.0)
|
5
|
+
method_source (0.8.2)
|
6
|
+
pry (0.10.1)
|
7
|
+
coderay (~> 1.1.0)
|
8
|
+
method_source (~> 0.8.1)
|
9
|
+
slop (~> 3.4)
|
10
|
+
slop (3.6.0)
|
11
|
+
thor (0.19.1)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
pry
|
18
|
+
thor
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Allen Chan @ Octo Music, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
=======
|
2
|
+
Aetherg
|
3
|
+
======
|
4
|
+
|
5
|
+
Description
|
6
|
+
-----------
|
7
|
+
|
8
|
+
Aetherg (Aether Generator) is a sinatra application generator. Light-weight MVC framework.
|
9
|
+
|
10
|
+
Definition
|
11
|
+
----------
|
12
|
+
|
13
|
+
> In Greek mythology, Aether or Aither (Æthere, Ancient Greek: Αἰθήρ, pronounced [ajtʰɛ̌ːr]) is one of the primordial deities, the first-born elementals. Aether is the personification of the upper air.[1] He embodies the pure upper air that the gods breathe, as opposed to the normal air (ἀήρ, aer) breathed by mortals. Like Tartarus and Erebus, Aether may have had shrines in ancient Greece, but he had no temples and it is unlikely that he had a cult.
|
14
|
+
|
15
|
+
Installation
|
16
|
+
-----
|
17
|
+
`gem install aetherg`
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
21
|
+
* `aetherg MY_APP -d mysql`
|
22
|
+
* `-d` with database options. "postgresql," "mysql," "sqlite",
|
23
|
+
and "mongodb." Default is "mysql."
|
24
|
+
* `--no-database` Don't include any database config options.
|
25
|
+
|
26
|
+
Copyright
|
27
|
+
-----
|
28
|
+
Copyright (c) 2015 Allen Chan @ Octo Music, Inc. See LISENCE for detail.
|
29
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/aetherg
ADDED
data/lib/aetherg.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
module Aetherg
|
2
|
+
class Generator < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
desc "Create a new sinatra application with Aether"
|
6
|
+
argument :name, :type => :string, :desc => "What's the name of your application"
|
7
|
+
class_option :database, :aliases => "-d", :default => "mysql", :desc => "The type of database to use, sqlite, mysql, postgresql supported"
|
8
|
+
class_option :no_database, :type => :boolean, :desc => "Exclude all database configuration files"
|
9
|
+
class_option :redis, :type => :boolean, :desc => "Include Redis configuration"
|
10
|
+
|
11
|
+
# Creates instance variables from options passed to Aether
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@name = @app_path = name.filename
|
15
|
+
options.each do |key, value|
|
16
|
+
instance_variable_set "@#{key.to_s}".to_sym, value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.source_root
|
21
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "templates"))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Create empty directories
|
25
|
+
def create_empty_directories
|
26
|
+
%w{app/assets/images app/assets/javascripts app/assets/stylesheets app/models app/routes app/views config/initializers db/migrate lib log tmp public}.each do |dir|
|
27
|
+
empty_directory File.join(@app_path, dir)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_app
|
32
|
+
template "application.rb", File.join(@app_path, "application.rb")
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_config_with_boot
|
36
|
+
template "config.ru", File.join(@app_path, "config.ru")
|
37
|
+
template "boot.rb", File.join(@app_path, "boot.rb")
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_gemfile
|
41
|
+
template "Gemfile", File.join(@app_path, "Gemfile")
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_rakefile
|
45
|
+
template "Rakefile", File.join(@app_path, "Rakefile")
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_readme
|
49
|
+
template "README.md", File.join(@app_path, "README.md")
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_server_config
|
53
|
+
copy_file "config/puma.rb", File.join(@app_path, "config/puma.example.rb")
|
54
|
+
end
|
55
|
+
#
|
56
|
+
def create_db_config
|
57
|
+
template("config/database.yml", File.join(@app_path, "config/database.yml")) unless @no_database
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_settings_config
|
61
|
+
copy_file "config/settings.yml", File.join(@app_path, "config/settings.yml")
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_initializers
|
65
|
+
template("config/initializers/connection.rb", File.join(@app_path, "config/initializers/connection.rb")) unless @no_database
|
66
|
+
template("config/initializers/helpers.rb", File.join(@app_path, "config/initializers/helpers.rb"))
|
67
|
+
template("config/initializers/environment.rb", File.join(@app_path, "config/initializers/environment.rb"))
|
68
|
+
template("config/initializer.rb", File.join(@app_path, "config/initializer.rb"))
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_redis_config_and_initializer
|
72
|
+
if @redis
|
73
|
+
copy_file("config/redis.yml", File.join(@app_path, "config/redis.yml"))
|
74
|
+
template("config/initializers/redis.rb", File.join(@app_path, "config/initializers/redis.rb"))
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def create_gitkeep
|
79
|
+
create_file File.join(@app_path, "app", "assets", "images", ".keep")
|
80
|
+
create_file File.join(@app_path, "app", "assets", "stylesheets", ".keep")
|
81
|
+
create_file File.join(@app_path, "app", "assets", "javascripts", ".keep")
|
82
|
+
create_file File.join(@app_path, "app", "models", ".keep")
|
83
|
+
create_file File.join(@app_path, "app", "routes", ".keep")
|
84
|
+
create_file File.join(@app_path, "app", "views", ".keep")
|
85
|
+
create_file File.join(@app_path, "lib", ".keep")
|
86
|
+
create_file File.join(@app_path, "db", "migrate", ".keep")
|
87
|
+
create_file File.join(@app_path, "public", ".keep")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Aether
|
2
|
+
module String
|
3
|
+
def camelcase
|
4
|
+
return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/)
|
5
|
+
altered_self = self.downcase.capitalize
|
6
|
+
altered_self.scan(/[_-][a-zA-Z]/).each do |match|
|
7
|
+
altered_self.gsub!(match, match[1].upcase)
|
8
|
+
end
|
9
|
+
|
10
|
+
altered_self
|
11
|
+
end
|
12
|
+
|
13
|
+
def camelcase!
|
14
|
+
self.replace camel_case
|
15
|
+
end
|
16
|
+
|
17
|
+
def filename
|
18
|
+
return self.gsub(/-/, "_") if !match(/[A-Z]/)
|
19
|
+
altered_self = self.strip
|
20
|
+
|
21
|
+
altered_self.scan(/[A-Z]/).each do |match|
|
22
|
+
altered_self.gsub!(match, "_#{match.downcase}")
|
23
|
+
end
|
24
|
+
|
25
|
+
altered_self.sub(/^_/, "").gsub(/_{2,}+/, "_").downcase
|
26
|
+
end
|
27
|
+
|
28
|
+
def filename!
|
29
|
+
self.replace file_name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
String.send(:include, Aether::String)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
source "http://ruby.taobao.org"
|
2
|
+
# source "https://rubygems.org" # Use rubygems if you're not in China
|
3
|
+
|
4
|
+
gem 'sinatra', '~> 1.4.6', require: false
|
5
|
+
<%- unless @no_database -%>
|
6
|
+
gem 'activerecord', '~> 4.2.3'
|
7
|
+
<%- if @database == 'postgresql' || @database == 'pg' -%>
|
8
|
+
gem 'pg'
|
9
|
+
<%- elsif @database == 'sqlite' -%>
|
10
|
+
gem 'sqlite3'
|
11
|
+
<%- elsif @database == 'mongo' || @database == 'mongodb' -%>
|
12
|
+
gem 'mongoid'
|
13
|
+
<%- else -%>
|
14
|
+
# default database: mysql
|
15
|
+
gem 'mysql2'
|
16
|
+
<%- end -%>
|
17
|
+
<%- if @redis -%>
|
18
|
+
gem 'redis'
|
19
|
+
<%- end -%>
|
20
|
+
<%- end -%>
|
21
|
+
|
22
|
+
group :development, :test do
|
23
|
+
gem 'shotgun'
|
24
|
+
gem 'pry'
|
25
|
+
gem 'racksh'
|
26
|
+
gem 'rspec'
|
27
|
+
gem 'guard-rspec'
|
28
|
+
gem 'guard-livereload'
|
29
|
+
gem 'terminal-notifier-guard'
|
30
|
+
gem 'database_cleaner'
|
31
|
+
end
|
32
|
+
|
33
|
+
group :development, :production do
|
34
|
+
# web app servers
|
35
|
+
# gem 'unicorn'
|
36
|
+
# gem 'rainbows'
|
37
|
+
gem 'puma'
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
guard 'livereload' do
|
2
|
+
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
3
|
+
watch(%r{app/helpers/.+\.rb})
|
4
|
+
watch(%r{public/.+\.(css|js|html)})
|
5
|
+
watch(%r{config/locales/.+\.yml})
|
6
|
+
# Rails Assets Pipeline
|
7
|
+
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
|
8
|
+
end
|
9
|
+
|
10
|
+
guard :rspec do
|
11
|
+
watch(%r{^spec/.+_spec\.rb$})
|
12
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
13
|
+
watch('spec/spec_helper.rb') { "spec" }
|
14
|
+
|
15
|
+
# Rails example
|
16
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
17
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
18
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
19
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
20
|
+
watch('config/routes.rb') { "spec/routing" }
|
21
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
22
|
+
|
23
|
+
# Capybara features specs
|
24
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
25
|
+
|
26
|
+
# Turnip features and steps
|
27
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
28
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# <%= @name.camelcase %>
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
A sinatra application generated by ![Aether](https://github.com/octomusic/aether)
|
6
|
+
|
7
|
+
## Introduction of Aether
|
8
|
+
Aether is a self-used web service framework template. Based on sinatra, simply and lightweight.
|
9
|
+
|
10
|
+
Definition
|
11
|
+
----------
|
12
|
+
|
13
|
+
> In Greek mythology, Aether or Aither (Æthere, Ancient Greek: Αἰθήρ, pronounced [ajtʰɛ̌ːr]) is one of the primordial deities, the first-born elementals. Aether is the personification of the upper air.[1] He embodies the pure upper air that the gods breathe, as opposed to the normal air (ἀήρ, aer) breathed by mortals. Like Tartarus and Erebus, Aether may have had shrines in ancient Greece, but he had no temples and it is unlikely that he had a cult.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
module <%= @name.camelcase %>
|
4
|
+
class Application < Sinatra::Base
|
5
|
+
|
6
|
+
set :root, File.dirname(__FILE__)
|
7
|
+
set :public_dir, File.expand_path('../public', __FILE__)
|
8
|
+
set :raise_errors, true
|
9
|
+
set :app_file, __FILE__
|
10
|
+
|
11
|
+
AUTOLOAD_PATHS = ["#{root}/app/models", "#{root}/app/routes", "#{root}/lib"]
|
12
|
+
|
13
|
+
def self.require_autoload_paths(paths)
|
14
|
+
paths.each do |path|
|
15
|
+
Dir[File.join(path, "*.rb")].each do |file|
|
16
|
+
require file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.initialize!
|
22
|
+
settings_file = File.expand_path('../config/settings.yml', __FILE__)
|
23
|
+
|
24
|
+
if File.exist? settings_file
|
25
|
+
YAML::load(open(settings_file))[self.environment.to_s]
|
26
|
+
else
|
27
|
+
raise Errno::ENOENT
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
$app_settings ||= <%= @name.camelcase %>::Application.initialize!
|
35
|
+
require File.expand_path('../config/initializer', __FILE__)
|
36
|
+
<%= @name.camelcase %>::Application.require_autoload_paths(<%= @name.camelcase %>::Application::AUTOLOAD_PATHS)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Sequel Database Configuration
|
2
|
+
<% if @database == "sqlite" %>
|
3
|
+
development: "sqlite://db/development.sqlite3"
|
4
|
+
test: "sqlite://db/test.sqlite3"
|
5
|
+
production: "sqlite://db/production.sqlite3"
|
6
|
+
<% elsif @database == "postgresql" || @database == 'pg' %>
|
7
|
+
development: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_development"
|
8
|
+
test: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_test"
|
9
|
+
production: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_production"
|
10
|
+
<% elsif @database == "mysql" %>
|
11
|
+
development: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_development"
|
12
|
+
test: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_test"
|
13
|
+
production: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_production"
|
14
|
+
<% elsif @database == "mongo" || @database == "mongodb" %>
|
15
|
+
development:
|
16
|
+
host: localhost
|
17
|
+
port: 27017
|
18
|
+
database: <%= @name %>_development
|
19
|
+
username:
|
20
|
+
password:
|
21
|
+
|
22
|
+
test:
|
23
|
+
host: localhost
|
24
|
+
port: 27017
|
25
|
+
database: <%= @name %>_test
|
26
|
+
username:
|
27
|
+
password:
|
28
|
+
|
29
|
+
production:
|
30
|
+
host: localhost
|
31
|
+
port: 27017
|
32
|
+
database: <%= @name %>_production
|
33
|
+
username:
|
34
|
+
password:
|
35
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%- unless @no_database -%>
|
2
|
+
require File.expand_path('../initializers/connection', __FILE__)
|
3
|
+
<%- end -%>
|
4
|
+
<%- if @redis -%>
|
5
|
+
require File.expand_path('../initializers/redis', __FILE__)
|
6
|
+
<%- end -%>
|
7
|
+
require File.expand_path('../initializers/environment', __FILE__)
|
8
|
+
require File.expand_path('../initializers/helpers', __FILE__)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class <%= @name.camelcase %>::Application
|
2
|
+
<% unless @no_database -%>
|
3
|
+
default_dbconfig_file = File.expand_path('../../../config/database.yml', __FILE__)
|
4
|
+
<% if @database != 'mongo' || @database != 'mongodb' -%>
|
5
|
+
# ActiveRecord connection
|
6
|
+
require 'active_record'
|
7
|
+
if File.exist? default_dbconfig_file
|
8
|
+
ActiveRecord::Base.configurations = YAML::load(open(default_dbconfig_file))
|
9
|
+
else
|
10
|
+
raise Errno::ENOENT
|
11
|
+
end
|
12
|
+
ActiveRecord::Base.establish_connection environment
|
13
|
+
<% else -%>
|
14
|
+
# MongoID connections
|
15
|
+
Mongoid.load!(default_dbconfig_file, environment)
|
16
|
+
<% end -%>
|
17
|
+
<% end -%>
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class <%= @name.camelcase %>::Application
|
2
|
+
before do
|
3
|
+
content_type 'text/html'
|
4
|
+
end
|
5
|
+
|
6
|
+
set :sessions, true
|
7
|
+
set :views, Proc.new { File.join(root, "/app/views") }
|
8
|
+
|
9
|
+
configure do
|
10
|
+
enable :logging
|
11
|
+
enable :static_cache_control
|
12
|
+
file = File.new("#{root}/log/#{environment.to_s}.log", 'a+')
|
13
|
+
ActiveRecord::Base.logger = Logger.new(file) unless (@no_database || @database == 'mongodb' || @database == 'mongo')
|
14
|
+
file.sync = true
|
15
|
+
use Rack::CommonLogger, file
|
16
|
+
|
17
|
+
# set CSRF
|
18
|
+
# use Rack::Session::Cookie, secret: $app_settings["csrf_token"]
|
19
|
+
# use Rack::Csrf, :raise => true
|
20
|
+
|
21
|
+
# set layouts
|
22
|
+
set :erb, :layout => :'layouts/application', :escape_html => true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class <%= @name.camelcase %>::Application
|
2
|
+
# Redis Configuration
|
3
|
+
default_redis_file = File.expand_path('../../../config/redis.yml', __FILE__)
|
4
|
+
if File.exist? default_redis_file
|
5
|
+
redis_settings = YAML::load(open(default_redis_file))
|
6
|
+
$REDIS = Redis.new(redis_settings[environment])
|
7
|
+
else
|
8
|
+
raise Errno::ENOENT
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
#!/usr/bin/env puma
|
2
|
+
|
3
|
+
# The directory to operate out of.
|
4
|
+
#
|
5
|
+
# The default is the current directory.
|
6
|
+
#
|
7
|
+
# directory '/u/apps/lolcat'
|
8
|
+
|
9
|
+
# Use an object or block as the rack application. This allows the
|
10
|
+
# config file to be the application itself.
|
11
|
+
#
|
12
|
+
# app do |env|
|
13
|
+
# puts env
|
14
|
+
#
|
15
|
+
# body = 'Hello, World!'
|
16
|
+
#
|
17
|
+
# [200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
|
18
|
+
# end
|
19
|
+
|
20
|
+
# Load "path" as a rackup file.
|
21
|
+
#
|
22
|
+
# The default is "config.ru".
|
23
|
+
#
|
24
|
+
# rackup '/u/apps/lolcat/config.ru'
|
25
|
+
|
26
|
+
# Set the environment in which the rack's app will run. The value must be a string.
|
27
|
+
#
|
28
|
+
# The default is "development".
|
29
|
+
#
|
30
|
+
# environment 'production'
|
31
|
+
|
32
|
+
# Daemonize the server into the background. Highly suggest that
|
33
|
+
# this be combined with "pidfile" and "stdout_redirect".
|
34
|
+
#
|
35
|
+
# The default is "false".
|
36
|
+
#
|
37
|
+
# daemonize
|
38
|
+
# daemonize false
|
39
|
+
|
40
|
+
# Store the pid of the server in the file at "path".
|
41
|
+
#
|
42
|
+
# pidfile '/u/apps/lolcat/tmp/pids/puma.pid'
|
43
|
+
|
44
|
+
# Use "path" as the file to store the server info state. This is
|
45
|
+
# used by "pumactl" to query and control the server.
|
46
|
+
#
|
47
|
+
# state_path '/u/apps/lolcat/tmp/pids/puma.state'
|
48
|
+
|
49
|
+
# Redirect STDOUT and STDERR to files specified. The 3rd parameter
|
50
|
+
# ("append") specifies whether the output is appended, the default is
|
51
|
+
# "false".
|
52
|
+
#
|
53
|
+
# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr'
|
54
|
+
# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
|
55
|
+
|
56
|
+
# Disable request logging.
|
57
|
+
#
|
58
|
+
# The default is "false".
|
59
|
+
#
|
60
|
+
# quiet
|
61
|
+
|
62
|
+
# Configure "min" to be the minimum number of threads to use to answer
|
63
|
+
# requests and "max" the maximum.
|
64
|
+
#
|
65
|
+
# The default is "0, 16".
|
66
|
+
#
|
67
|
+
# threads 0, 16
|
68
|
+
|
69
|
+
# Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
|
70
|
+
# accepted protocols.
|
71
|
+
#
|
72
|
+
# The default is "tcp://0.0.0.0:9292".
|
73
|
+
#
|
74
|
+
# bind 'tcp://0.0.0.0:9292'
|
75
|
+
# bind 'unix:///var/run/puma.sock'
|
76
|
+
# bind 'unix:///var/run/puma.sock?umask=0111'
|
77
|
+
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
|
78
|
+
|
79
|
+
# Instead of "bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'" you
|
80
|
+
# can also use the "ssl_bind" option.
|
81
|
+
#
|
82
|
+
# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
|
83
|
+
|
84
|
+
# Code to run before doing a restart. This code should
|
85
|
+
# close log files, database connections, etc.
|
86
|
+
#
|
87
|
+
# This can be called multiple times to add code each time.
|
88
|
+
#
|
89
|
+
# on_restart do
|
90
|
+
# puts 'On restart...'
|
91
|
+
# end
|
92
|
+
|
93
|
+
# Command to use to restart puma. This should be just how to
|
94
|
+
# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
|
95
|
+
# to puma, as those are the same as the original process.
|
96
|
+
#
|
97
|
+
# restart_command '/u/app/lolcat/bin/restart_puma'
|
98
|
+
|
99
|
+
# === Cluster mode ===
|
100
|
+
|
101
|
+
# How many worker processes to run.
|
102
|
+
#
|
103
|
+
# The default is "0".
|
104
|
+
#
|
105
|
+
# workers 2
|
106
|
+
|
107
|
+
# Code to run when a worker boots to setup the process before booting
|
108
|
+
# the app.
|
109
|
+
#
|
110
|
+
# This can be called multiple times to add hooks.
|
111
|
+
#
|
112
|
+
# on_worker_boot do
|
113
|
+
# puts 'On worker boot...'
|
114
|
+
# end
|
115
|
+
|
116
|
+
# Code to run when a worker boots to setup the process after booting
|
117
|
+
# the app.
|
118
|
+
#
|
119
|
+
# This can be called multiple times to add hooks.
|
120
|
+
#
|
121
|
+
# after_worker_boot do
|
122
|
+
# puts 'After worker boot...'
|
123
|
+
# end
|
124
|
+
|
125
|
+
# Code to run when a worker shutdown.
|
126
|
+
#
|
127
|
+
#
|
128
|
+
# on_worker_shutdown do
|
129
|
+
# puts 'On worker shutdown...'
|
130
|
+
# end
|
131
|
+
|
132
|
+
# Allow workers to reload bundler context when master process is issued
|
133
|
+
# a USR1 signal. This allows proper reloading of gems while the master
|
134
|
+
# is preserved across a phased-restart. (incompatible with preload_app)
|
135
|
+
# (off by default)
|
136
|
+
|
137
|
+
# prune_bundler
|
138
|
+
|
139
|
+
# Preload the application before starting the workers; this conflicts with
|
140
|
+
# phased restart feature. (off by default)
|
141
|
+
|
142
|
+
# preload_app!
|
143
|
+
|
144
|
+
# Additional text to display in process listing
|
145
|
+
#
|
146
|
+
# tag 'app name'
|
147
|
+
|
148
|
+
# Change the default timeout of workers
|
149
|
+
#
|
150
|
+
# worker_timeout 60
|
151
|
+
|
152
|
+
# === Puma control rack application ===
|
153
|
+
|
154
|
+
# Start the puma control rack application on "url". This application can
|
155
|
+
# be communicated with to control the main server. Additionally, you can
|
156
|
+
# provide an authentication token, so all requests to the control server
|
157
|
+
# will need to include that token as a query parameter. This allows for
|
158
|
+
# simple authentication.
|
159
|
+
#
|
160
|
+
# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
|
161
|
+
# to see what the app has available.
|
162
|
+
#
|
163
|
+
# activate_control_app 'unix:///var/run/pumactl.sock'
|
164
|
+
# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
|
165
|
+
# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aetherg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Allen Chan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Aetherg (Aether Generator) is a sinatra based App generator, let you
|
14
|
+
quickly generate a sinatra app.
|
15
|
+
email: chenillen@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
files:
|
22
|
+
- Gemfile
|
23
|
+
- Gemfile.lock
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- VERSION
|
27
|
+
- bin/aetherg
|
28
|
+
- lib/aetherg.rb
|
29
|
+
- lib/aetherg/aetherg.rb
|
30
|
+
- lib/aetherg/string.rb
|
31
|
+
- lib/templates/Gemfile
|
32
|
+
- lib/templates/Guardfile
|
33
|
+
- lib/templates/README.md
|
34
|
+
- lib/templates/Rakefile
|
35
|
+
- lib/templates/app/controllers/routes.rb
|
36
|
+
- lib/templates/application.rb
|
37
|
+
- lib/templates/boot.rb
|
38
|
+
- lib/templates/config.ru
|
39
|
+
- lib/templates/config/database.yml
|
40
|
+
- lib/templates/config/initializer.rb
|
41
|
+
- lib/templates/config/initializers/connection.rb
|
42
|
+
- lib/templates/config/initializers/environment.rb
|
43
|
+
- lib/templates/config/initializers/helpers.rb
|
44
|
+
- lib/templates/config/initializers/redis.rb
|
45
|
+
- lib/templates/config/puma.rb
|
46
|
+
- lib/templates/config/redis.yml
|
47
|
+
- lib/templates/config/settings.yml
|
48
|
+
homepage: http://rubygems.org/gems/aetherg
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.4.6
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Aetherg (Aether Generator) is aether generator of sinatra app.
|
72
|
+
test_files: []
|
73
|
+
has_rdoc:
|