sinator 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +11 -3
- data/LICENSE.txt +1 -1
- data/README.md +33 -29
- data/bin/sinator +1 -2
- data/lib/sinator/templates/Gemfile.erb +12 -11
- data/lib/sinator/templates/Rakefile.erb +2 -2
- data/lib/sinator/templates/config/puma/production.erb +2 -1
- data/lib/sinator/version.rb +1 -1
- data/sinator.gemspec +4 -2
- data/spec/fixtures/config/puma/production.txt +2 -1
- data/spec/fixtures/with_db/gemfile.txt +12 -11
- data/spec/fixtures/with_db/rakefile.txt +1 -1
- data/spec/fixtures/without_db/gemfile.txt +10 -9
- data/spec/spec_helper.rb +3 -0
- metadata +19 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1aa4ae2029c77358b5a30a2232bc6ef5d5d9d9d5cfa3743d1d21cfd6b189fb6c
|
4
|
+
data.tar.gz: e6dbac172b17d025023a058879efd22987707769a71071067e2a73176168585b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b892090a3aa9f4fab41999064d4cbbe2cdbeacf2ddbd75febd404e9209be9612256006c3564d05ed77d56f1be56676a1dfd8bb150d20c9be68971283112fc0d
|
7
|
+
data.tar.gz: 7f92e1055c30eb4c86b5e92a16139b0f5e0a9860b1100c58aa6ce4f956da36e09eb4d49d33bfc4d20208e56f9664c7299379a89f6093badcd68012ef1ab99df7
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
3.1.0:
|
2
|
+
* update encrypted_cookie to version 0.1.0
|
3
|
+
* set stdout and stderr puma on production
|
4
|
+
|
5
|
+
3.0.4:
|
6
|
+
* update existing gems with non specific version
|
7
|
+
* add sassc gem to generated app
|
8
|
+
|
9
|
+
3.0.3:
|
10
|
+
* update gems
|
11
|
+
|
12
|
+
3.0.2:
|
13
|
+
* replace APP_ENV with RACK_ENV
|
14
|
+
|
15
|
+
3.0.1:
|
16
|
+
* update gems
|
17
|
+
|
1
18
|
3.0.0:
|
2
19
|
* set explicit version to all required ruby gems
|
3
20
|
* replace sinatra-asset-pipeline with sprockets
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinator (
|
4
|
+
sinator (3.0.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
diff-lcs (1.2.5)
|
10
|
+
docile (1.3.2)
|
11
|
+
json (2.2.0)
|
10
12
|
rspec (3.2.0)
|
11
13
|
rspec-core (~> 3.2.0)
|
12
14
|
rspec-expectations (~> 3.2.0)
|
@@ -20,14 +22,20 @@ GEM
|
|
20
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
21
23
|
rspec-support (~> 3.2.0)
|
22
24
|
rspec-support (3.2.2)
|
25
|
+
simplecov (0.17.0)
|
26
|
+
docile (~> 1.1)
|
27
|
+
json (>= 1.8, < 3)
|
28
|
+
simplecov-html (~> 0.10.0)
|
29
|
+
simplecov-html (0.10.2)
|
23
30
|
|
24
31
|
PLATFORMS
|
25
32
|
ruby
|
26
33
|
|
27
34
|
DEPENDENCIES
|
28
35
|
bundler (~> 1.7)
|
29
|
-
sinator!
|
30
36
|
rspec (= 3.2.0)
|
37
|
+
simplecov
|
38
|
+
sinator!
|
31
39
|
|
32
40
|
BUNDLED WITH
|
33
|
-
1.
|
41
|
+
1.17.2
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/sinator.svg)](https://badge.fury.io/rb/sinator)
|
2
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/ae5f04c99c02d4efbadd/maintainability)](https://codeclimate.com/github/kuntoaji/sinator/maintainability)
|
3
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/ae5f04c99c02d4efbadd/test_coverage)](https://codeclimate.com/github/kuntoaji/sinator/test_coverage)
|
4
|
+
|
1
5
|
# Background
|
2
6
|
|
3
|
-
Sinator is [Sinatra](http://www.sinatrarb.com/) application
|
7
|
+
Sinator is [Sinatra](http://www.sinatrarb.com/) application generator. It will generate Sinatra application with minimum configuration.
|
4
8
|
The reasons behind this project because I want to create many small web application based on sinatra with other third party ruby gems as foundation.
|
5
9
|
|
6
10
|
# Features
|
7
11
|
* Generate Sinatra based web application without database
|
8
12
|
* Generate Sinatra based web application with PostgreSQL database configuration and Sequel as ORM
|
13
|
+
* Rake task for assets precompile and assets clean
|
9
14
|
|
10
15
|
### Installation
|
11
16
|
|
@@ -20,32 +25,46 @@ gem 'sinator'
|
|
20
25
|
```
|
21
26
|
|
22
27
|
### How to Use
|
23
|
-
|
28
|
+
|
29
|
+
Generate app in current directory without database.
|
24
30
|
|
25
31
|
```
|
26
32
|
sinator -n my_app
|
27
33
|
```
|
28
34
|
|
29
|
-
|
35
|
+
Generate app in target directory without database.
|
30
36
|
|
31
37
|
```
|
32
38
|
sinator -n my_app -t target/dir
|
33
39
|
```
|
34
40
|
|
35
|
-
|
41
|
+
Generate app in current directory with database. `-d` option will generate app with `Sequel` ORM and PostgreSQL adapter.
|
36
42
|
|
37
43
|
```
|
38
44
|
sinator -n my_app -d
|
39
45
|
```
|
46
|
+
Run web server on localhost.
|
47
|
+
|
48
|
+
```
|
49
|
+
bundle exec puma
|
50
|
+
```
|
51
|
+
|
52
|
+
Run application console / interactive mode / IRB.
|
53
|
+
|
54
|
+
```
|
55
|
+
bundle exec tux
|
56
|
+
```
|
40
57
|
|
41
58
|
### Example Usage
|
42
|
-
|
43
|
-
|
59
|
+
|
60
|
+
This example assume that PostgreSQL is already running.
|
61
|
+
See [github.com/kuntoaji/todo_sinator](https://github.com/kuntoaji/todo_sinator) for Todo Application generated with Sinator.
|
44
62
|
1. run `sinator -n my_app -d`
|
45
63
|
2. cd `my_app`
|
46
64
|
3. run `bundle install`
|
47
65
|
4. configure your database setting in `config/database.yml`
|
48
|
-
5. create
|
66
|
+
5. create database with `createdb my_app_development`.
|
67
|
+
6. create file `db/migrations/001_create_artists.rb` and put the following code:
|
49
68
|
|
50
69
|
```ruby
|
51
70
|
Sequel.migration do
|
@@ -62,15 +81,15 @@ For complete example see [github.com/kuntoaji/todo_sinator](https://github.com/k
|
|
62
81
|
end
|
63
82
|
```
|
64
83
|
|
65
|
-
|
66
|
-
|
84
|
+
7. run `rake db:migrate`
|
85
|
+
8. create file `app/models/Artist.rb` and put the following code:
|
67
86
|
|
68
87
|
```ruby
|
69
88
|
class Artist < Sequel::Model
|
70
89
|
end
|
71
90
|
```
|
72
91
|
|
73
|
-
|
92
|
+
9. create file `app/routes/artists.rb` and put the following code:
|
74
93
|
|
75
94
|
```ruby
|
76
95
|
class MyApp
|
@@ -89,7 +108,7 @@ For complete example see [github.com/kuntoaji/todo_sinator](https://github.com/k
|
|
89
108
|
end
|
90
109
|
```
|
91
110
|
|
92
|
-
|
111
|
+
10. create file `app/views/artists/index.erb` and put the following code:
|
93
112
|
|
94
113
|
```erb
|
95
114
|
<h1>List of Artist</h1>
|
@@ -106,21 +125,6 @@ For complete example see [github.com/kuntoaji/todo_sinator](https://github.com/k
|
|
106
125
|
</form>
|
107
126
|
```
|
108
127
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
### List of Ruby Gems
|
113
|
-
|
114
|
-
* sinatra
|
115
|
-
* sinatra-contrib
|
116
|
-
* encrypted_cookie
|
117
|
-
* `Sinatra::Reloader` in development environment only
|
118
|
-
* puma
|
119
|
-
* `Rack::Session::EncryptedCookie`
|
120
|
-
* `Rack::Csrf`
|
121
|
-
* sequel
|
122
|
-
* sequel_pg as PostgreSQL adapter
|
123
|
-
* sprockets
|
124
|
-
* sass
|
125
|
-
* uglifier
|
126
|
-
* tux for console
|
128
|
+
11. run the server `bundle exec puma`
|
129
|
+
12. open url `localhost:9292/artists`
|
130
|
+
13. Enjoy! :)
|
data/bin/sinator
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'sinatra', '2.0
|
4
|
-
gem 'sinatra-contrib', '2.0
|
5
|
-
gem 'encrypted_cookie', '0.0
|
6
|
-
gem 'rack_csrf', '2.6
|
7
|
-
gem 'puma', '3
|
8
|
-
gem 'tux', '0.3
|
9
|
-
gem 'uglifier', '4.
|
10
|
-
gem 'sass', '3.
|
11
|
-
gem '
|
3
|
+
gem 'sinatra', '~> 2.0'
|
4
|
+
gem 'sinatra-contrib', '~> 2.0', require: false
|
5
|
+
gem 'encrypted_cookie', '0.1.0'
|
6
|
+
gem 'rack_csrf', '~> 2.6', require: 'rack/csrf'
|
7
|
+
gem 'puma', '~> 4.3'
|
8
|
+
gem 'tux', '~> 0.3', require: false
|
9
|
+
gem 'uglifier', '~> 4.2', require: false
|
10
|
+
gem 'sass', '~> 3.7', require: false
|
11
|
+
gem 'sassc', '~> 2.2', require: false
|
12
|
+
gem 'sprockets', '~> 4.0'
|
12
13
|
<% if @with_database -%>
|
13
|
-
gem 'sequel', '5
|
14
|
-
gem 'sequel_pg', '1.
|
14
|
+
gem 'sequel', '>= 5'
|
15
|
+
gem 'sequel_pg', '>= 1.12', require: 'sequel'
|
15
16
|
<% end -%>
|
@@ -18,7 +18,7 @@ namespace :db do
|
|
18
18
|
desc "Run migrations"
|
19
19
|
task :migrate, [:version] do |t, args|
|
20
20
|
Sequel.extension :migration
|
21
|
-
db = Sequel.connect(YAML.load_file("#{Sinator::ROOT}/config/database.yml")[ENV['
|
21
|
+
db = Sequel.connect(YAML.load_file("#{Sinator::ROOT}/config/database.yml")[ENV['RACK_ENV']])
|
22
22
|
migration_path = "#{Sinator::ROOT}/db/migrations"
|
23
23
|
|
24
24
|
if args[:version]
|
@@ -30,4 +30,4 @@ namespace :db do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
<% end
|
33
|
+
<% end -%>
|
@@ -3,6 +3,7 @@ bind 'unix:///path/to/shared/tmp/sockets/puma.sock'
|
|
3
3
|
pidfile '/path/to/shared/tmp/pids/puma.pid'
|
4
4
|
ctl_socket = '/path/to/shared/tmp/sockets/pumactl.sock'
|
5
5
|
state_path '/path/to/shared/tmp/sockets/puma.state'
|
6
|
+
stdout_redirect '/path/to/shared/log/stdout.log', '/path/to/shared/log/stderr.log'
|
6
7
|
activate_control_app 'unix:///path/to/shared/tmp/sockets/pumactl.sock'
|
7
8
|
daemonize
|
8
9
|
quiet
|
@@ -13,4 +14,4 @@ preload_app!
|
|
13
14
|
|
14
15
|
before_fork do
|
15
16
|
<%= @app_class_name %>::DB.disconnect if defined?(<%= @app_class_name %>::DB)
|
16
|
-
end
|
17
|
+
end
|
data/lib/sinator/version.rb
CHANGED
data/sinator.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
require 'date'
|
1
2
|
require_relative 'lib/sinator/version'
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = 'sinator'
|
5
6
|
s.version = Sinator::VERSION
|
6
7
|
s.date = Date.today.to_s
|
7
|
-
s.summary =
|
8
|
-
s.description =
|
8
|
+
s.summary = 'Sinatra application generator'
|
9
|
+
s.description = 'Sinator will generate Sinatra application with minimum configuration'
|
9
10
|
s.author = 'Kunto Aji Kristianto'
|
10
11
|
s.email = 'kuntoaji@kaklabs.com'
|
11
12
|
s.files = `git ls-files -z`.split("\x0")
|
@@ -16,4 +17,5 @@ Gem::Specification.new do |s|
|
|
16
17
|
s.required_ruby_version = '>= 2.1'
|
17
18
|
s.add_development_dependency 'bundler', '~> 1.7'
|
18
19
|
s.add_development_dependency 'rspec', '3.2.0'
|
20
|
+
s.add_development_dependency 'simplecov'
|
19
21
|
end
|
@@ -3,6 +3,7 @@ bind 'unix:///path/to/shared/tmp/sockets/puma.sock'
|
|
3
3
|
pidfile '/path/to/shared/tmp/pids/puma.pid'
|
4
4
|
ctl_socket = '/path/to/shared/tmp/sockets/pumactl.sock'
|
5
5
|
state_path '/path/to/shared/tmp/sockets/puma.state'
|
6
|
+
stdout_redirect '/path/to/shared/log/stdout.log', '/path/to/shared/log/stderr.log'
|
6
7
|
activate_control_app 'unix:///path/to/shared/tmp/sockets/pumactl.sock'
|
7
8
|
daemonize
|
8
9
|
quiet
|
@@ -13,4 +14,4 @@ preload_app!
|
|
13
14
|
|
14
15
|
before_fork do
|
15
16
|
MyApp::DB.disconnect if defined?(MyApp::DB)
|
16
|
-
end
|
17
|
+
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'sinatra', '2.0
|
4
|
-
gem 'sinatra-contrib', '2.0
|
5
|
-
gem 'encrypted_cookie', '0.0
|
6
|
-
gem 'rack_csrf', '2.6
|
7
|
-
gem 'puma', '3
|
8
|
-
gem 'tux', '0.3
|
9
|
-
gem 'uglifier', '4.
|
10
|
-
gem 'sass', '3.
|
11
|
-
gem '
|
12
|
-
gem '
|
13
|
-
gem '
|
3
|
+
gem 'sinatra', '~> 2.0'
|
4
|
+
gem 'sinatra-contrib', '~> 2.0', require: false
|
5
|
+
gem 'encrypted_cookie', '0.1.0'
|
6
|
+
gem 'rack_csrf', '~> 2.6', require: 'rack/csrf'
|
7
|
+
gem 'puma', '~> 4.3'
|
8
|
+
gem 'tux', '~> 0.3', require: false
|
9
|
+
gem 'uglifier', '~> 4.2', require: false
|
10
|
+
gem 'sass', '~> 3.7', require: false
|
11
|
+
gem 'sassc', '~> 2.2', require: false
|
12
|
+
gem 'sprockets', '~> 4.0'
|
13
|
+
gem 'sequel', '>= 5'
|
14
|
+
gem 'sequel_pg', '>= 1.12', require: 'sequel'
|
@@ -18,7 +18,7 @@ namespace :db do
|
|
18
18
|
desc "Run migrations"
|
19
19
|
task :migrate, [:version] do |t, args|
|
20
20
|
Sequel.extension :migration
|
21
|
-
db = Sequel.connect(YAML.load_file("#{Sinator::ROOT}/config/database.yml")[ENV['
|
21
|
+
db = Sequel.connect(YAML.load_file("#{Sinator::ROOT}/config/database.yml")[ENV['RACK_ENV']])
|
22
22
|
migration_path = "#{Sinator::ROOT}/db/migrations"
|
23
23
|
|
24
24
|
if args[:version]
|
@@ -1,11 +1,12 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'sinatra', '2.0
|
4
|
-
gem 'sinatra-contrib', '2.0
|
5
|
-
gem 'encrypted_cookie', '0.0
|
6
|
-
gem 'rack_csrf', '2.6
|
7
|
-
gem 'puma', '3
|
8
|
-
gem 'tux', '0.3
|
9
|
-
gem 'uglifier', '4.
|
10
|
-
gem 'sass', '3.
|
11
|
-
gem '
|
3
|
+
gem 'sinatra', '~> 2.0'
|
4
|
+
gem 'sinatra-contrib', '~> 2.0', require: false
|
5
|
+
gem 'encrypted_cookie', '0.1.0'
|
6
|
+
gem 'rack_csrf', '~> 2.6', require: 'rack/csrf'
|
7
|
+
gem 'puma', '~> 4.3'
|
8
|
+
gem 'tux', '~> 0.3', require: false
|
9
|
+
gem 'uglifier', '~> 4.2', require: false
|
10
|
+
gem 'sass', '~> 3.7', require: false
|
11
|
+
gem 'sassc', '~> 2.2', require: false
|
12
|
+
gem 'sprockets', '~> 4.0'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kunto Aji Kristianto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,8 +38,21 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.2.0
|
41
|
-
|
42
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Sinator will generate Sinatra application with minimum configuration
|
43
56
|
email: kuntoaji@kaklabs.com
|
44
57
|
executables:
|
45
58
|
- sinator
|
@@ -120,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
133
|
- !ruby/object:Gem::Version
|
121
134
|
version: '0'
|
122
135
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.6.13
|
136
|
+
rubygems_version: 3.1.2
|
125
137
|
signing_key:
|
126
138
|
specification_version: 4
|
127
|
-
summary: Sinatra application
|
139
|
+
summary: Sinatra application generator
|
128
140
|
test_files: []
|