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
Thiru Njuguna
committed
Oct 28, 2018
1 parent
55de850
commit 8a70ad5
Showing
18 changed files
with
26 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
natra (0.0.2) | ||
natra (0.0.3) | ||
activesupport (~> 5.0) | ||
thor (~> 0.18) | ||
|
||
|
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
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
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
<div class="container"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
<h2>Sinatra Template Default Page</h2> | ||
|
||
<div class="content"> | ||
<p>Welcome to the Sinatra Template! If you're seeing this page, then everything is working | ||
as expected. To get started, delete this file (<code>app/views/welcome.erb)</code> and begin adding | ||
your own actions to <code>application_controller.rb</code>. For more information, see the <a href="https://github.com/thirunjuguna/natra">README</a>.</p> | ||
</div> | ||
|
||
<div class="sidebar"> | ||
<h3>Environment</h3> | ||
<ul> | ||
<li><b>Ruby:</b> <%= RUBY_VERSION %></li> | ||
<li><b>Environment:</b> <%= ENV["RACK_ENV"] %></li> | ||
<li><b>Server:</b> <%= @env["SERVER_SOFTWARE"] %></li> | ||
<li><b>Port:</b> <%= @env["SERVER_PORT"] %></li> | ||
<li><b>Help:</b>see the <a href="https://github.com/thirunjuguna/natra">README</a> </li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
</div> |
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
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
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,4 @@ | ||
# Sequel Database Configuration | ||
<% if @database == "sqlite" %> | ||
development: "sqlite://db/development.sqlite3" | ||
test: "sqlite://db/test.sqlite3" | ||
production: "sqlite://db/production.sqlite3" | ||
<% elsif @database == "postgres" %> | ||
development: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_development" | ||
test: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_test" | ||
production: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_production" | ||
<% elsif @database == "mysql" %> | ||
development: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_development" | ||
test: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_test" | ||
production: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_production" | ||
<% elsif @database == "mongo" %> | ||
development: | ||
host: localhost | ||
port: 27017 | ||
database: <%= @name %>_development | ||
username: | ||
password: | ||
|
||
test: | ||
host: localhost | ||
port: 27017 | ||
database: <%= @name %>_test | ||
username: | ||
password: | ||
|
||
production: | ||
host: localhost | ||
port: 27017 | ||
database: <%= @name %>_production | ||
username: | ||
password: | ||
<% end %> | ||
development: ENV['DEV_DATABASE_URL'] | ||
test: ENV['TEST_DATABASE_URL'] | ||
production: ENV['PROD_DATABASE_URL'] |
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
12 changes: 4 additions & 8 deletions
12
lib/natra/generators/app/templates/config/initializers/database.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
<% unless @database.empty? -%> | ||
|
||
require "yaml" | ||
settings = YAML::load_file("config/db.yml") | ||
<% if @database != 'mongo' -%> | ||
# Sequel Configuration | ||
|
||
require "sequel" | ||
DB = Sequel.connect(settings[ENV['RACK_ENV']]) | ||
<% else -%> | ||
# MongoDB Configuration | ||
<% end -%> | ||
<% end -%> | ||
DB = Sequel.connect(settings[ENV['SINATRA_ENV']]) | ||
|
4 changes: 2 additions & 2 deletions
4
lib/natra/generators/app/templates/config/initializers/redis.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require "yaml" | ||
|
||
# Redis Configuration | ||
unless ENV['RACK_ENV'] == 'test' | ||
unless ENV['SINATRA_ENV'] == 'test' | ||
redis_settings = YAML::load_file("config/redis.yml") | ||
REDIS = Redis.new(redis_settings[ENV['RACK_ENV']]) | ||
REDIS = Redis.new(redis_settings[ENV['SINATRA_ENV']]) | ||
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
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
/tmp | ||
/log | ||
/log | ||
*.swp | ||
*.swo | ||
.rspec_status | ||
coverage | ||
|
||
client/Gemfile.lock | ||
|
||
secrets.aes | ||
secrets.env |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
SINATRA_ENV=development | ||
LOG_LEVEL=Logger::INFO | ||
<%- if @database=='postgres' -%> | ||
DATABASE_URL=postgresql://docker:docker@db:5432/<%= @name.camel_case %>?pool=5 | ||
DEV_DATABASE_URL=postgresql://docker:docker@db:5432/<%= @name.camel_case %>_dev?pool=5 | ||
PROD_DATABASE_URL=postgresql://docker:docker@db:5432/<%= @name.camel_case %>_prod?pool=5 | ||
TEST_DATABASE_URL=postgresql://docker:docker@db:5432/<%= @name.camel_case %>_test?pool=5 | ||
POSTGRES_USER=docker | ||
POSTGRES_PASSWORD=docker | ||
POSTGRES_DB=<%= @name.camel_case %> | ||
<%- end -%> | ||
|
||
POSTGRES_DB=<%= @name.camel_case %>_dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Natra | ||
VERSION = '0.0.2'.freeze | ||
VERSION = '0.0.3'.freeze | ||
end |