punk 0.3.6 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +1091 -93
- data/.standard.yml +2 -0
- data/Gemfile +60 -60
- data/Gemfile.lock +22 -17
- data/README.md +7 -3
- data/Rakefile +9 -7
- data/VERSION +1 -1
- data/app/migrations/001_lets_punk.rb +1 -1
- data/app/routes/hello.rb +1 -1
- data/bin/punk +5 -5
- data/lib/punk.rb +7 -7
- data/lib/punk/actions/sessions/create.rb +3 -3
- data/lib/punk/actions/sessions/verify.rb +2 -2
- data/lib/punk/commands/auth.rb +4 -4
- data/lib/punk/commands/generate.rb +5 -5
- data/lib/punk/commands/http.rb +4 -4
- data/lib/punk/commands/list.rb +10 -10
- data/lib/punk/core/app.rb +41 -41
- data/lib/punk/core/boot.rb +5 -5
- data/lib/punk/core/cli.rb +3 -3
- data/lib/punk/core/commander.rb +28 -28
- data/lib/punk/core/commands.rb +8 -8
- data/lib/punk/core/env.rb +27 -27
- data/lib/punk/core/exec.rb +8 -8
- data/lib/punk/core/interface.rb +19 -19
- data/lib/punk/core/load.rb +2 -2
- data/lib/punk/core/logger.rb +3 -3
- data/lib/punk/core/monkey.rb +1 -1
- data/lib/punk/core/pry.rb +2 -2
- data/lib/punk/core/settings.rb +4 -4
- data/lib/punk/core/version.rb +1 -1
- data/lib/punk/core/worker.rb +6 -6
- data/lib/punk/framework/all.rb +8 -8
- data/lib/punk/framework/model.rb +6 -5
- data/lib/punk/framework/plugins/all.rb +1 -1
- data/lib/punk/framework/plugins/validation.rb +8 -8
- data/lib/punk/framework/service.rb +5 -3
- data/lib/punk/framework/worker.rb +3 -3
- data/lib/punk/helpers/all.rb +5 -5
- data/lib/punk/helpers/loggable.rb +3 -3
- data/lib/punk/helpers/publishable.rb +1 -1
- data/lib/punk/helpers/renderable.rb +10 -10
- data/lib/punk/helpers/validatable.rb +7 -6
- data/lib/punk/migrations/001_punk.rb +12 -12
- data/lib/punk/models/group.rb +1 -1
- data/lib/punk/models/identity.rb +1 -1
- data/lib/punk/models/session.rb +7 -7
- data/lib/punk/models/tenant.rb +1 -1
- data/lib/punk/models/user.rb +2 -2
- data/lib/punk/plugins/all.rb +2 -2
- data/lib/punk/plugins/cors.rb +2 -2
- data/lib/punk/plugins/ssl.rb +1 -1
- data/lib/punk/routes/groups.rb +1 -1
- data/lib/punk/routes/plivo.rb +1 -1
- data/lib/punk/routes/sessions.rb +2 -2
- data/lib/punk/routes/swagger.rb +2 -2
- data/lib/punk/routes/tenants.rb +1 -1
- data/lib/punk/routes/users.rb +1 -1
- data/lib/punk/services/challenge_claim.rb +5 -5
- data/lib/punk/services/generate_swagger.rb +6 -6
- data/lib/punk/services/prove_claim.rb +1 -1
- data/lib/punk/startup/cache.rb +3 -3
- data/lib/punk/startup/database.rb +4 -4
- data/lib/punk/startup/environment.rb +6 -6
- data/lib/punk/startup/logger.rb +2 -2
- data/lib/punk/startup/task.rb +5 -5
- data/lib/punk/views/fail.rb +2 -2
- data/lib/punk/views/groups/list.rb +2 -2
- data/lib/punk/views/info.rb +2 -2
- data/lib/punk/views/plivo_store.rb +2 -2
- data/lib/punk/views/sessions/list.rb +2 -2
- data/lib/punk/views/sessions/pending.rb +2 -2
- data/lib/punk/views/tenants/list.rb +2 -2
- data/lib/punk/views/users/list.rb +2 -2
- data/lib/punk/views/users/show.rb +2 -2
- data/lib/punk/workers/geocode_session_worker.rb +3 -3
- data/lib/punk/workers/identify_session_worker.rb +1 -1
- data/lib/punk/workers/send_email_worker.rb +3 -3
- data/lib/punk/workers/send_sms_worker.rb +3 -3
- data/punk.gemspec +8 -4
- data/spec/actions/groups/punk/list_groups_action_spec.rb +9 -9
- data/spec/actions/sessions/punk/clear_session_action_spec.rb +11 -11
- data/spec/actions/sessions/punk/create_session_action_spec.rb +9 -9
- data/spec/actions/sessions/punk/list_sessions_action_spec.rb +8 -8
- data/spec/actions/sessions/punk/verify_session_action_spec.rb +24 -24
- data/spec/actions/tenants/punk/list_tenants_action_spec.rb +6 -6
- data/spec/actions/users/punk/list_group_users_action_spec.rb +6 -6
- data/spec/actions/users/punk/list_tenant_users_action_spec.rb +6 -6
- data/spec/factories/group.rb +1 -1
- data/spec/factories/group_user_metadata.rb +1 -1
- data/spec/factories/identity.rb +4 -4
- data/spec/factories/session.rb +1 -1
- data/spec/factories/tenant.rb +1 -1
- data/spec/factories/tenant_user_metadata.rb +1 -1
- data/spec/factories/user.rb +1 -1
- data/spec/lib/commands/generate_spec.rb +2 -2
- data/spec/lib/commands/list_spec.rb +2 -2
- data/spec/lib/commands/swagger_spec.rb +2 -2
- data/spec/lib/engine/punk_env_spec.rb +4 -4
- data/spec/lib/engine/punk_exec_spec.rb +2 -2
- data/spec/lib/engine/punk_init_spec.rb +2 -2
- data/spec/lib/engine/punk_store_spec.rb +2 -2
- data/spec/models/punk/group_spec.rb +4 -4
- data/spec/models/punk/group_user_metadata_spec.rb +2 -2
- data/spec/models/punk/identity_spec.rb +17 -17
- data/spec/models/punk/session_spec.rb +4 -4
- data/spec/models/punk/tenant_spec.rb +3 -3
- data/spec/models/punk/tenant_user_metadata_spec.rb +2 -2
- data/spec/models/punk/user_spec.rb +9 -9
- data/spec/routes/groups/get_groups_spec.rb +4 -4
- data/spec/routes/plivo/get_plivo_spec.rb +1 -1
- data/spec/routes/sessions/delete_session_spec.rb +1 -1
- data/spec/routes/sessions/get_sessions_spec.rb +5 -5
- data/spec/routes/sessions/patch_session_spec.rb +1 -1
- data/spec/routes/sessions/post_session_spec.rb +1 -1
- data/spec/routes/swagger/get_swagger_spec.rb +1 -1
- data/spec/routes/tenants/get_tenants_spec.rb +5 -5
- data/spec/routes/users/get_users_spec.rb +6 -6
- data/spec/services/punk/challenge_claim_service_spec.rb +2 -2
- data/spec/services/punk/create_identities_service_spec.rb +1 -1
- data/spec/services/punk/generate_swagger_service_spec.rb +2 -2
- data/spec/services/punk/prove_claim_service_spec.rb +2 -2
- data/spec/services/punk/secret_service_spec.rb +2 -2
- data/spec/spec_helper.rb +27 -27
- data/spec/views/punk/plivo_store_spec.rb +2 -2
- data/spec/views/sessions/punk/list_sessions_view_spec.rb +2 -2
- data/spec/views/sessions/punk/pending_session_view_spec.rb +2 -2
- data/spec/views/tenants/punk/list_tenants_view_spec.rb +2 -2
- data/spec/views/users/punk/list_groups_view_spec.rb +2 -2
- data/spec/views/users/punk/list_users_view_spec.rb +2 -2
- data/spec/workers/punk/geocode_session_worker_spec.rb +2 -2
- data/spec/workers/punk/identify_session_worker_spec.rb +3 -3
- data/spec/workers/punk/send_email_worker_spec.rb +1 -1
- metadata +18 -3
data/.standard.yml
ADDED
data/Gemfile
CHANGED
@@ -1,120 +1,120 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Startup
|
6
|
-
gem
|
6
|
+
gem "bootsnap", "~> 1.7"
|
7
7
|
|
8
8
|
# Dependency Injection
|
9
|
-
gem
|
9
|
+
gem "dim", "~> 1.2"
|
10
10
|
|
11
11
|
# Loose Coupling
|
12
|
-
gem
|
12
|
+
gem "wisper", "~> 2.0"
|
13
13
|
|
14
14
|
# Logging
|
15
|
-
gem
|
16
|
-
gem
|
15
|
+
gem "papertrail", "~> 0.11"
|
16
|
+
gem "semantic_logger", "~> 4.7"
|
17
17
|
|
18
18
|
# Configuration
|
19
|
-
gem
|
20
|
-
gem
|
19
|
+
gem "dotenv", "~> 2.7"
|
20
|
+
gem "dot_hash", "~> 1.1"
|
21
21
|
|
22
22
|
# Commands
|
23
|
-
gem
|
23
|
+
gem "commander", "~> 4.5"
|
24
24
|
|
25
25
|
# CLI
|
26
|
-
gem
|
26
|
+
gem "pry", "~> 0.14"
|
27
27
|
|
28
28
|
# Rack Server
|
29
|
-
gem
|
30
|
-
gem
|
31
|
-
gem
|
32
|
-
gem
|
33
|
-
gem
|
29
|
+
gem "puma", "~> 5.2"
|
30
|
+
gem "rack-cors", "~> 1.1"
|
31
|
+
gem "rack-protection", "~> 2.1"
|
32
|
+
gem "rack-ssl-enforcer", "~> 0.2"
|
33
|
+
gem "rack-unreloader", "~> 1.7"
|
34
34
|
|
35
35
|
# Caching
|
36
|
-
gem
|
36
|
+
gem "dalli", "~> 2.7"
|
37
37
|
|
38
38
|
# Database
|
39
|
-
gem
|
40
|
-
gem
|
39
|
+
gem "pg", "~> 1.2"
|
40
|
+
gem "sequel_pg", "~> 1.14"
|
41
41
|
|
42
42
|
# ORM
|
43
|
-
gem
|
43
|
+
gem "sequel", "~> 5.42"
|
44
44
|
|
45
45
|
# State Machine
|
46
|
-
gem
|
46
|
+
gem "aasm", "~> 5.1"
|
47
47
|
|
48
48
|
# Authentication
|
49
|
-
gem
|
50
|
-
gem
|
51
|
-
gem
|
52
|
-
gem
|
49
|
+
gem "http-accept", "~> 2.1"
|
50
|
+
gem "ipstack", "~> 0.1"
|
51
|
+
gem "rbnacl", "~> 7.1"
|
52
|
+
gem "userstack", "~> 0.1"
|
53
53
|
|
54
54
|
# Jobs
|
55
|
-
gem
|
56
|
-
gem
|
55
|
+
gem "sidekiq", "~> 6.1"
|
56
|
+
gem "sidekiq-cron", "~> 1.2"
|
57
57
|
|
58
58
|
# Email
|
59
|
-
gem
|
59
|
+
gem "mailgun-ruby", "~> 1.2"
|
60
60
|
|
61
61
|
# SMS
|
62
|
-
gem
|
62
|
+
gem "plivo", "~> 4.16"
|
63
63
|
|
64
64
|
# HTTP Framework
|
65
|
-
gem
|
66
|
-
gem
|
65
|
+
gem "roda", "~> 3.41"
|
66
|
+
gem "roda-route_list", "~> 2.1"
|
67
67
|
|
68
68
|
# HTML Rendering
|
69
|
-
gem
|
69
|
+
gem "slim", "~> 4.1"
|
70
70
|
|
71
71
|
# JSON Rendering
|
72
|
-
gem
|
73
|
-
gem
|
74
|
-
gem
|
72
|
+
gem "jbuilder", "~> 2.11"
|
73
|
+
gem "oj", "~> 3.11"
|
74
|
+
gem "tilt-jbuilder", "~> 0.7"
|
75
75
|
|
76
76
|
# Documentation Generation
|
77
|
-
gem
|
78
|
-
gem
|
77
|
+
gem "rdoc", "~> 6.3"
|
78
|
+
gem "swagger_yard", "~> 1.0"
|
79
79
|
|
80
80
|
# Railsy
|
81
|
-
gem
|
81
|
+
gem "activesupport", "~> 6.1"
|
82
82
|
|
83
83
|
# Monitoring
|
84
|
-
gem
|
85
|
-
gem
|
86
|
-
gem
|
84
|
+
gem "sentry-ruby", "~> 4.2"
|
85
|
+
gem "sentry-sidekiq", "~> 4.2"
|
86
|
+
gem "skylight", "~> 4.3"
|
87
87
|
|
88
88
|
# Phone Numbers
|
89
|
-
gem
|
89
|
+
gem "phony", "~> 2.18"
|
90
90
|
|
91
91
|
# Development
|
92
92
|
group :development do
|
93
|
-
gem
|
94
|
-
gem
|
95
|
-
gem
|
93
|
+
gem "bundler", "~> 1.17"
|
94
|
+
gem "gemfile_updater", "~> 0.1"
|
95
|
+
gem "juwelier", "~> 2.4"
|
96
96
|
end
|
97
97
|
|
98
98
|
# Testing
|
99
99
|
group :test do
|
100
|
-
gem
|
101
|
-
gem
|
102
|
-
gem
|
103
|
-
gem
|
104
|
-
gem
|
105
|
-
gem
|
106
|
-
gem
|
107
|
-
gem
|
108
|
-
gem
|
109
|
-
gem
|
110
|
-
gem
|
111
|
-
gem
|
112
|
-
gem 'webmock', '~> 3.12'
|
100
|
+
gem "coveralls_reborn", "~> 0.20"
|
101
|
+
gem "factory_bot", "~> 6.1"
|
102
|
+
gem "faker", "~> 2.16"
|
103
|
+
gem "rack-test", "~> 1.1"
|
104
|
+
gem "rspec", "~> 3.10"
|
105
|
+
gem "rspec-its", "~> 1.3"
|
106
|
+
gem "rubocop-rails", "~> 2.9"
|
107
|
+
gem "rubocop-rspec", "~> 2.2"
|
108
|
+
gem "rubocop-sequel", "~> 0.2"
|
109
|
+
gem "timecop", "~> 0.9"
|
110
|
+
gem "vcr", "~> 6.0"
|
111
|
+
gem "webmock", "~> 3.12"
|
113
112
|
end
|
114
113
|
|
115
114
|
# Non-production
|
116
115
|
group :development, :test do
|
117
|
-
gem
|
118
|
-
gem
|
119
|
-
gem
|
116
|
+
gem "amazing_print", "~> 1.2"
|
117
|
+
gem "byebug", "~> 11.1"
|
118
|
+
gem "launchy", "~> 2.5"
|
119
|
+
gem "standard", "~> 1.0"
|
120
120
|
end
|
data/Gemfile.lock
CHANGED
@@ -24,12 +24,11 @@ GEM
|
|
24
24
|
highline (~> 2.0.0)
|
25
25
|
concurrent-ruby (1.1.8)
|
26
26
|
connection_pool (2.2.3)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
tins (~> 1.6)
|
27
|
+
coveralls_reborn (0.20.0)
|
28
|
+
simplecov (>= 0.18.1, < 0.22.0)
|
29
|
+
term-ansicolor (~> 1.6)
|
30
|
+
thor (>= 0.20.3, < 2.0)
|
31
|
+
tins (~> 1.16)
|
33
32
|
crack (0.4.5)
|
34
33
|
rexml
|
35
34
|
dalli (2.7.11)
|
@@ -78,7 +77,6 @@ GEM
|
|
78
77
|
nokogiri (>= 1.8, < 2.0)
|
79
78
|
jbuilder (2.11.2)
|
80
79
|
activesupport (>= 5.0.0)
|
81
|
-
json (2.5.1)
|
82
80
|
juwelier (2.4.9)
|
83
81
|
builder
|
84
82
|
bundler
|
@@ -96,8 +94,8 @@ GEM
|
|
96
94
|
semver2 (~> 3)
|
97
95
|
launchy (2.5.0)
|
98
96
|
addressable (~> 2.7)
|
99
|
-
mailgun-ruby (1.2.
|
100
|
-
rest-client (
|
97
|
+
mailgun-ruby (1.2.3)
|
98
|
+
rest-client (>= 2.0.2)
|
101
99
|
method_source (1.0.0)
|
102
100
|
mime-types (3.3.1)
|
103
101
|
mime-types-data (~> 3.2015)
|
@@ -109,7 +107,7 @@ GEM
|
|
109
107
|
multi_xml (0.6.0)
|
110
108
|
multipart-post (2.1.1)
|
111
109
|
netrc (0.11.0)
|
112
|
-
nio4r (2.5.
|
110
|
+
nio4r (2.5.7)
|
113
111
|
nokogiri (1.11.1)
|
114
112
|
mini_portile2 (~> 2.5.0)
|
115
113
|
racc (~> 1.4)
|
@@ -139,7 +137,7 @@ GEM
|
|
139
137
|
method_source (~> 1.0)
|
140
138
|
psych (3.3.1)
|
141
139
|
public_suffix (4.0.6)
|
142
|
-
puma (5.2.
|
140
|
+
puma (5.2.2)
|
143
141
|
nio4r (~> 2.0)
|
144
142
|
raabro (1.4.0)
|
145
143
|
racc (1.5.2)
|
@@ -196,6 +194,9 @@ GEM
|
|
196
194
|
unicode-display_width (>= 1.4.0, < 3.0)
|
197
195
|
rubocop-ast (1.4.1)
|
198
196
|
parser (>= 2.7.1.5)
|
197
|
+
rubocop-performance (1.10.1)
|
198
|
+
rubocop (>= 0.90.0, < 2.0)
|
199
|
+
rubocop-ast (>= 0.4.0)
|
199
200
|
rubocop-rails (2.9.1)
|
200
201
|
activesupport (>= 4.2.0)
|
201
202
|
rack (>= 1.1)
|
@@ -229,11 +230,12 @@ GEM
|
|
229
230
|
sidekiq-cron (1.2.0)
|
230
231
|
fugit (~> 1.1)
|
231
232
|
sidekiq (>= 4.2.1)
|
232
|
-
simplecov (0.
|
233
|
+
simplecov (0.21.2)
|
233
234
|
docile (~> 1.1)
|
234
|
-
|
235
|
-
|
236
|
-
simplecov-html (0.
|
235
|
+
simplecov-html (~> 0.11)
|
236
|
+
simplecov_json_formatter (~> 0.1)
|
237
|
+
simplecov-html (0.12.3)
|
238
|
+
simplecov_json_formatter (0.1.2)
|
237
239
|
skylight (4.3.2)
|
238
240
|
skylight-core (= 4.3.2)
|
239
241
|
skylight-core (4.3.2)
|
@@ -241,6 +243,9 @@ GEM
|
|
241
243
|
slim (4.1.0)
|
242
244
|
temple (>= 0.7.6, < 0.9)
|
243
245
|
tilt (>= 2.0.6, < 2.1)
|
246
|
+
standard (1.0.1)
|
247
|
+
rubocop (= 1.11.0)
|
248
|
+
rubocop-performance (= 1.10.1)
|
244
249
|
swagger_yard (1.0.4)
|
245
250
|
parslet
|
246
251
|
yard
|
@@ -284,7 +289,7 @@ DEPENDENCIES
|
|
284
289
|
bundler (~> 1.17)
|
285
290
|
byebug (~> 11.1)
|
286
291
|
commander (~> 4.5)
|
287
|
-
|
292
|
+
coveralls_reborn (~> 0.20)
|
288
293
|
dalli (~> 2.7)
|
289
294
|
dim (~> 1.2)
|
290
295
|
dot_hash (~> 1.1)
|
@@ -316,7 +321,6 @@ DEPENDENCIES
|
|
316
321
|
roda-route_list (~> 2.1)
|
317
322
|
rspec (~> 3.10)
|
318
323
|
rspec-its (~> 1.3)
|
319
|
-
rubocop (~> 1.11)
|
320
324
|
rubocop-rails (~> 2.9)
|
321
325
|
rubocop-rspec (~> 2.2)
|
322
326
|
rubocop-sequel (~> 0.2)
|
@@ -329,6 +333,7 @@ DEPENDENCIES
|
|
329
333
|
sidekiq-cron (~> 1.2)
|
330
334
|
skylight (~> 4.3)
|
331
335
|
slim (~> 4.1)
|
336
|
+
standard (~> 1.0)
|
332
337
|
swagger_yard (~> 1.0)
|
333
338
|
tilt-jbuilder (~> 0.7)
|
334
339
|
timecop (~> 0.9)
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
1
2
|
[![test](https://github.com/kranzky/punk/workflows/test/badge.svg)](https://github.com/kranzky/punk/actions?query=workflow%3Atest)
|
2
3
|
[![Coverage Status](https://coveralls.io/repos/github/kranzky/punk/badge.svg?branch=main)](https://coveralls.io/github/kranzky/punk?branch=main)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/punk.svg)](https://badge.fury.io/rb/punk)
|
5
|
+
[![Western Australia](https://corona.kranzky.com/oc/anz/au/wa/badge.svg)](https://corona.kranzky.com?region=oc&subregion=anz&country=au&state=wa)
|
4
6
|
|
5
7
|
# Punk!
|
6
8
|
|
@@ -8,9 +10,11 @@ Punk! is an omakase web framework for rapid prototyping.
|
|
8
10
|
|
9
11
|
## Release Process
|
10
12
|
|
11
|
-
1. `rake
|
12
|
-
2. `rake
|
13
|
-
3.
|
13
|
+
1. `rake standard:fix`
|
14
|
+
2. `rake version:bump:whatever`
|
15
|
+
3. `rake gemspec:release BRANCH=main`
|
16
|
+
4. `rake git:release BRANCH=main`
|
17
|
+
5. Create new release on GitHub to trigger ship workflow
|
14
18
|
|
15
19
|
## Copyright
|
16
20
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler"
|
5
5
|
begin
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
@@ -9,8 +9,8 @@ rescue Bundler::BundlerError => e
|
|
9
9
|
warn "Run `bundle install` to install missing gems"
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
|
-
require
|
13
|
-
require
|
12
|
+
require "rake"
|
13
|
+
require "juwelier"
|
14
14
|
Juwelier::Tasks.new do |gem|
|
15
15
|
gem.name = "punk"
|
16
16
|
gem.homepage = "https://github.com/kranzky/punk"
|
@@ -19,11 +19,13 @@ Juwelier::Tasks.new do |gem|
|
|
19
19
|
gem.description = ""
|
20
20
|
gem.email = "lloyd@kranzky.com"
|
21
21
|
gem.authors = ["Lloyd Kranzky"]
|
22
|
-
gem.required_ruby_version = ">= 2.
|
22
|
+
gem.required_ruby_version = ">= 2.6"
|
23
23
|
end
|
24
24
|
Juwelier::RubygemsDotOrgTasks.new
|
25
25
|
|
26
|
-
require
|
26
|
+
require "yard"
|
27
27
|
YARD::Rake::YardocTask.new
|
28
28
|
|
29
|
-
|
29
|
+
require "standard/rake"
|
30
|
+
|
31
|
+
task default: [:clean, "standard:fix"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.1
|
data/app/routes/hello.rb
CHANGED
data/bin/punk
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require_relative
|
5
|
+
require "bundler/setup"
|
6
|
+
require "commander/import"
|
7
|
+
require_relative "../lib/punk"
|
8
8
|
|
9
|
-
PUNK.init(task:
|
9
|
+
PUNK.init(task: "script", config: {app: {name: "Punk!"}}).config
|
10
10
|
|
11
11
|
program :name, PUNK.get.app.name
|
12
12
|
program :version, PUNK.version
|
13
|
-
program :description,
|
13
|
+
program :description, "An omakase web framework for rapid prototyping."
|
14
14
|
|
15
15
|
PUNK.commands(:commander)
|
16
16
|
|
data/lib/punk.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "bootsnap"
|
4
4
|
|
5
|
-
env = ENV.fetch(
|
5
|
+
env = ENV.fetch("PUNK_ENV") { ENV.store("PUNK_ENV", "development") }
|
6
6
|
|
7
7
|
if defined?(Bootsnap)
|
8
8
|
# TODO: update gem and check setup options
|
9
9
|
Bootsnap.setup(
|
10
|
-
cache_dir:
|
11
|
-
development_mode: env ==
|
10
|
+
cache_dir: "tmp/cache",
|
11
|
+
development_mode: env == "development",
|
12
12
|
load_path_cache: true,
|
13
13
|
compile_cache_iseq: true,
|
14
14
|
compile_cache_yaml: true
|
@@ -16,9 +16,9 @@ if defined?(Bootsnap)
|
|
16
16
|
end
|
17
17
|
|
18
18
|
module PUNK
|
19
|
-
def self.init(task:
|
20
|
-
require_relative
|
21
|
-
raise InternalServerError,
|
19
|
+
def self.init(task: "server", path: "./app", config: {})
|
20
|
+
require_relative "punk/core/interface"
|
21
|
+
raise InternalServerError, "Cannot call PUNK.init multiple times!" if state != :included
|
22
22
|
store.args = OpenStruct.new(
|
23
23
|
task: task,
|
24
24
|
path: path,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "uri"
|
4
|
+
require "phony"
|
5
5
|
|
6
6
|
module PUNK
|
7
7
|
class CreateSessionAction < Action
|
@@ -56,7 +56,7 @@ module PUNK
|
|
56
56
|
claim.downcase.strip
|
57
57
|
when :phone
|
58
58
|
phone = claim.strip
|
59
|
-
phone = "+1#{phone}"
|
59
|
+
phone = "+1#{phone}" unless /^[+]/.match?(phone)
|
60
60
|
"+#{Phony.normalize(phone)}"
|
61
61
|
end
|
62
62
|
end
|