rack-app-front_end 0.22.0 → 0.22.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -7
- data/VERSION +1 -1
- data/lib/rack/app/front_end/template/cache.rb +22 -0
- data/lib/rack/app/front_end/template.rb +2 -1
- data/lib/rack/app/front_end.rb +8 -12
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e83e039143d1598c031eb90fa0158a842608b8780e9631bb07612dac85824e1
|
4
|
+
data.tar.gz: e534b974a020a200a3016a3b2a6af4d16fd6eac1b98a6d05ad9c1c4d798594d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597b6ff04e6d70a658a05e7b7fcce295609ed68972c9e558430cf7f74e6726694f18dc394b71418d7ec078598a60168b3c220a55ee0de7cd1850c021f541fc25
|
7
|
+
data.tar.gz: f2989d2fb0747aa3ee6ce6b71a7b4fa7c40a25cdd0191d314b1ce7ecbca505fbc7d5a37aee0c321f4c207d7d6ecf1c7d49112010135bbb4521217b2e7b3b1cbb
|
data/README.md
CHANGED
@@ -20,20 +20,22 @@ Or install it yourself as:
|
|
20
20
|
## Usage
|
21
21
|
|
22
22
|
```ruby
|
23
|
+
require 'rack/app'
|
24
|
+
require 'rack/app/front_end'
|
23
25
|
|
24
26
|
class App < Rack::App
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
|
28
|
+
apply_extensions :front_end
|
29
|
+
|
28
30
|
mount_folder '/from/project/root/path'
|
29
|
-
|
31
|
+
|
30
32
|
mount_folder 'relative/folder/from/this/file/to/folder'
|
31
|
-
|
33
|
+
|
32
34
|
get '/some_url' do
|
33
35
|
@items = []
|
34
36
|
render 'some.html.erb'
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
end
|
38
40
|
|
39
41
|
```
|
@@ -48,4 +50,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
48
50
|
## Contributing
|
49
51
|
|
50
52
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rack-app-mvc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
51
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.22.
|
1
|
+
0.22.2
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Rack::App::FrontEnd::Template::Cache
|
2
|
+
def initialize
|
3
|
+
@cache = {}
|
4
|
+
end
|
5
|
+
|
6
|
+
# Caches a value for key, or returns the previously cached value.
|
7
|
+
# If a value has been previously cached for key then it is
|
8
|
+
# returned. Otherwise, block is yielded to and its return value
|
9
|
+
# which may be nil, is cached under key and returned.
|
10
|
+
# @yield
|
11
|
+
# @yieldreturn the value to cache for key
|
12
|
+
def fetch(*key)
|
13
|
+
@cache.fetch(key) do
|
14
|
+
@cache[key] = yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Clears the cache.
|
19
|
+
def clear
|
20
|
+
@cache = {}
|
21
|
+
end
|
22
|
+
end
|
@@ -2,11 +2,12 @@ require 'tilt'
|
|
2
2
|
class Rack::App::FrontEnd::Template
|
3
3
|
|
4
4
|
require 'rack/app/front_end/template/scope'
|
5
|
+
require 'rack/app/front_end/template/cache'
|
5
6
|
require 'rack/app/front_end/template/default_layout'
|
6
7
|
require 'rack/app/front_end/template/default_template'
|
7
8
|
|
8
9
|
def self.cache
|
9
|
-
@cache ||=
|
10
|
+
@cache ||= Rack::App::FrontEnd::Template::Cache.new
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.template?(file_path)
|
data/lib/rack/app/front_end.rb
CHANGED
@@ -37,25 +37,21 @@ module Rack::App::FrontEnd
|
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
Rack::App::Extension.register :front_end do
|
41
41
|
|
42
|
-
Rack::App::
|
42
|
+
include Rack::App::FrontEnd::EndpointMethods
|
43
|
+
extend Rack::App::FrontEnd::SingletonMethods
|
43
44
|
|
44
|
-
|
45
|
-
extend Rack::App::FrontEnd::SingletonMethods
|
45
|
+
on_inheritance do |parent, child|
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
child.layout(parent.layout)
|
50
|
-
|
51
|
-
child.helpers do
|
52
|
-
include(parent.helpers)
|
53
|
-
end
|
47
|
+
child.layout(parent.layout)
|
54
48
|
|
49
|
+
child.helpers do
|
50
|
+
include(parent.helpers)
|
55
51
|
end
|
56
52
|
|
57
53
|
end
|
58
54
|
|
59
55
|
end
|
60
|
-
|
56
|
+
|
61
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app-front_end
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.
|
4
|
+
version: 0.22.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/rack/app/front_end/syntax_sugar.rb
|
114
114
|
- lib/rack/app/front_end/syntax_sugar/dsl.rb
|
115
115
|
- lib/rack/app/front_end/template.rb
|
116
|
+
- lib/rack/app/front_end/template/cache.rb
|
116
117
|
- lib/rack/app/front_end/template/default_layout.rb
|
117
118
|
- lib/rack/app/front_end/template/default_template.rb
|
118
119
|
- lib/rack/app/front_end/template/scope.rb
|
@@ -123,7 +124,7 @@ homepage: http://www.rack-app.com/
|
|
123
124
|
licenses:
|
124
125
|
- Apache License 2.0
|
125
126
|
metadata: {}
|
126
|
-
post_install_message:
|
127
|
+
post_install_message:
|
127
128
|
rdoc_options: []
|
128
129
|
require_paths:
|
129
130
|
- lib
|
@@ -138,9 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
- !ruby/object:Gem::Version
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
|
-
|
142
|
-
|
143
|
-
signing_key:
|
142
|
+
rubygems_version: 3.4.10
|
143
|
+
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Rack::App FrontEnd framework to create beautiful website with style
|
146
146
|
test_files: []
|