makanai 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ci.yml +48 -0
- data/.rubocop.yml +11 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +59 -48
- data/README.md +32 -26
- data/lib/makanai/application.rb +2 -2
- data/lib/makanai/dsl.rb +1 -1
- data/lib/makanai/generator/application/templates/gemfile.erb +6 -1
- data/lib/makanai/generator.rb +1 -1
- data/lib/makanai/model.rb +3 -1
- data/lib/makanai/rake_tasks.rb +3 -3
- data/lib/makanai/request.rb +2 -2
- data/lib/makanai/template_engine/erb.rb +1 -0
- data/lib/makanai/version.rb +1 -1
- data/makanai.gemspec +6 -3
- data/sample/Gemfile +9 -0
- metadata +57 -13
- data/.travis.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f69d757dc8cea982beb740cbd336682340611a9a38d30806f6957307acb46f
|
4
|
+
data.tar.gz: f3347824ed5141509983ed0e892d1b41ea85a853ff20ae099c08c313da890ba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 611484278736c1625b16bf9d2127281b28716dcb9d85f6b0266074edad72963e1426bd282de376bb1b8a5823e71a20744413807301d9cfe14347a338fc77f56f
|
7
|
+
data.tar.gz: f16b7030bd5b779a69fe7fdb1af9f776bfcefd36d7d8c54cabffe1925ad8c82487e2036ba77ca4b5faa5cd8f6f80130e85a567765651ca84b14ce2e6ed22680d
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: ["2.7", "3.0", "3.1"]
|
11
|
+
services:
|
12
|
+
postgres:
|
13
|
+
image: postgres
|
14
|
+
ports:
|
15
|
+
- 5432:5432
|
16
|
+
env:
|
17
|
+
POSTGRES_USER: makanai
|
18
|
+
POSTGRES_PASSWORD: password
|
19
|
+
mysql:
|
20
|
+
image: mysql
|
21
|
+
ports:
|
22
|
+
- 3306:3306
|
23
|
+
env:
|
24
|
+
MYSQL_DATABASE: makanai
|
25
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v2
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- name: cache ruby deps
|
33
|
+
uses: actions/cache@v1
|
34
|
+
with:
|
35
|
+
path: vendor/bundle
|
36
|
+
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
37
|
+
restore-keys: |
|
38
|
+
${{ runner.os }}-gem-
|
39
|
+
- name: install bundler
|
40
|
+
run: gem install bundler -v 2.3.22
|
41
|
+
- name: install ruby deps
|
42
|
+
run: bundle install --jobs 4 --retry 3 --path vendor/bundle
|
43
|
+
- name: lint
|
44
|
+
run: bundle exec rubocop --parallel
|
45
|
+
- name: test
|
46
|
+
run: bundle exec rspec
|
47
|
+
env:
|
48
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
data/.rubocop.yml
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.7.0
|
3
2
|
NewCops: enable
|
4
3
|
Exclude:
|
5
|
-
-
|
6
|
-
-
|
4
|
+
- "./makanai.gemspec"
|
5
|
+
- "vendor/**/*"
|
7
6
|
|
8
7
|
Metrics/ClassLength:
|
9
8
|
Max: 120
|
10
9
|
|
11
10
|
Metrics/BlockLength:
|
12
11
|
Exclude:
|
13
|
-
-
|
14
|
-
-
|
12
|
+
- "spec/**/*"
|
13
|
+
- "lib/makanai/rake_tasks.rb"
|
15
14
|
|
16
15
|
Style/Documentation:
|
17
16
|
Enabled: false
|
@@ -33,3 +32,10 @@ Layout/LineLength:
|
|
33
32
|
|
34
33
|
Layout/EmptyLineAfterGuardClause:
|
35
34
|
Enabled: false
|
35
|
+
|
36
|
+
Style/HashSyntax:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/OpenStructUse:
|
40
|
+
Exclude:
|
41
|
+
- "spec/**/*"
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.2
|
data/CHANGELOG.md
CHANGED
@@ -46,3 +46,13 @@
|
|
46
46
|
|
47
47
|
* :zap: remove sqlite3 from runtime_dependency.
|
48
48
|
https://github.com/Madogiwa0124/makanai/commit/d63c3b12cf6fc412a8d88806dca9710e210e5fe0
|
49
|
+
|
50
|
+
## :gift: 2021/01/05 `v0.1.7` released.
|
51
|
+
* :package: dependency update.
|
52
|
+
* :gem: supported ruby `3.0.0`.
|
53
|
+
https://github.com/Madogiwa0124/makanai/pull/82
|
54
|
+
|
55
|
+
## :gift: 2022/09/17 `v0.1.8` released.
|
56
|
+
* :package: dependency update.
|
57
|
+
* :gem: supported rack `3.0.0`.
|
58
|
+
https://github.com/madogiwa0124/makanai/pull/162
|
data/Gemfile.lock
CHANGED
@@ -1,68 +1,77 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
makanai (0.1.
|
5
|
-
rack (>= 2.0.7, <
|
4
|
+
makanai (0.1.8)
|
5
|
+
rack (>= 2.0.7, < 3.1.0)
|
6
|
+
rackup (~> 0.2)
|
6
7
|
rake (>= 10, < 14)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
ast (2.4.
|
12
|
-
codecov (0.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
diff-lcs (1.3)
|
18
|
-
docile (1.3.2)
|
19
|
-
haml (5.1.2)
|
12
|
+
ast (2.4.2)
|
13
|
+
codecov (0.6.0)
|
14
|
+
simplecov (>= 0.15, < 0.22)
|
15
|
+
diff-lcs (1.5.0)
|
16
|
+
docile (1.4.0)
|
17
|
+
haml (5.2.2)
|
20
18
|
temple (>= 0.8.0)
|
21
19
|
tilt
|
22
|
-
json (2.
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
json (2.6.2)
|
21
|
+
mini_portile2 (2.8.0)
|
22
|
+
mysql2 (0.5.4)
|
23
|
+
parallel (1.22.1)
|
24
|
+
parser (3.1.2.1)
|
26
25
|
ast (~> 2.4.1)
|
27
|
-
pg (1.
|
28
|
-
rack (
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
rspec-
|
39
|
-
|
26
|
+
pg (1.4.3)
|
27
|
+
rack (3.0.0)
|
28
|
+
rackup (0.2.2)
|
29
|
+
rack (>= 3.0.0.beta1)
|
30
|
+
webrick
|
31
|
+
rainbow (3.1.1)
|
32
|
+
rake (13.0.6)
|
33
|
+
regexp_parser (2.5.0)
|
34
|
+
rexml (3.2.5)
|
35
|
+
rspec (3.11.0)
|
36
|
+
rspec-core (~> 3.11.0)
|
37
|
+
rspec-expectations (~> 3.11.0)
|
38
|
+
rspec-mocks (~> 3.11.0)
|
39
|
+
rspec-core (3.11.0)
|
40
|
+
rspec-support (~> 3.11.0)
|
41
|
+
rspec-expectations (3.11.0)
|
40
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-mocks (3.
|
43
|
+
rspec-support (~> 3.11.0)
|
44
|
+
rspec-mocks (3.11.0)
|
43
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-
|
46
|
-
|
46
|
+
rspec-support (~> 3.11.0)
|
47
|
+
rspec-retry (0.6.2)
|
48
|
+
rspec-core (> 3.3)
|
49
|
+
rspec-support (3.11.0)
|
50
|
+
rubocop (1.36.0)
|
51
|
+
json (~> 2.3)
|
47
52
|
parallel (~> 1.10)
|
48
|
-
parser (>=
|
53
|
+
parser (>= 3.1.2.1)
|
49
54
|
rainbow (>= 2.2.2, < 4.0)
|
50
|
-
regexp_parser (>= 1.
|
51
|
-
rexml
|
52
|
-
rubocop-ast (>=
|
55
|
+
regexp_parser (>= 1.8, < 3.0)
|
56
|
+
rexml (>= 3.2.5, < 4.0)
|
57
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
53
58
|
ruby-progressbar (~> 1.7)
|
54
|
-
unicode-display_width (>= 1.4.0, <
|
55
|
-
rubocop-ast (
|
56
|
-
parser (>=
|
57
|
-
ruby-progressbar (1.
|
58
|
-
simplecov (0.
|
59
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
60
|
+
rubocop-ast (1.21.0)
|
61
|
+
parser (>= 3.1.1.0)
|
62
|
+
ruby-progressbar (1.11.0)
|
63
|
+
simplecov (0.21.2)
|
59
64
|
docile (~> 1.1)
|
60
65
|
simplecov-html (~> 0.11)
|
61
|
-
|
62
|
-
|
66
|
+
simplecov_json_formatter (~> 0.1)
|
67
|
+
simplecov-html (0.12.3)
|
68
|
+
simplecov_json_formatter (0.1.3)
|
69
|
+
sqlite3 (1.5.0)
|
70
|
+
mini_portile2 (~> 2.8.0)
|
63
71
|
temple (0.8.2)
|
64
72
|
tilt (2.0.10)
|
65
|
-
unicode-display_width (
|
73
|
+
unicode-display_width (2.3.0)
|
74
|
+
webrick (1.7.0)
|
66
75
|
|
67
76
|
PLATFORMS
|
68
77
|
ruby
|
@@ -75,8 +84,10 @@ DEPENDENCIES
|
|
75
84
|
mysql2 (~> 0.5)
|
76
85
|
pg (~> 1.2)
|
77
86
|
rspec (~> 3.0)
|
78
|
-
|
79
|
-
|
87
|
+
rspec-retry (~> 0.6)
|
88
|
+
rubocop (~> 1.0)
|
89
|
+
sqlite3 (~> 1.5.0)
|
90
|
+
webrick (~> 1.7.0)
|
80
91
|
|
81
92
|
BUNDLED WITH
|
82
|
-
2.
|
93
|
+
2.3.22
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Makanai
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/makanai.svg)](https://badge.fury.io/rb/makanai)
|
4
|
-
[![
|
5
|
-
[![codecov](https://codecov.io/gh/Madogiwa0124/makanai/branch/
|
4
|
+
[![CI](https://github.com/madogiwa0124/makanai/actions/workflows/ci.yml/badge.svg)](https://github.com/madogiwa0124/makanai/actions/workflows/ci.yml)
|
5
|
+
[![codecov](https://codecov.io/gh/Madogiwa0124/makanai/branch/main/graph/badge.svg)](https://codecov.io/gh/Madogiwa0124/makanai)
|
6
6
|
|
7
7
|
simple web application framework for learning.
|
8
8
|
|
@@ -25,6 +25,7 @@ Or install it yourself as:
|
|
25
25
|
$ gem install makanai
|
26
26
|
|
27
27
|
## Start sample project
|
28
|
+
|
28
29
|
Getting started with Makanai is easy.
|
29
30
|
|
30
31
|
```
|
@@ -32,16 +33,16 @@ $ mkdir sample
|
|
32
33
|
$ cd sample
|
33
34
|
$ makanai init
|
34
35
|
$ ruby app.rb
|
35
|
-
[
|
36
|
-
[
|
37
|
-
[
|
36
|
+
[2021-01-05 09:37:09] INFO WEBrick 1.7.0
|
37
|
+
[2021-01-05 09:37:09] INFO ruby 3.0.0 (2020-12-25) [x86_64-darwin18]
|
38
|
+
[2021-01-05 09:37:09] INFO WEBrick::HTTPServer#start: pid=10675 port=8080
|
38
39
|
```
|
39
40
|
|
40
41
|
# Usage
|
41
42
|
|
42
43
|
create a ruby file(ex. app.rb).
|
43
44
|
|
44
|
-
```
|
45
|
+
```ruby
|
45
46
|
require 'makanai/main'
|
46
47
|
|
47
48
|
router.get '/' do
|
@@ -49,7 +50,7 @@ router.get '/' do
|
|
49
50
|
end
|
50
51
|
```
|
51
52
|
|
52
|
-
start server(WEBrick) at
|
53
|
+
start server(WEBrick) at execute `$ ruby app.rb`.
|
53
54
|
|
54
55
|
```
|
55
56
|
$ ruby app.rb
|
@@ -61,6 +62,7 @@ $ ruby app.rb
|
|
61
62
|
When accessing root, `Hello Makanai!` is displayed.
|
62
63
|
|
63
64
|
## constitution
|
65
|
+
|
64
66
|
Makanai application has the following constitution.
|
65
67
|
|
66
68
|
```
|
@@ -68,6 +70,8 @@ root ┬ app.rb # main application file
|
|
68
70
|
├ views # views files(ex. index.erb)
|
69
71
|
├ models # models files(ex. post.rb)
|
70
72
|
├ migration # migration files(ex. 00_create_resources.sql)
|
73
|
+
├ Rakefile # rake tasks
|
74
|
+
├ Gemfile # dependencies
|
71
75
|
└ db # use Sqlite3 dabase file
|
72
76
|
```
|
73
77
|
|
@@ -77,7 +81,7 @@ You can overwrite the settings (`Makanai :: Settings`) with the created ruby
|
|
77
81
|
|
78
82
|
ex) When overriding rack app settings.
|
79
83
|
|
80
|
-
```
|
84
|
+
```ruby
|
81
85
|
Makanai::Settings.rack_app_config = { handler: :webrick, host: '0.0.0.0', port: '8081' }
|
82
86
|
```
|
83
87
|
|
@@ -85,13 +89,13 @@ Makanai::Settings.rack_app_config = { handler: :webrick, host: '0.0.0.0', port:
|
|
85
89
|
|
86
90
|
Add rack web server(ex. puma) gem in your Gemfile.
|
87
91
|
|
88
|
-
```
|
92
|
+
```ruby
|
89
93
|
gem 'puma'
|
90
94
|
```
|
91
95
|
|
92
96
|
Overwrite the `handler` in `rack_app_config` with the created ruby file(ex. app.rb).
|
93
97
|
|
94
|
-
```
|
98
|
+
```ruby
|
95
99
|
Makanai::Settings.rack_app_config = { handler: :puma, host: '0.0.0.0', port: '8080' }
|
96
100
|
```
|
97
101
|
|
@@ -101,13 +105,13 @@ Makanai use `sqlite` by default, and make `db/makanai.db`.
|
|
101
105
|
|
102
106
|
If you use another dbms, install dbms(PostgreSQL or MySQL). And add dbms gem (`pg` or `mysql2`) in your Gemfile.
|
103
107
|
|
104
|
-
```
|
108
|
+
```ruby
|
105
109
|
gem 'pg'
|
106
110
|
```
|
107
111
|
|
108
112
|
Overwrite the `databse_client` and `databse_config` with the created ruby file(ex. app.rb) and Rakefile.
|
109
113
|
|
110
|
-
```
|
114
|
+
```ruby
|
111
115
|
Makanai::Settings.databse_client = :postgres
|
112
116
|
Makanai::Settings.databse_config = {
|
113
117
|
host: 'localhost',
|
@@ -118,9 +122,10 @@ Makanai::Settings.databse_config = {
|
|
118
122
|
```
|
119
123
|
|
120
124
|
## routing
|
125
|
+
|
121
126
|
Routing is searched in the order defined and call block args.
|
122
127
|
|
123
|
-
```
|
128
|
+
```ruby
|
124
129
|
require 'makanai/main'
|
125
130
|
|
126
131
|
# root path
|
@@ -169,7 +174,7 @@ end
|
|
169
174
|
|
170
175
|
Define instance variables used in the routing view. And specify template engine(`ERB` or `Haml`).
|
171
176
|
|
172
|
-
```
|
177
|
+
```ruby
|
173
178
|
require 'makanai/main'
|
174
179
|
|
175
180
|
# setting template engine(default: :erb).
|
@@ -192,22 +197,22 @@ Create an erb file in `src/views` with the name specified in render.
|
|
192
197
|
|
193
198
|
erb
|
194
199
|
|
195
|
-
```
|
200
|
+
```html
|
196
201
|
<!-- src/views/index.erb -->
|
197
202
|
<html>
|
198
|
-
<head>
|
199
|
-
|
200
|
-
|
201
|
-
</head>
|
202
|
-
<body>
|
203
|
-
|
204
|
-
</body>
|
203
|
+
<head>
|
204
|
+
<meta charset="UTF-8" />
|
205
|
+
<title><%= @title %></title>
|
206
|
+
</head>
|
207
|
+
<body>
|
208
|
+
<%= @body %>
|
209
|
+
</body>
|
205
210
|
</html>
|
206
211
|
```
|
207
212
|
|
208
213
|
haml
|
209
214
|
|
210
|
-
```
|
215
|
+
```haml
|
211
216
|
!!!
|
212
217
|
%html
|
213
218
|
%head
|
@@ -246,10 +251,11 @@ INFO: finished migration all
|
|
246
251
|
```
|
247
252
|
|
248
253
|
## model
|
254
|
+
|
249
255
|
`Makanai::Model` is simple ORM.
|
250
256
|
It can be used by creating a class that inherits `Makanai::Model`.
|
251
257
|
|
252
|
-
```
|
258
|
+
```ruby
|
253
259
|
require 'makanai/model'
|
254
260
|
|
255
261
|
class Resource < Makanai::Model
|
@@ -291,7 +297,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Madogi
|
|
291
297
|
|
292
298
|
Use docker-compose to build `mysql` and` postgres` containers for development.
|
293
299
|
|
294
|
-
```
|
300
|
+
```sh
|
295
301
|
$ docker-compose up -d
|
296
302
|
Creating makanai_mysql_1 ... done
|
297
303
|
Creating makanai_postgres_1 ... done
|
@@ -309,4 +315,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
309
315
|
|
310
316
|
# Code of Conduct
|
311
317
|
|
312
|
-
Everyone interacting in the makanai project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Madogiwa0124/makanai/blob/
|
318
|
+
Everyone interacting in the makanai project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Madogiwa0124/makanai/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/makanai/application.rb
CHANGED
@@ -20,7 +20,7 @@ module Makanai
|
|
20
20
|
def run!
|
21
21
|
app_config = config.rack_app_config
|
22
22
|
handler = Rack::Handler.get(app_config[:handler])
|
23
|
-
handler.run(self, { Host: app_config[:host], Port: app_config[:port] })
|
23
|
+
handler.run(self, **{ Host: app_config[:host], Port: app_config[:port] })
|
24
24
|
rescue Interrupt
|
25
25
|
handler.shutdown
|
26
26
|
puts '==== Goodbye! :) ===='
|
@@ -30,7 +30,7 @@ module Makanai
|
|
30
30
|
@request = Makanai::Request.new(env)
|
31
31
|
@response = Makanai::Response.new
|
32
32
|
route_result = execute_route
|
33
|
-
return route_result.result if route_result.
|
33
|
+
return route_result.result if route_result.instance_of?(Response)
|
34
34
|
@response.body << execute_route
|
35
35
|
@response.result
|
36
36
|
end
|
data/lib/makanai/dsl.rb
CHANGED
@@ -8,7 +8,7 @@ def render(path, engine = Makanai::Settings.template_engine)
|
|
8
8
|
template_root_path = Makanai::Settings.template_full_path
|
9
9
|
full_path = File.join(template_root_path, path.to_s)
|
10
10
|
# NOTE: Get all instance variables in main by Hash
|
11
|
-
locals = instance_variables.
|
11
|
+
locals = instance_variables.to_h { |name| [name, instance_variable_get(name)] }
|
12
12
|
Makanai::Template.new(path: full_path, engine: engine, locals: locals).render
|
13
13
|
end
|
14
14
|
|
data/lib/makanai/generator.rb
CHANGED
@@ -6,7 +6,7 @@ require_relative '../makanai'
|
|
6
6
|
|
7
7
|
module Makanai
|
8
8
|
class Generator
|
9
|
-
ROOT_PATH = "#{Makanai.root}/lib/makanai/generator"
|
9
|
+
ROOT_PATH = "#{Makanai.root}/lib/makanai/generator".freeze
|
10
10
|
DIRECTORY_NAMES = YAML.load_file("#{ROOT_PATH}/application/directories.yaml")
|
11
11
|
APP_TEMPLATE = File.read("#{ROOT_PATH}/application/templates/app.erb")
|
12
12
|
RAKEFILE_TEMPLATE = File.read("#{ROOT_PATH}/application/templates/rakefile.erb")
|
data/lib/makanai/model.rb
CHANGED
@@ -55,11 +55,13 @@ module Makanai
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.buid_sql_text(value)
|
58
|
+
# rubocop:disable Lint/DuplicateBranch
|
58
59
|
case value
|
59
60
|
when String then "'#{value.gsub(/'/, "''")}'"
|
60
61
|
when Numeric, Integer then value
|
61
62
|
else value
|
62
63
|
end
|
64
|
+
# rubocop:enable Lint/DuplicateBranch
|
63
65
|
end
|
64
66
|
|
65
67
|
def assign_attributes(attributes)
|
@@ -68,7 +70,7 @@ module Makanai
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def attributes
|
71
|
-
origin_attributes.
|
73
|
+
origin_attributes.to_h { |key, _val| [key, send(key)] }
|
72
74
|
end
|
73
75
|
|
74
76
|
def create(db = Makanai::Database.new)
|
data/lib/makanai/rake_tasks.rb
CHANGED
@@ -23,8 +23,8 @@ namespace :makanai do
|
|
23
23
|
task :migration do
|
24
24
|
include Makanai::Migration
|
25
25
|
|
26
|
-
puts "INFO: start migration #{ENV
|
27
|
-
target = ENV
|
26
|
+
puts "INFO: start migration #{ENV.fetch('target', nil)}"
|
27
|
+
target = ENV.fetch('target', nil)
|
28
28
|
pp migration_root_path
|
29
29
|
if target == 'all'
|
30
30
|
sql_paths = Dir.glob("#{migration_root_path}*")
|
@@ -32,7 +32,7 @@ namespace :makanai do
|
|
32
32
|
else
|
33
33
|
execute_sql(sql_path: File.join(migration_root_path, target))
|
34
34
|
end
|
35
|
-
puts "INFO: finished migration #{ENV
|
35
|
+
puts "INFO: finished migration #{ENV.fetch('target', nil)}"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/makanai/request.rb
CHANGED
@@ -34,7 +34,7 @@ module Makanai
|
|
34
34
|
def parsed_body
|
35
35
|
@parsed_body ||= JSON.parse(origin_body)
|
36
36
|
rescue JSON::ParserError
|
37
|
-
@parsed_body ||= origin_body.split('&').
|
37
|
+
@parsed_body ||= origin_body.split('&').to_h { |param| param.split('=') }
|
38
38
|
end
|
39
39
|
|
40
40
|
def parsed_url
|
@@ -49,7 +49,7 @@ module Makanai
|
|
49
49
|
def build_params
|
50
50
|
case env['REQUEST_METHOD']
|
51
51
|
when 'GET'
|
52
|
-
return
|
52
|
+
return URI.decode_www_form(query).to_h if query
|
53
53
|
when 'POST'
|
54
54
|
return parsed_body if origin_body
|
55
55
|
end
|
data/lib/makanai/version.rb
CHANGED
data/makanai.gemspec
CHANGED
@@ -26,12 +26,15 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
28
|
spec.add_dependency "rake", ">= 10", "< 14"
|
29
|
-
spec.add_dependency "rack", ">= 2.0.7", "<
|
30
|
-
spec.
|
31
|
-
spec.add_development_dependency "
|
29
|
+
spec.add_dependency "rack", ">= 2.0.7", "< 3.1.0"
|
30
|
+
spec.add_dependency "rackup", "~> 0.2"
|
31
|
+
spec.add_development_dependency "sqlite3", "~> 1.5.0"
|
32
|
+
spec.add_development_dependency "rubocop", "~> 1.0"
|
32
33
|
spec.add_development_dependency "bundler", "~> 2.0"
|
33
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
spec.add_development_dependency "rspec-retry", "~> 0.6"
|
34
36
|
spec.add_development_dependency "pg", "~> 1.2"
|
35
37
|
spec.add_development_dependency "mysql2", "~> 0.5"
|
38
|
+
spec.add_development_dependency "webrick", "~> 1.7.0"
|
36
39
|
spec.add_development_dependency "haml", "~> 5.0"
|
37
40
|
end
|
data/sample/Gemfile
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: makanai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Madogiwa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 2.0.7
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 3.1.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,35 +49,49 @@ dependencies:
|
|
49
49
|
version: 2.0.7
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 3.1.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rackup
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.2'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.2'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: sqlite3
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
56
70
|
requirements:
|
57
71
|
- - "~>"
|
58
72
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
73
|
+
version: 1.5.0
|
60
74
|
type: :development
|
61
75
|
prerelease: false
|
62
76
|
version_requirements: !ruby/object:Gem::Requirement
|
63
77
|
requirements:
|
64
78
|
- - "~>"
|
65
79
|
- !ruby/object:Gem::Version
|
66
|
-
version: 1.
|
80
|
+
version: 1.5.0
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: rubocop
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
70
84
|
requirements:
|
71
85
|
- - "~>"
|
72
86
|
- !ruby/object:Gem::Version
|
73
|
-
version: '0
|
87
|
+
version: '1.0'
|
74
88
|
type: :development
|
75
89
|
prerelease: false
|
76
90
|
version_requirements: !ruby/object:Gem::Requirement
|
77
91
|
requirements:
|
78
92
|
- - "~>"
|
79
93
|
- !ruby/object:Gem::Version
|
80
|
-
version: '0
|
94
|
+
version: '1.0'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: bundler
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +120,20 @@ dependencies:
|
|
106
120
|
- - "~>"
|
107
121
|
- !ruby/object:Gem::Version
|
108
122
|
version: '3.0'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: rspec-retry
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0.6'
|
130
|
+
type: :development
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0.6'
|
109
137
|
- !ruby/object:Gem::Dependency
|
110
138
|
name: pg
|
111
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +162,20 @@ dependencies:
|
|
134
162
|
- - "~>"
|
135
163
|
- !ruby/object:Gem::Version
|
136
164
|
version: '0.5'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: webrick
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 1.7.0
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 1.7.0
|
137
179
|
- !ruby/object:Gem::Dependency
|
138
180
|
name: haml
|
139
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,11 +198,12 @@ executables:
|
|
156
198
|
extensions: []
|
157
199
|
extra_rdoc_files: []
|
158
200
|
files:
|
201
|
+
- ".github/dependabot.yml"
|
202
|
+
- ".github/workflows/ci.yml"
|
159
203
|
- ".gitignore"
|
160
204
|
- ".rspec"
|
161
205
|
- ".rubocop.yml"
|
162
206
|
- ".ruby-version"
|
163
|
-
- ".travis.yml"
|
164
207
|
- CHANGELOG.md
|
165
208
|
- CODE_OF_CONDUCT.md
|
166
209
|
- Gemfile
|
@@ -199,6 +242,7 @@ files:
|
|
199
242
|
- lib/makanai/template_engine/haml.rb
|
200
243
|
- lib/makanai/version.rb
|
201
244
|
- makanai.gemspec
|
245
|
+
- sample/Gemfile
|
202
246
|
- sample/Rakefile
|
203
247
|
- sample/app.rb
|
204
248
|
- sample/db/.keep
|
@@ -211,7 +255,7 @@ licenses:
|
|
211
255
|
metadata:
|
212
256
|
homepage_uri: https://github.com/Madogiwa0124/makanai
|
213
257
|
source_code_uri: https://github.com/Madogiwa0124/makanai
|
214
|
-
post_install_message:
|
258
|
+
post_install_message:
|
215
259
|
rdoc_options: []
|
216
260
|
require_paths:
|
217
261
|
- lib
|
@@ -226,8 +270,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
270
|
- !ruby/object:Gem::Version
|
227
271
|
version: '0'
|
228
272
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
273
|
+
rubygems_version: 3.3.7
|
274
|
+
signing_key:
|
231
275
|
specification_version: 4
|
232
276
|
summary: simple web application framework for learning.
|
233
277
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
services:
|
5
|
-
- postgresql
|
6
|
-
- mysql
|
7
|
-
rvm:
|
8
|
-
- 2.6.6
|
9
|
-
- 2.7.1
|
10
|
-
- ruby-head
|
11
|
-
os:
|
12
|
-
- linux
|
13
|
-
before_install:
|
14
|
-
- gem install bundler -v 2.1.4
|
15
|
-
- mysql -e 'CREATE DATABASE IF NOT EXISTS makanai;'
|
16
|
-
before_script:
|
17
|
-
- psql -c "create user makanai WITH PASSWORD 'password';" -U postgres
|
18
|
-
- psql -c 'create database makanai;' -U postgres
|
19
|
-
script:
|
20
|
-
- bundle exec rubocop --parallel
|
21
|
-
- bundle exec rspec
|
22
|
-
jobs:
|
23
|
-
allow_failures:
|
24
|
-
- rvm: ruby-head
|