flame 5.0.0.rc6 → 5.0.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 944d28e5edaf52ca1e890e95213993137cbe1f8dbce55037034da7f4563aa982
4
- data.tar.gz: 4ffebec0a643722ed7fa1a093fa998879d17c6b8202478abf3fac09869ba7ed0
3
+ metadata.gz: 7315121f3053afad8cf444fba552c484d15d7bf0ab66268c72e7945693430e1a
4
+ data.tar.gz: 19d9c0362c1c9082c323eae5838c661bf830218fc44a9b6f4cd5961ff27282e6
5
5
  SHA512:
6
- metadata.gz: 770935368f96ca01e869be4b3aae7b92876a9f97cfed969e1a72a2f535c5dd90afe479565210e758f6306a42289e8c7604af8b0d9af6e681341de86ba7c58920
7
- data.tar.gz: 79a879f862861ed89a19446b00380d70b7d57b37ca3c8e8fe64b3a20d8e00ccbb38ddafba0b87cfea1382444d66941fe5b0637d1ba689cad4e98f4f00b722c93
6
+ metadata.gz: 7bcdb7cec68a9d29ef1beada369bca88ee69bee503c8b61476d2d5b7884d243f11443b0b924946480cefa62c12408d92bde60e251fead449d615287efc3ff4aa
7
+ data.tar.gz: b4f2c55a038b4228f132c396babebfac92ad35bf9ebe120ec88bba20bcb6d6ea4d080b622e87eb1d043f920882eb53368afabd05f004c0659709c9e99e832b04
data/CHANGELOG.md CHANGED
@@ -4,18 +4,21 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## Unreleased
6
6
 
7
- ## 5.0.0.rc6 (2021-02-10)
8
-
9
7
  ### Added
10
8
 
9
+ * Add ability for controllers auto-mounting \
10
+ Good bye giant application `mount` blocks! \
11
+ But you can disable it with `nested: false` option for `mount`,
12
+ for example, for conditional umbrella application.
13
+ * Allow to mount anonymous controllers
14
+ * Add support for Ruby 3.0
11
15
  * Add support of `OPTIONS` HTTP-method
12
- * Add specs for application generator, including application start
13
16
  * Add `Application.require_dirs` method
14
17
  * Add `Controller#path_to_back` method
15
- * Receive options for Tilt in `Controller#(render|view)` method
16
- via `:tilt` argument
18
+ * Add `:log_dir` for default config
19
+ * Add `:require` option for `Config#load_yaml`
20
+ * Receive options for Tilt in `Controller#(render|view)` method via `:tilt` argument
17
21
  * Add support of block for `Controller#render` method
18
- * Add support for Ruby 2.5
19
22
  * Add metadata to Gem specification with links
20
23
  * Add required Ruby version into Gem specification
21
24
  * Add `Controller.with_actions` method for modules
@@ -23,30 +26,33 @@ All notable changes to this project will be documented in this file.
23
26
  * Allow to render view by relative path from current view
24
27
  * Add ability for refining HTTP-methods of actions inside controllers \
25
28
  Now you can not use `post`, `patch` and others inside `mount` blocks, yay!
26
- * Add `:ignore` parameter for `Application.require_dirs`
27
29
  * Catch `SyntaxError` for custom Internal Server Error page
28
30
  * Add `:only` option to `#with_actions` method
29
31
  * Add cache for `Controller#url_to` in production via `memery` gem
30
32
  * Add ability to refine actions in modules \
31
33
  Just `extend Flame::Controller::Actions` in module now,
32
34
  and than `include with_actions ThatModule`, as before.
33
- * Add ability for controllers auto-mounting \
34
- Good bye giant application `mount` blocks! \
35
- But you can disable it with `nested: false` option for `mount`,
36
- for example, for conditional umbrella application.
37
35
  * Add `Flame::Router::Routes#to_s`, for routes printing
38
36
  ```ruby
39
37
  puts MyApplication.router.routes
40
38
  ```
41
39
  * Add `Request#headers` method (with Camel-Cased Hash)
42
- * Allow to mount anonymous controllers
40
+ * Accept options for cookies setting
41
+ * Add `Flame::Path#include?` method, forwarding to `#to_s`
42
+ * Allow integration with `better_errors` gem \
43
+ More info [here](https://github.com/BetterErrors/better_errors/issues/454).
44
+ * Add RuboCop plugins, resolve offenses by them
45
+ * Add `remark` Markdown linter
43
46
 
44
47
 
45
48
  ### Changed
46
49
 
47
50
  * Replace Array-based routes system with Hash-based
48
- * Refactor `flame new` command of executable file
49
- * Update template for application generator
51
+ * Move `flame` executable and `template/` to separated gem
52
+ `flame-cli`, not required by default.
53
+ * Take out `Config` from `Flame::Application` to `Flame` \
54
+ Now it's possible to load config before routes (and models). \
55
+ Also add `ConfigFileNotFoundError`.
50
56
  * Replace `URI` building with `Addressable::URI` from external gem
51
57
  * Replace `no-cache` with `public` and `max-age` (one year)
52
58
  for `Cache-Control` header for static files
@@ -68,35 +74,37 @@ All notable changes to this project will be documented in this file.
68
74
  I think it's unnecessary for API-like usage.
69
75
  * Slightly optimize `StaticFile`
70
76
  * Build query in `#path_to` from root-Hash \
71
- Now building a path with merged query parameters is easier,
72
- no more `params: {}`.
77
+ Now building a path with merged query parameters is easier, no more `params: {}`.
73
78
  * Run `Controller#not_found` through `execute` \
74
79
  For found nearest routes. \
75
80
  Now we can write before-hooks in `execute` also for nonexistent pages.
76
81
  * Don't assign results of `execute` (after-hooks) as `body`
77
82
  * Require directories starting with `_` first
78
83
  * Allow to redefine controller path with `PATH` constant inside
79
- * Update RuboCop to version 0.65.0, resolve some new offenses \
80
- Also lock at the patch version instead of minor, cause it's still in alpha.
81
- * Move `flame` executable and `template/` to separated gem
82
- `flame-cli`, not required by default.
84
+ * Update RuboCop to a new version, resolve new offenses.
83
85
  * Improve version locks for dependencies
86
+ * Use Depfu instead of closed Gemnasium
84
87
 
85
88
  ### Removed
86
89
 
87
90
  * Remove `Application#config` and `Application#router` methods
88
- * Remove Ruby 2.3 support
91
+ * Remove Ruby < 2.6 support
92
+ * Remove HTML tags (`<h1>`) from default body \
93
+ There is no `Content-Type` HTTP header, also there is no reason to return exactly HTML content \
94
+ (Flame can be used only for API or something else).
89
95
 
90
96
  ### Fixed
91
97
 
92
98
  * Fix issue with `nil` in after-hook which returned 404 status
93
99
  * Fix routing to path without an optional argument at the beginning
100
+ * Fix routing for multiple routes starting with arguments \
101
+ Example: parent controller with `show(id)` and nested controller at `/:parent_id/nested`.
102
+ * Avoid new controller creation in `halt`
94
103
 
95
104
  ### Security
96
105
 
97
106
  * Fix exploit with static files \
98
- You could get the content of any file
99
- from the outside of public directory. \
107
+ You could get the content of any file from the outside of public directory. \
100
108
  It did not work with `nginx`, Cloudflare or something else.
101
109
 
102
110
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <img
3
- src="https://raw.githubusercontent.com/AlexWayfer/flame/master/public/favicon.ico"
3
+ src="https://raw.githubusercontent.com/AlexWayfer/flame/main/public/favicon.ico"
4
4
  height="150"
5
5
  alt="Flame Logo"
6
6
  title="Logo from open-source Elusive-Iconfont (https://github.com/reduxframework/elusive-iconfont)"
@@ -10,8 +10,8 @@
10
10
  <h1 align="center">Flame</h1>
11
11
 
12
12
  <p align="center">
13
- <a href="https://cirrus-ci.com/github/AlexWayfer/flame/master"><img
14
- src="https://api.cirrus-ci.com/github/AlexWayfer/flame.svg?branch=master"
13
+ <a href="https://cirrus-ci.com/github/AlexWayfer/flame/main"><img
14
+ src="https://api.cirrus-ci.com/github/AlexWayfer/flame.svg?branch=main"
15
15
  alt="Cirrus CI"
16
16
  /></a>
17
17
  <a href="https://codecov.io/gh/AlexWayfer/flame"><img
@@ -27,14 +27,14 @@
27
27
  alt="Depfu"
28
28
  /></a>
29
29
  <a href="http://inch-ci.org/github/AlexWayfer/flame"><img
30
- src="http://inch-ci.org/github/AlexWayfer/flame.svg?branch=master&style=flat-square"
30
+ src="http://inch-ci.org/github/AlexWayfer/flame.svg?branch=main&style=flat-square"
31
31
  alt="Docs"
32
32
  /></a>
33
33
  <a href="https://rubygems.org/gems/flame"><img
34
- src="https://img.shields.io/gem/v/flame.svg?style=flat-square"
35
- alt="Gem"
34
+ src="https://img.shields.io/gem/v/flame.svg?include_prereleases&style=flat-square"
35
+ alt="Gem (including prereleases)"
36
36
  /></a>
37
- <a href="https://github.com/AlexWayfer/flame/blob/master/LICENSE.txt"><img
37
+ <a href="https://github.com/AlexWayfer/flame/blob/main/LICENSE.txt"><img
38
38
  src="https://img.shields.io/github/license/AlexWayfer/flame.svg?style=flat-square"
39
39
  alt="MIT license"
40
40
  /></a>
data/lib/flame/config.rb CHANGED
@@ -17,7 +17,7 @@ module Flame
17
17
  super()
18
18
  replace DEFAULT_DIRS.merge(
19
19
  root_dir: File.realpath(root_dir),
20
- environment: ENV['RACK_ENV'] || 'development'
20
+ environment: ENV.fetch('RACK_ENV', 'development')
21
21
  )
22
22
  end
23
23
 
@@ -53,7 +53,7 @@ module Flame
53
53
  file_path = find_config_file file, required: required
54
54
  return unless file_path
55
55
 
56
- yaml = YAML.load_file(file_path)
56
+ yaml = YAML.load_file(file_path, aliases: true)
57
57
  key ||= File.basename(file, '.*')
58
58
  self[key.to_sym] = yaml if set
59
59
  yaml
@@ -33,11 +33,8 @@ module Flame
33
33
  env.each_with_object({}) do |(key, value), result|
34
34
  next unless key.start_with?(HEADER_PREFIX)
35
35
 
36
- ## TODO: Replace `String#[]` with `#delete_prefix`
37
- ## after Ruby < 2.5 dropping
38
36
  camelized_key =
39
- key[HEADER_PREFIX.size..-1].downcase.tr('_', '/')
40
- .camelize.gsub('::', '-')
37
+ key.delete_prefix(HEADER_PREFIX).downcase.tr('_', '/').camelize.gsub('::', '-')
41
38
 
42
39
  result[camelized_key] = value
43
40
  end
@@ -124,7 +124,7 @@ module Flame
124
124
  def dump_error(error)
125
125
  error_message = [
126
126
  "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} - " \
127
- "#{error.class} - #{error.message}:",
127
+ "#{error.class} - #{error.message}:",
128
128
  *error.backtrace
129
129
  ].join("\n\t")
130
130
  @env[Rack::RACK_ERRORS].puts(error_message)
@@ -9,11 +9,9 @@ module Flame
9
9
  ## @param wrong_ordered_arguments [Array<Symbol>]
10
10
  ## two wrong ordered arguments
11
11
  def initialize(path, wrong_ordered_arguments)
12
- super(
13
- "Path '#{path}' should have" \
14
- " '#{wrong_ordered_arguments.first}' argument before" \
15
- " '#{wrong_ordered_arguments.last}'"
16
- )
12
+ super(<<~MESSAGE.chomp)
13
+ Path '#{path}' should have '#{wrong_ordered_arguments.first}' argument before '#{wrong_ordered_arguments.last}'
14
+ MESSAGE
17
15
  end
18
16
  end
19
17
  end
@@ -23,10 +23,7 @@ module Flame
23
23
  path: "Action '#{ctrl}##{action}'"
24
24
  }[extra[:place]]
25
25
 
26
- super(
27
- "#{entity} has no " \
28
- "#{extra[:type_name]} arguments #{extra[:args].inspect}"
29
- )
26
+ super "#{entity} has no #{extra[:type_name]} arguments #{extra[:args].inspect}"
30
27
  end
31
28
  end
32
29
  end
@@ -10,8 +10,8 @@ module Flame
10
10
  ## @param action [Symbol] action with which route not found
11
11
  def initialize(controller, action)
12
12
  super(
13
- "Route with controller '#{controller}' and action '#{action}'" \
14
- ' not found in application routes'
13
+ "Route with controller '#{controller}' and action '#{action}' " \
14
+ 'not found in application routes'
15
15
  )
16
16
  end
17
17
  end
data/lib/flame/path.rb CHANGED
@@ -122,10 +122,10 @@ module Flame
122
122
  ## Not argument
123
123
  return part unless part.arg?
124
124
  ## Not required argument
125
- return args.delete(part[2..-1].to_sym) if part.opt_arg?
125
+ return args.delete(part[2..].to_sym) if part.opt_arg?
126
126
 
127
127
  ## Required argument
128
- param = args.delete(part[1..-1].to_sym)
128
+ param = args.delete(part[1..].to_sym)
129
129
  ## Required argument is nil
130
130
  error = Errors::ArgumentNotAssignedError.new(@path, part)
131
131
  raise error if param.nil?
@@ -17,7 +17,7 @@ module Flame
17
17
  path = Flame::Path.new(*path_parts)
18
18
  return if path.parts.empty?
19
19
 
20
- nested_routes = self.class.new Flame::Path.new(*path.parts[1..-1])
20
+ nested_routes = self.class.new Flame::Path.new(*path.parts[1..])
21
21
  # path.parts.reduce(result) do |hash, part|
22
22
  # hash[part] ||= self.class.new
23
23
  # end
@@ -63,8 +63,8 @@ module Flame
63
63
  endpoint =
64
64
  self[path_parts.first] || dig(first_opt_arg_key, path_parts.first)
65
65
 
66
- endpoint&.navigate(*path_parts[1..-1]) ||
67
- find_among_arg_keys(path_parts[1..-1])
66
+ endpoint&.navigate(*path_parts[1..]) ||
67
+ find_among_arg_keys(path_parts[1..])
68
68
  end
69
69
 
70
70
  ## Dig through optional arguments as keys
@@ -106,10 +106,7 @@ module Flame
106
106
  def sort
107
107
  sort_by do |key, _value|
108
108
  [
109
- if key.is_a?(Symbol)
110
- then Router::HTTP_METHODS.index(key)
111
- else Float::INFINITY
112
- end,
109
+ key.is_a?(Symbol) ? Router::HTTP_METHODS.index(key) : Float::INFINITY,
113
110
  key.to_s
114
111
  ]
115
112
  end
data/lib/flame/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flame
4
- VERSION = '5.0.0.rc6'
4
+ VERSION = '5.0.0.rc7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flame
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc6
4
+ version: 5.0.0.rc7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '5'
61
+ - !ruby/object:Gem::Dependency
62
+ name: psych
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '4.0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: rack
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -120,42 +134,42 @@ dependencies:
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: 0.7.0
137
+ version: 0.9.0
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: 0.7.0
144
+ version: 0.9.0
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: gem_toys
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: 0.6.0
151
+ version: 0.12.1
138
152
  type: :development
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: 0.6.0
158
+ version: 0.12.1
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: toys
147
161
  requirement: !ruby/object:Gem::Requirement
148
162
  requirements:
149
163
  - - "~>"
150
164
  - !ruby/object:Gem::Version
151
- version: 0.11.0
165
+ version: 0.13.1
152
166
  type: :development
153
167
  prerelease: false
154
168
  version_requirements: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
- version: 0.11.0
172
+ version: 0.13.1
159
173
  - !ruby/object:Gem::Dependency
160
174
  name: better_errors
161
175
  requirement: !ruby/object:Gem::Requirement
@@ -176,28 +190,28 @@ dependencies:
176
190
  requirements:
177
191
  - - "~>"
178
192
  - !ruby/object:Gem::Version
179
- version: 0.4.3
193
+ version: 0.6.0
180
194
  type: :development
181
195
  prerelease: false
182
196
  version_requirements: !ruby/object:Gem::Requirement
183
197
  requirements:
184
198
  - - "~>"
185
199
  - !ruby/object:Gem::Version
186
- version: 0.4.3
200
+ version: 0.6.0
187
201
  - !ruby/object:Gem::Dependency
188
202
  name: rack-test
189
203
  requirement: !ruby/object:Gem::Requirement
190
204
  requirements:
191
205
  - - "~>"
192
206
  - !ruby/object:Gem::Version
193
- version: '1.1'
207
+ version: '2.0'
194
208
  type: :development
195
209
  prerelease: false
196
210
  version_requirements: !ruby/object:Gem::Requirement
197
211
  requirements:
198
212
  - - "~>"
199
213
  - !ruby/object:Gem::Version
200
- version: '1.1'
214
+ version: '2.0'
201
215
  - !ruby/object:Gem::Dependency
202
216
  name: rspec
203
217
  requirement: !ruby/object:Gem::Requirement
@@ -232,14 +246,14 @@ dependencies:
232
246
  requirements:
233
247
  - - "~>"
234
248
  - !ruby/object:Gem::Version
235
- version: '1.3'
249
+ version: 1.35.0
236
250
  type: :development
237
251
  prerelease: false
238
252
  version_requirements: !ruby/object:Gem::Requirement
239
253
  requirements:
240
254
  - - "~>"
241
255
  - !ruby/object:Gem::Version
242
- version: '1.3'
256
+ version: 1.35.0
243
257
  - !ruby/object:Gem::Dependency
244
258
  name: rubocop-performance
245
259
  requirement: !ruby/object:Gem::Requirement
@@ -314,11 +328,13 @@ homepage: https://github.com/AlexWayfer/flame
314
328
  licenses:
315
329
  - MIT
316
330
  metadata:
331
+ rubygems_mfa_required: 'true'
317
332
  bug_tracker_uri: https://github.com/AlexWayfer/flame/issues
318
- documentation_uri: http://www.rubydoc.info/gems/flame/5.0.0.rc6
333
+ changelog_uri: https://github.com/AlexWayfer/flame/blob/v5.0.0.rc7/CHANGELOG.md
334
+ documentation_uri: http://www.rubydoc.info/gems/flame/5.0.0.rc7
335
+ homepage_uri: https://github.com/AlexWayfer/flame
319
336
  source_code_uri: https://github.com/AlexWayfer/flame
320
337
  wiki_uri: https://github.com/AlexWayfer/flame/wiki
321
- homepage_uri: https://github.com/AlexWayfer/flame
322
338
  post_install_message:
323
339
  rdoc_options: []
324
340
  require_paths:
@@ -327,14 +343,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
343
  requirements:
328
344
  - - ">="
329
345
  - !ruby/object:Gem::Version
330
- version: '2.5'
346
+ version: '2.6'
347
+ - - "<"
348
+ - !ruby/object:Gem::Version
349
+ version: '4'
331
350
  required_rubygems_version: !ruby/object:Gem::Requirement
332
351
  requirements:
333
352
  - - ">"
334
353
  - !ruby/object:Gem::Version
335
354
  version: 1.3.1
336
355
  requirements: []
337
- rubygems_version: 3.2.3
356
+ rubygems_version: 3.3.7
338
357
  signing_key:
339
358
  specification_version: 4
340
359
  summary: Web-framework, based on MVC-pattern