blue-eyes 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.simplecov +8 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +257 -0
- data/Guardfile +25 -0
- data/LICENSE +24 -0
- data/README.md +188 -0
- data/Rakefile +17 -0
- data/lib/.DS_Store +0 -0
- data/lib/blue_eyes/.DS_Store +0 -0
- data/lib/blue_eyes/cli.rb +26 -0
- data/lib/blue_eyes/extensions/string.rb +42 -0
- data/lib/blue_eyes/generators/.DS_Store +0 -0
- data/lib/blue_eyes/generators/app/.DS_Store +0 -0
- data/lib/blue_eyes/generators/app/app_generator.rb +163 -0
- data/lib/blue_eyes/generators/app/templates/.DS_Store +0 -0
- data/lib/blue_eyes/generators/app/templates/.rubocop.yml.erb +19 -0
- data/lib/blue_eyes/generators/app/templates/.rubocop_todo.yml.erb +1 -0
- data/lib/blue_eyes/generators/app/templates/.ruby-version.erb +1 -0
- data/lib/blue_eyes/generators/app/templates/.simplecov.erb +9 -0
- data/lib/blue_eyes/generators/app/templates/Gemfile.erb +39 -0
- data/lib/blue_eyes/generators/app/templates/Guardfile.erb +25 -0
- data/lib/blue_eyes/generators/app/templates/Procfile.dev.erb +6 -0
- data/lib/blue_eyes/generators/app/templates/Procfile.erb +1 -0
- data/lib/blue_eyes/generators/app/templates/README.md +1 -0
- data/lib/blue_eyes/generators/app/templates/Rakefile.erb +4 -0
- data/lib/blue_eyes/generators/app/templates/app/controllers/application_controller.rb +15 -0
- data/lib/blue_eyes/generators/app/templates/app/models/.gitkeep +0 -0
- data/lib/blue_eyes/generators/app/templates/app/views/layout.erb.tt +32 -0
- data/lib/blue_eyes/generators/app/templates/app/views/welcome.erb +23 -0
- data/lib/blue_eyes/generators/app/templates/bin/dev +11 -0
- data/lib/blue_eyes/generators/app/templates/config/db.yml +35 -0
- data/lib/blue_eyes/generators/app/templates/config/environment.rb +18 -0
- data/lib/blue_eyes/generators/app/templates/config/initializers/database.rb.erb +16 -0
- data/lib/blue_eyes/generators/app/templates/config/initializers/redis.rb +9 -0
- data/lib/blue_eyes/generators/app/templates/config/redis.yml +14 -0
- data/lib/blue_eyes/generators/app/templates/config.ru.erb +7 -0
- data/lib/blue_eyes/generators/app/templates/public/.DS_Store +0 -0
- data/lib/blue_eyes/generators/app/templates/public/favicon.ico +0 -0
- data/lib/blue_eyes/generators/app/templates/public/images/.gitkeep +0 -0
- data/lib/blue_eyes/generators/app/templates/public/images/blue-eyes-small.png +0 -0
- data/lib/blue_eyes/generators/app/templates/public/images/blue-eyes.svg +24 -0
- data/lib/blue_eyes/generators/app/templates/public/javascripts/.gitkeep +0 -0
- data/lib/blue_eyes/generators/app/templates/public/stylesheets/main.css +115 -0
- data/lib/blue_eyes/generators/app/templates/spec/application_controller_spec.rb +17 -0
- data/lib/blue_eyes/generators/app/templates/spec/factories/.gitkeep +0 -0
- data/lib/blue_eyes/generators/app/templates/spec/spec_helper.rb +45 -0
- data/lib/blue_eyes/generators/controller/controller_generator.rb +42 -0
- data/lib/blue_eyes/generators/controller/templates/controller.rb.erb +39 -0
- data/lib/blue_eyes/generators/controller/templates/views/edit.html.erb +1 -0
- data/lib/blue_eyes/generators/controller/templates/views/index.html.erb +1 -0
- data/lib/blue_eyes/generators/controller/templates/views/new.html.erb +1 -0
- data/lib/blue_eyes/generators/controller/templates/views/show.html.erb +1 -0
- data/lib/blue_eyes/generators/model/migration.rb.erb +13 -0
- data/lib/blue_eyes/generators/model/model.rb.erb +5 -0
- data/lib/blue_eyes/generators/model/model_factory.rb.erb +8 -0
- data/lib/blue_eyes/generators/model/model_generator.rb +68 -0
- data/lib/blue_eyes/generators/model/model_spec.rb.erb +48 -0
- data/lib/blue_eyes/generators/scaffold/scaffold_generator.rb +25 -0
- data/lib/blue_eyes/version.rb +11 -0
- data/lib/blue_eyes.rb +13 -0
- data/test/blue_eyes/cli_test.rb +20 -0
- data/test/blue_eyes/extensions/string_test.rb +71 -0
- data/test/blue_eyes/generators/app_generator_test.rb +142 -0
- data/test/blue_eyes/generators/controller/controller_generator_test.rb +57 -0
- data/test/blue_eyes/generators/model/model_generator_test.rb +40 -0
- data/test/blue_eyes/generators/scaffold/scaffold_generator_test.rb +21 -0
- data/test/blue_eyes/version_test.rb +24 -0
- data/test/blue_eyes_test.rb +1 -0
- data/test/test_helper.rb +6 -0
- metadata +71 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor/group'
|
|
4
|
+
|
|
5
|
+
module BlueEyes
|
|
6
|
+
module Generators
|
|
7
|
+
# Generates a Sinatra application
|
|
8
|
+
class AppGenerator < Thor::Group
|
|
9
|
+
include Thor::Actions
|
|
10
|
+
|
|
11
|
+
desc 'Creates a new Sinatra application'
|
|
12
|
+
argument :name, type: :string, desc: 'The name of the new application'
|
|
13
|
+
class_option :capistrano, type: :boolean, desc: 'Include Capistrano configuration'
|
|
14
|
+
class_option :database, aliases: '-d', default: '', desc: 'The type of database to use'
|
|
15
|
+
class_option :redis, type: :boolean, desc: 'Include Redis configuration'
|
|
16
|
+
class_option :rvm, type: :boolean, desc: 'Create .ruby-version (ruby-2.1.0) and .ruby-gemset'
|
|
17
|
+
class_option :bundle, type: :boolean, desc: 'Run bundle after generating the app'
|
|
18
|
+
class_option :git, type: :boolean, desc: 'Initialize a Git repository'
|
|
19
|
+
|
|
20
|
+
# Creates instance variables from options passed to BlueEyes.
|
|
21
|
+
def setup
|
|
22
|
+
@app_path = name.directory_name
|
|
23
|
+
@name = name.file_name
|
|
24
|
+
|
|
25
|
+
options.each do |key, value|
|
|
26
|
+
instance_variable_set :"@#{key}", value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.source_root
|
|
31
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Create empty directories
|
|
35
|
+
def create_empty_directories
|
|
36
|
+
%w[bin config/initializers db/migrate lib spec].each do |dir|
|
|
37
|
+
empty_directory File.join(@app_path, dir)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
create_file File.join(@app_path, 'lib', '.gitkeep')
|
|
41
|
+
template 'config/environment.rb', File.join(@app_path, 'config/environment.rb')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def create_bin_dev
|
|
45
|
+
file_path = File.join(@app_path, 'bin/dev')
|
|
46
|
+
copy_file 'bin/dev', file_path
|
|
47
|
+
system "chmod a+x #{file_path}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def create_public_directory
|
|
51
|
+
%w[public/images public/javascripts public/stylesheets].each do |dir|
|
|
52
|
+
directory dir, File.join(@app_path, dir)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
template 'public/favicon.ico', File.join(@app_path, 'public/favicon.ico')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def create_app_directory
|
|
59
|
+
%w[app/controllers app/views app/models].each do |dir|
|
|
60
|
+
directory dir, File.join(@app_path, dir)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def create_spec_directory
|
|
65
|
+
template 'spec/application_controller_spec.rb', File.join(@app_path, 'spec/application_controller_spec.rb')
|
|
66
|
+
template 'spec/spec_helper.rb', File.join(@app_path, 'spec/spec_helper.rb')
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def create_ruby_version
|
|
70
|
+
template '.ruby-version.erb', File.join(@app_path, '.ruby-version')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def create_rubocop_config
|
|
74
|
+
copy_file '.rubocop_todo.yml.erb', File.join(@app_path, '.rubocop_todo.yml')
|
|
75
|
+
template '.rubocop.yml.erb', File.join(@app_path, '.rubocop.yml')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def create_simplecov
|
|
79
|
+
template '.simplecov.erb', File.join(@app_path, '.simplecov')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def create_rackup_config
|
|
83
|
+
template 'config.ru.erb', File.join(@app_path, 'config.ru')
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def create_gemfile
|
|
87
|
+
template 'Gemfile.erb', File.join(@app_path, 'Gemfile')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def create_guardfile
|
|
91
|
+
copy_file 'Guardfile.erb', File.join(@app_path, 'Guardfile')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def create_procfile
|
|
95
|
+
copy_file 'Procfile.erb', File.join(@app_path, 'Procfile')
|
|
96
|
+
copy_file 'Procfile.dev.erb', File.join(@app_path, 'Procfile.dev')
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def create_rakefile
|
|
100
|
+
template 'Rakefile.erb', File.join(@app_path, 'Rakefile')
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def create_readme
|
|
104
|
+
copy_file 'README.md', File.join(@app_path, 'README.md')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def create_db_config
|
|
108
|
+
# TODO: return if @database.empty?
|
|
109
|
+
|
|
110
|
+
template('config/db.yml', File.join(@app_path, 'config/db.yml'))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def create_database_initializer
|
|
114
|
+
# TODO: return if @database.empty?
|
|
115
|
+
|
|
116
|
+
template('config/initializers/database.rb.erb',
|
|
117
|
+
File.join(@app_path, 'config/initializers/database.rb'))
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def create_redis_config
|
|
121
|
+
return unless @redis
|
|
122
|
+
|
|
123
|
+
copy_file('config/redis.yml', File.join(@app_path, 'config/redis.yml'))
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def create_redis_initializer
|
|
127
|
+
return unless @redis
|
|
128
|
+
|
|
129
|
+
template('config/initializers/redis.rb', File.join(@app_path, 'config/initializers/redis.rb'))
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def create_capistrano_config
|
|
133
|
+
return unless @capistrano
|
|
134
|
+
|
|
135
|
+
inside(@app_path) do
|
|
136
|
+
run('cap install')
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def create_rvm_gemset
|
|
141
|
+
# TODO: deprecate RVM
|
|
142
|
+
return unless @rvm
|
|
143
|
+
|
|
144
|
+
create_file(File.join(@app_path, '.ruby-gemset'), @app_path)
|
|
145
|
+
|
|
146
|
+
@bundle = false
|
|
147
|
+
puts "You need to run 'bundle install' manually."
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def initialize_git_repo
|
|
151
|
+
inside(@app_path) do
|
|
152
|
+
run('git init .') if @git
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def install_dependencies
|
|
157
|
+
inside(@app_path) do
|
|
158
|
+
run('bundle') if @bundle
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- .rubocop_todo.yml
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
NewCops: enable
|
|
6
|
+
TargetRubyVersion: <%= RUBY_VERSION %>
|
|
7
|
+
Exclude:
|
|
8
|
+
- 'db/**/*' # IGNORE: Generated by Rake db:migrate
|
|
9
|
+
|
|
10
|
+
Metrics/BlockLength:
|
|
11
|
+
Exclude:
|
|
12
|
+
- Guardfile
|
|
13
|
+
|
|
14
|
+
plugins:
|
|
15
|
+
- rubocop-capybara
|
|
16
|
+
- rubocop-factory_bot
|
|
17
|
+
- rubocop-performance
|
|
18
|
+
- rubocop-rake
|
|
19
|
+
- rubocop-rspec
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Use `bundle exec rubocop --auto-gen-config` to update this file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= RUBY_VERSION %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'http://rubygems.org'
|
|
4
|
+
|
|
5
|
+
ruby File.read('.ruby-version').strip
|
|
6
|
+
|
|
7
|
+
gem 'puma', '~> 7.1'
|
|
8
|
+
gem 'rackup', '~> 2.2'
|
|
9
|
+
gem 'require_all', '~> 3.0'
|
|
10
|
+
gem 'sinatra', '~> 4.2'
|
|
11
|
+
gem 'sinatra-activerecord', '~> 2.0'
|
|
12
|
+
gem 'sqlite3', '~> 2.8'
|
|
13
|
+
|
|
14
|
+
group :development do
|
|
15
|
+
gem 'guard', '~> 2.19', require: false
|
|
16
|
+
gem 'guard-bundler', '~> 3.0', require: false
|
|
17
|
+
gem 'guard-rspec', '~> 4.7', require: false
|
|
18
|
+
gem 'guard-rubocop', '~> 1.5', require: false
|
|
19
|
+
gem 'rubocop', '~> 1.81', require: false
|
|
20
|
+
gem 'rubocop-capybara', '~> 2.22', require: false
|
|
21
|
+
gem 'rubocop-factory_bot', require: false
|
|
22
|
+
gem 'rubocop-minitest', '~> 0.38', require: false
|
|
23
|
+
gem 'rubocop-performance', '~> 1.26', require: false
|
|
24
|
+
gem 'rubocop-rake', '~> 0.7', require: false
|
|
25
|
+
gem 'rubocop-rspec', '~> 3.8', require: false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
group :development, :test do
|
|
29
|
+
gem 'capybara', '~> 3.40'
|
|
30
|
+
gem 'database_cleaner', '~> 2.1'
|
|
31
|
+
gem 'factory_bot', '~> 6.5'
|
|
32
|
+
gem 'faker', '~> 3.5'
|
|
33
|
+
gem 'minitest', '~> 5.25', require: false
|
|
34
|
+
gem 'pry', '~> 0.15'
|
|
35
|
+
gem 'rack-test', '~> 2.2'
|
|
36
|
+
gem 'rake', '~> 13.2'
|
|
37
|
+
gem 'rspec', '~> 3.13'
|
|
38
|
+
gem 'simplecov', '~> 0.22', require: false
|
|
39
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
guard :bundler do
|
|
4
|
+
require 'guard/bundler'
|
|
5
|
+
require 'guard/bundler/verify'
|
|
6
|
+
helper = Guard::Bundler::Verify.new
|
|
7
|
+
|
|
8
|
+
files = ['Gemfile']
|
|
9
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
|
10
|
+
|
|
11
|
+
# Assume files are symlinked from somewhere
|
|
12
|
+
files.each { |file| watch(helper.real_path(file)) }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
guard :rubocop, cli: ['-A'] do
|
|
16
|
+
watch(/.+\.rb$/)
|
|
17
|
+
watch('Rakefile') { 'Rakefile' }
|
|
18
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
22
|
+
watch(%r{^spec/(.*)/?(.*)_test\.rb$})
|
|
23
|
+
watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
|
24
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
|
25
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
web: bundle exec rackup config.ru -p $PORT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require './config/environment'
|
|
4
|
+
|
|
5
|
+
# Entrypoint for Rack
|
|
6
|
+
class ApplicationController < Sinatra::Base
|
|
7
|
+
configure do
|
|
8
|
+
set :public_folder, 'public'
|
|
9
|
+
set :views, 'app/views'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
get '/' do
|
|
13
|
+
erb :welcome
|
|
14
|
+
end
|
|
15
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
|
|
3
|
+
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
|
|
4
|
+
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
|
|
5
|
+
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
|
9
|
+
|
|
10
|
+
<title><%= @name.camel_case %></title>
|
|
11
|
+
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
13
|
+
|
|
14
|
+
<link rel="stylesheet" href="/stylesheets/main.css" />
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div class="wrapper">
|
|
18
|
+
|
|
19
|
+
<%%= yield %>
|
|
20
|
+
|
|
21
|
+
<footer class="branding">
|
|
22
|
+
<small>©<%= Time.now.year %> <strong><%= @name.camel_case %></strong></small>
|
|
23
|
+
</footer>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
|
27
|
+
<!--[if lt IE 7]>
|
|
28
|
+
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
|
|
29
|
+
<script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
|
|
30
|
+
<![endif]-->
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div class="container">
|
|
2
|
+
<header><img src="images/blue-eyes-small.png" class="img-responsive main-image"></header>
|
|
3
|
+
<div class="col-md-8 col-md-offset-2">
|
|
4
|
+
<h2>Sinatra Template Default Page</h2>
|
|
5
|
+
|
|
6
|
+
<div class="content">
|
|
7
|
+
<p>Welcome to the Sinatra Template! If you're seeing this page, then everything is working
|
|
8
|
+
as expected. To get started, delete this file (<code>app/views/welcome.erb)</code> and begin
|
|
9
|
+
adding your own actions to <code>application_controller.rb</code>.
|
|
10
|
+
For more information, see the <a href="https://github.com/scarver2/blue-eyes">README</a>.</p>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="sidebar">
|
|
14
|
+
<h3>Environment</h3>
|
|
15
|
+
<ul>
|
|
16
|
+
<li><b>Ruby:</b> <%= RUBY_VERSION %></li>
|
|
17
|
+
<li><b>Environment:</b> <%= ENV["RACK_ENV"] %></li>
|
|
18
|
+
<li><b>Server:</b> <%= @env["SERVER_SOFTWARE"] %></li>
|
|
19
|
+
<li><b>Port:</b> <%= @env["SERVER_PORT"] %></li>
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# install foreman if needed — https://github.com/ddollar/foreman
|
|
4
|
+
if ! gem list foreman -i --silent; then
|
|
5
|
+
echo "Installing foreman..."
|
|
6
|
+
gem install foreman
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
# run foreman and point it to our Procfile.dev, and pass through any arguments we've added
|
|
10
|
+
# learn more from the foreman docs — https://ddollar.github.io/foreman/
|
|
11
|
+
exec foreman start -f Procfile.dev "$@"
|
|
@@ -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 == "postgres" %>
|
|
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" %>
|
|
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,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# set environment to development if not defined
|
|
4
|
+
ENV['RACK_ENV'] = ENV['SINATRA_ENV'] ||= 'development'
|
|
5
|
+
|
|
6
|
+
require 'bundler/setup'
|
|
7
|
+
require 'sinatra'
|
|
8
|
+
require 'sinatra/activerecord'
|
|
9
|
+
|
|
10
|
+
Bundler.require(:default, ENV.fetch('SINATRA_ENV', nil))
|
|
11
|
+
|
|
12
|
+
set :database, {
|
|
13
|
+
adapter: 'sqlite3',
|
|
14
|
+
database: "db/#{ENV.fetch('SINATRA_ENV', nil)}.sqlite3"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
require './app/controllers/application_controller'
|
|
18
|
+
require_all 'app'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
<% unless @database.empty? -%>
|
|
4
|
+
require 'yaml'
|
|
5
|
+
|
|
6
|
+
settings = YAML::load_file('config/db.yml')
|
|
7
|
+
|
|
8
|
+
<% if @database == 'mongo' -%>
|
|
9
|
+
# MongoDB Configuration here
|
|
10
|
+
<% end -%>
|
|
11
|
+
<% else -%>
|
|
12
|
+
# Sequel Configuration
|
|
13
|
+
require 'sequel'
|
|
14
|
+
|
|
15
|
+
DB = Sequel.connect(settings[ENV['RACK_ENV']])
|
|
16
|
+
<% end %>
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="744.1" height="1052.4">
|
|
2
|
+
<path d="M25 336c15-10 31-19 47-27l11-6 7-4 3-1-33 19 7-4 40-23a528 528 0 0 1-18 10l40-23 26-11c7-4 15-4 23-7 6-3 12-6 19-7 7 0 15-3 21-5 7-3 14-3 20-6l22-5c8-2 17-5 26-6l25-3c6-1 11 0 17-2l7-2 23-4 25-2 26-7c9 0 15-3 23-6s16-3 24-4l24-6c8-2 15-2 23-2l25-1h133l24 3c7 2 14 6 20 11l21 18c7 7 12 16 18 24l3 4-37 21-2-4c-6-8-11-16-18-22s-13-13-21-18c-6-5-12-8-19-10-8-2-15-2-23-2H494a616 616 0 0 0-47 4l-25 5c-8 1-16 2-23 5l-23 6-27 6-25 2-22 5c-8 2-16 2-25 3l-25 3c-9 2-17 5-26 6l-21 6c-7 2-14 3-20 6l-21 5c-7 1-13 4-20 7-7 2-15 3-22 7l-25 11 31-18-5 2-40 24-5 3-4 2 32-19-39 23 32-19c-16 10-32 20-49 28l-3 2-4 2c-21 11 45-27 25-14l-3 1-40 16zM13 648c4-9 7-18 9-28 1-9 1-17 4-26l5-20c1-7 5-13 8-20l14-23 17-23c14-17 32-24 53-35 6-4 12-6 19-8 3-2 6-1 9-2l10-3 23-5 23-1h77a2722 2722 0 0 1 68 0c7 0 13-3 19-4l22-2 21-3c7-2 14-4 21-4 8-2 17-3 25-3s16-2 24-4l23-4 17-2 7-2 11-3-33 26-11 3c-8 2-16 2-25 3l-23 4c-8 2-16 4-24 3l-25 4-21 5-21 2-21 3c-7 1-13 4-20 3a4120 4120 0 0 0-68 0h-77l-23 1-23 6-19 5-18 8 33-19-4 2c-4 2-7 6-11 10l-17 22a495 495 0 0 0-22 42l-5 20-2 7c-2 6-1 13-3 19l-7 28-39 18zM74 728l26-2h149a222 222 0 0 0 40 3h24c7 0 14 0 20-2 5 0 8-2 12-4 14-5-8 4 6-2 8-1 15-4 22-8l21-8c8-2 14-7 21-10l4-1 7-4-26 15c6-6 13-11 20-15l50-29-33 19 3-2 3-2 39-22c4-3 9-4 13-6-111 64 87-50-23 13l40-15-40 23c-33 19 121-70-10 5l-10 4-3 2 30-17c-15 10-6 4-42 24a1975 1975 0 0 1 30-17l-7 5c-8 4-15 8-21 15-18 13-37 24-57 31-7 4-14 8-22 9l-20 10-22 7-18 6h-66l-19-3h-72a5110 5110 0 0 0-103 3l34-25z" style="fill:#000"/>
|
|
3
|
+
<path d="M212 469c-5 7-7 16-10 24-1 8-3 15-6 22l-6 20c-4 8-9 16-11 24-3 8-3 16-3 24-1 9 0 14 4 22l11 22c2 7 2 15 2 22 0 8-1 15 3 23 4 6 10 10 15 16 6 6 12 11 20 16 8 3 16 4 25 5l21-6-26 15 3-2 6-4c21-13 84-47 11-6l2-2 2-2c4-5 7-11 9-17 2-7 6-13 11-18l18-21c6-5 11-12 15-18 5-6 8-13 9-21a135 135 0 0 0-1-42l-11-20-11-21-10-18c-4-5-9-8-16-9l-21-6-17-4 35-24 17 4c6 3 13 5 21 6 7 2 13 6 17 12l10 18 12 22 11 20c2 7 3 15 3 22l-1 22c-1 8-3 15-8 22s-9 14-15 19c-7 6-13 13-18 20-5 5-9 11-11 17-3 6-5 13-9 18-11 17-11 10-42 28l-3 1 33-19-3 2-55 32a61 61 0 0 1-49-2l-20-17c-6-6-12-11-16-18l-3-7v-17c0-7 0-14-2-21-2-8-7-14-11-22s-6-13-5-23l3-25c2-8 6-16 11-24l6-20c2-8 5-14 6-22 3-8 5-17 10-25l38-17z" style="fill:#000"/>
|
|
4
|
+
<path d="M226 714a24 37 0 1 1 9-5" style="fill:#000"/>
|
|
5
|
+
<path d="M263 657a50 51 0 1 1 18-8M270 549a1 40 0 1 1 1-37l-1-2z" style="fill:#000"/>
|
|
6
|
+
<path d="M294 566a33 31 0 1 1 26-29l-33-2z" style="fill:#000"/>
|
|
7
|
+
<path d="M300 552a7 13 0 1 1 6-12h-7z" style="fill:#000"/>
|
|
8
|
+
<path d="m63 739 14-11h123l-14-10c-7-6-17-16-21-22-8-10-9-15-9-30 0-14-2-22-9-37-8-17-8-22-7-36 1-9 4-22 7-27l16-45c11-33 11-34 23-39l12-6-26 2-45 6c-17 4-20 6-29 18-23 31-32 54-42 105l-5 20-19 10c-14 7-16 7-15 3 2-3 4-11 5-19 11-52 18-70 43-104 12-16 26-26 56-41 34-17 40-18 145-20a1093 1093 0 0 0 237-24l27-3c0 1-4 5-11 10-10 8-15 10-56 16a6163 6163 0 0 0-111 17c-22 3-23 4-16 11 3 3 12 20 21 37 16 29 16 31 16 52 0 27-3 35-27 62-11 12-22 28-26 36-7 14-19 29-24 29-2 0-14 6-27 14l-24 14 15 2c26 3 63 2 80-3 24-6 64-23 87-37 11-8 21-13 22-12s-8 8-19 16c-20 14-56 31-99 48l-19 8H48l15-10zm211-33 10-18c5-9 17-25 27-36 23-26 28-37 28-64 0-19-1-23-9-37-8-13-11-16-17-17-5 0-8 1-8 3l-4 2c-3 0-5 2-6 4s-1 0-1-3c-1-4-3-6-5-6-3 0-4 1-3 4l3 16c2 9 1 11-3 11-5 0-5 1 1 6l11 18c13 31-14 69-47 67-9-1-12 0-11 3 5 11 5 26 1 36l-5 12c0 3 32 3 38-1zm-63-58 7-7-5-8c-4-5-7-14-8-23-1-18 5-31 21-44 9-7 13-8 26-8 14 0 15-1 11-5-11-12-7-33 8-42 11-7 18-7 29-2l8 2c0-3-13-15-17-15l-20-5c-14-5-15-5-10-10s4-5-25-4l-30 1-8 26c-4 14-11 32-15 41a77 77 0 0 0-1 66c4 8 7 20 9 36 2 29 5 35 9 20 2-6 6-15 11-19z" style="fill:#369"/>
|
|
9
|
+
<path d="M217 622c7 5 16 5 20 12 3 17 2 2-37 25l33-26c-35 21-45 13-32 22-1-2-17-8-19-10l35-23z" style="fill:#000"/>
|
|
10
|
+
<path d="M220 613c7 4 14 10 19 16l16 21c5 8 13 12 21 16 7 4 11 10 13 18 1 6 1 12-1 18l-38 18c2-5 3-11 2-16-2-8-5-11-12-15-8-4-16-9-21-17-6-7-10-15-16-21-5-6-11-11-19-15l36-23z" style="fill:#000"/>
|
|
11
|
+
<path d="M330 562v26l-2 22c0 7-3 14-6 21a242 242 0 0 1-13 41l-7 9-38 16 7-8c3-6 6-13 7-20 2-7 5-13 6-20 2-7 5-13 6-20l3-22v-25l37-20zM252 474c-6 8-13 16-18 25-6 7-11 14-15 22l-11 23-7 21c-2 7-2 15-2 22v29l-38 20v-30c0-8 0-15 2-23l7-22 11-22c4-9 9-16 14-24l18-24 39-17z" style="fill:#000"/>
|
|
12
|
+
<path d="m244 492-4 2-8 4-4 3 28-16a205 205 0 0 0-39 30c-7 6-11 13-16 21l-11 21-5 11-38 19 4-13c4-7 7-15 12-22 4-7 8-15 15-21 6-6 11-12 18-17a459 459 0 0 1 81-49l-33 27zM278 512c-8 6-13 15-18 23a844 844 0 0 0-23 34l-39 17 8-11 15-24c6-7 11-16 18-23l39-16z" style="fill:#000"/>
|
|
13
|
+
<path d="M227 512c-16 10 19-11 29-16l-4 3-17 11c-8 8-18 13-27 19-6 4-10 10-13 17l-2 9-38 18 2-10c2-7 6-13 12-19 9-7 20-11 28-18 20-15 40-29 63-40l-33 26z" style="fill:#000"/>
|
|
14
|
+
<path d="m247 517-11 4c-1 1-5 3-3 3l28-16-21 14-17 17-15 19-6 7-39 17 7-8 14-18 6-7 11-11 21-15c18-12 37-25 58-32l-33 26z" style="fill:#000"/>
|
|
15
|
+
<path d="m270 504-24 11c-17 5-52 27 12-10-17 12-34 25-54 32l-6 3 34-19-40 22-3 2 33-19-7 4-3 2-7 7-13 12-39 16 13-12 5-4 5-6c2-1 92-53 6-3l40-23 3-2-33 19 39-22 6-3c14-7 4-2-30 18l3-2 6-4 3-2c20-12 38-25 60-32l24-12-33 27zM65 744l25 12 8 4-35 23-8-4-25-11 35-24zM117 716c9 7 18 14 25 23l8 12-37 21-7-12c-7-8-15-15-24-20l35-24z" style="fill:#000"/>
|
|
16
|
+
<path d="m165 718 27 6c7 2 14 5 21 10 6 4 10 11 12 18l1 3-36 21-2-4c-2-6-5-12-11-16s-13-6-20-8c-9-3-17-5-26-6l34-24z" style="fill:#000"/>
|
|
17
|
+
<path d="m257 728 27 18c8 4 16 9 23 15l-35 22-23-15-28-17 36-23z" style="fill:#000"/>
|
|
18
|
+
<path d="M340 740c8 6 17 10 26 15l5 3-35 23-5-3-27-16 36-22z" style="fill:#000"/>
|
|
19
|
+
<path d="m374 732 13 11-35 22-14-11 36-22zM420 704c7 4 15 5 23 7l17 1-35 24-17-1-24-7 36-24z" style="fill:#000"/>
|
|
20
|
+
<path d="M399 708c1 9 2 14 9 20l10 7-35 23-11-7c-7-7-9-14-10-23l37-20zM442 686c9 0 18 4 27 6l16 3-35 24-16-3c-9-2-17-6-26-5l34-25zM29 633c-8-2-14-6-19-12s-5-13-6-20 1-12 5-18l9-16 5-22 1-22v-8l38-19v8l-1 22-5 23-8 17c-4 5-7 9-6 16 0 6 0 12 4 17 5 5 11 8 18 9l-35 25zM56 494l7-26a248 248 0 0 1 16-36l38-18c-1 5-3 10-6 14l-10 23-7 25-38 18z" style="fill:#000"/>
|
|
21
|
+
<path d="m93 462 3 25 2 11-37 20-3-12-2-24 37-20z" style="fill:#000"/>
|
|
22
|
+
<path d="M122 456c6 0 11-2 16-4l4-2-33 18c7-4 8-11 10-19 1-7 5-14 10-20 5-5 7-11 11-16 2-5 6-9 9-12l39-17-10 12-10 17c-5 5-9 11-11 18-2 8-3 16-9 22-20 12-36 26-60 29l34-26zM162 470l10-24c4-9 9-18 15-26 4-8 11-13 17-17 10 1 31-20 46-26l9-3c4-3 9-5 14-6l-33 26-14 6c-16 5-45 22 18-13-7 4-14 9-19 16-6 8-10 17-15 26l-10 24-38 17zM225 473c4-8 10-16 16-24l17-19 14-16 17-16c13-14 30-20 48-31l-33 19 39-15c-88 51-20 12-6 4l-4 2-5 5a757 757 0 0 1-31 31l-18 20-16 23-38 17zM288 450a586 586 0 0 1 39-43l14-15 16-16 17-10 39-15-16 10c-7 4-12 9-17 15l-14 15-18 19-21 24-39 16zM336 459c5-8 8-18 12-26 3-7 7-14 13-20l16-18c14-14 29-20 48-30l7-2 17-4-34 26-17 4c-14 5-29 16 27-17l-3 2-3 2-3 3-17 17c-5 6-10 12-13 20l-11 25-39 18zM385 459c8-5 15-11 21-17l12-21 12-20a114 114 0 0 1 24-23l39-16-8 7a102 102 0 0 0-28 35l-13 21c-5 7-12 13-19 18l-40 16zM461 442c0-9 1-18 5-27 2-4 6-8 10-10 38-23 26-17 43-24l22-10c-63 37-32 19-18 10l39-15c-17 12-37 20-54 32l-22 9c-14 7-4 2 30-18l-3 2-6 5-3 2-2 3c-3 7-3 15-3 22l-38 19z" style="fill:#000"/>
|
|
23
|
+
<path d="M285 467c7-4 12-10 17-16l9-15 39-17-9 15c-5 6-10 13-16 18l-40 15z" style="fill:#000"/>
|
|
24
|
+
</svg>
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@media screen {
|
|
2
|
+
/* --- Reset Styles --- */
|
|
3
|
+
* {
|
|
4
|
+
list-style: none;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
html, body {
|
|
10
|
+
height: 100%;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* --- Welcome Page Styles --- */
|
|
15
|
+
body {
|
|
16
|
+
background-color: lightblue;
|
|
17
|
+
color: #333;
|
|
18
|
+
font-family: Sans-Serif;
|
|
19
|
+
line-height: 18px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.wrapper {
|
|
23
|
+
background: #fff;
|
|
24
|
+
-moz-box-shadow: 0 0 10px rgba(0,0,0,.3);
|
|
25
|
+
-webkit-box-shadow: 0 0 10px rgba(0,0,0,.3);
|
|
26
|
+
box-shadow: 0 0 10px rgba(0,0,0,.3);
|
|
27
|
+
margin: 16px auto;
|
|
28
|
+
max-width: 960px;
|
|
29
|
+
padding: 2.25%; /* 18px / 800px */
|
|
30
|
+
width: 85%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 36px;
|
|
35
|
+
line-height: 54px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
h2 {
|
|
39
|
+
border-bottom: 2px solid #ccc;
|
|
40
|
+
font-size: 24px;
|
|
41
|
+
line-height: 36px;
|
|
42
|
+
margin-bottom: 16px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h3 {
|
|
46
|
+
font-size: 18px;
|
|
47
|
+
line-height: 36px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
p {
|
|
51
|
+
margin-bottom: 18px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.main {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.content {
|
|
59
|
+
float: left;
|
|
60
|
+
width: 60%; /* 480px / 800px */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.sidebar {
|
|
64
|
+
background: #eee;
|
|
65
|
+
border: 1px solid #ccc;
|
|
66
|
+
float: right;
|
|
67
|
+
padding: 2.08333333333%; /* 5px / 240px */
|
|
68
|
+
width: 30%; /* 240px / 800px */
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sidebar ul {
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.branding {
|
|
76
|
+
clear: both;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
footer.branding {
|
|
80
|
+
border-top: 2px solid #ccc;
|
|
81
|
+
margin-top: 20px;
|
|
82
|
+
padding-top: 20px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media screen and (max-width: 600px) {
|
|
87
|
+
.wrapper {
|
|
88
|
+
-moz-box-shadow: none;
|
|
89
|
+
-webkit-box-shadow: none;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
width: auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.content, .sidebar {
|
|
95
|
+
float: none;
|
|
96
|
+
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.sidebar {
|
|
100
|
+
background: transparent;
|
|
101
|
+
border: none;
|
|
102
|
+
border-top: 2px solid #ccc;
|
|
103
|
+
padding: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
h1 {
|
|
107
|
+
font-size: 24px;
|
|
108
|
+
line-height: 36px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
h2 {
|
|
112
|
+
font-size: 18px;
|
|
113
|
+
line-height: 24px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe ApplicationController do
|
|
6
|
+
before do
|
|
7
|
+
get '/'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'responds with HTTP status 200 OK' do
|
|
11
|
+
expect(last_response.status).to eq(200)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'responds with a welcome message' do
|
|
15
|
+
expect(last_response.body).to include('Welcome to the Sinatra Template!')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
File without changes
|