staticky 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +364 -17
  4. data/lib/staticky/application.rb +36 -0
  5. data/lib/staticky/builder.rb +1 -1
  6. data/lib/staticky/cli/commands/build.rb +13 -0
  7. data/lib/staticky/cli/commands/generate.rb +67 -0
  8. data/lib/staticky/cli/commands/version.rb +13 -0
  9. data/lib/staticky/cli/commands.rb +13 -0
  10. data/lib/staticky/cli.rb +0 -60
  11. data/lib/staticky/deps.rb +1 -1
  12. data/lib/staticky/filesystem.rb +0 -3
  13. data/lib/staticky/phlex/view_helpers.rb +6 -2
  14. data/lib/staticky/pluggable.rb +35 -0
  15. data/lib/staticky/resource.rb +14 -15
  16. data/lib/staticky/resources/plugins/phlex.rb +42 -0
  17. data/lib/staticky/resources/plugins/prelude.rb +74 -0
  18. data/lib/staticky/resources/plugins.rb +9 -0
  19. data/lib/staticky/router.rb +13 -18
  20. data/lib/staticky/routing/plugins/prelude.rb +97 -0
  21. data/lib/staticky/routing/plugins.rb +9 -0
  22. data/lib/staticky/server.rb +1 -1
  23. data/lib/staticky/version.rb +1 -1
  24. data/lib/staticky.rb +20 -10
  25. data/site_template/.gitignore +14 -0
  26. data/site_template/.ruby-version +1 -1
  27. data/site_template/Gemfile +4 -3
  28. data/site_template/Procfile.dev +2 -2
  29. data/site_template/README.md +27 -7
  30. data/site_template/Rakefile +31 -2
  31. data/site_template/app/views/layouts/site.rb +2 -2
  32. data/site_template/bin/{lint → setup} +8 -2
  33. data/site_template/config/puma.rb +11 -0
  34. data/site_template/config/staticky.rb +2 -0
  35. data/site_template/lib/icon.rb +1 -1
  36. data/site_template/package.json +1 -1
  37. data/site_template/vite.config.ts +1 -1
  38. metadata +44 -7
  39. data/lib/staticky/container.rb +0 -26
  40. data/lib/staticky/router/definition.rb +0 -49
  41. data/lib/staticky/view_context.rb +0 -17
@@ -8,7 +8,7 @@ export default defineConfig({
8
8
  RubyPlugin(),
9
9
  FullReload(
10
10
  "build/index.html",
11
- { delay: 0 }
11
+ { delay: 500 }
12
12
  ),
13
13
  ],
14
14
  })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staticky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nolan J Tait
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-container
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.11'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.11'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: dry-events
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dry-inflector
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: dry-logger
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -166,21 +194,29 @@ files:
166
194
  - Rakefile
167
195
  - bin/staticky
168
196
  - lib/staticky.rb
197
+ - lib/staticky/application.rb
169
198
  - lib/staticky/builder.rb
170
199
  - lib/staticky/cli.rb
171
- - lib/staticky/container.rb
200
+ - lib/staticky/cli/commands.rb
201
+ - lib/staticky/cli/commands/build.rb
202
+ - lib/staticky/cli/commands/generate.rb
203
+ - lib/staticky/cli/commands/version.rb
172
204
  - lib/staticky/deps.rb
173
205
  - lib/staticky/environment.rb
174
206
  - lib/staticky/error.rb
175
207
  - lib/staticky/filesystem.rb
176
208
  - lib/staticky/generator.rb
177
209
  - lib/staticky/phlex/view_helpers.rb
210
+ - lib/staticky/pluggable.rb
178
211
  - lib/staticky/resource.rb
212
+ - lib/staticky/resources/plugins.rb
213
+ - lib/staticky/resources/plugins/phlex.rb
214
+ - lib/staticky/resources/plugins/prelude.rb
179
215
  - lib/staticky/router.rb
180
- - lib/staticky/router/definition.rb
216
+ - lib/staticky/routing/plugins.rb
217
+ - lib/staticky/routing/plugins/prelude.rb
181
218
  - lib/staticky/server.rb
182
219
  - lib/staticky/version.rb
183
- - lib/staticky/view_context.rb
184
220
  - site_template/.dockerignore
185
221
  - site_template/.gitignore
186
222
  - site_template/.prettierrc
@@ -203,10 +239,11 @@ files:
203
239
  - site_template/app/views/ui/navbar.rb
204
240
  - site_template/bin/console
205
241
  - site_template/bin/dev
206
- - site_template/bin/lint
242
+ - site_template/bin/setup
207
243
  - site_template/bin/staticky
208
244
  - site_template/config.ru
209
245
  - site_template/config/boot.rb
246
+ - site_template/config/puma.rb
210
247
  - site_template/config/routes.rb
211
248
  - site_template/config/site.erb
212
249
  - site_template/config/staticky.rb
@@ -267,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
304
  - !ruby/object:Gem::Version
268
305
  version: '0'
269
306
  requirements: []
270
- rubygems_version: 3.5.11
307
+ rubygems_version: 3.5.16
271
308
  signing_key:
272
309
  specification_version: 4
273
310
  summary: Static site
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Staticky
4
- class Container < Dry::System::Container
5
- use :env
6
- use :zeitwerk
7
- use :monitoring
8
-
9
- configure do |config|
10
- config.root = Pathname(__dir__).join("..").join("..")
11
- config.inflector = Dry::Inflector.new do |inflections|
12
- inflections.acronym("CLI")
13
- end
14
- config.component_dirs.add "lib" do |dir|
15
- dir.add_to_load_path = false
16
- dir.auto_register = false
17
- dir.namespaces.add "staticky", key: nil
18
- end
19
- end
20
-
21
- register(:files, Staticky::Filesystem.real)
22
- register(:router, Staticky::Router.new)
23
- register(:builder, Staticky::Builder.new)
24
- register(:generator, Staticky::Generator.new)
25
- end
26
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Staticky
4
- class Router
5
- class Definition
6
- attr_reader :resources
7
-
8
- def initialize
9
- @routes_by_path = {}
10
- @routes_by_component = {}
11
- @resources = []
12
- end
13
-
14
- def match(path, to:)
15
- component = to.then do |object|
16
- object.is_a?(Class) ? object.new : object
17
- end
18
-
19
- @resources << resource = Resource.new(url: path, component:)
20
- @routes_by_path[path] = resource
21
- @routes_by_component[component.class] = resource
22
- end
23
-
24
- def root(to:)
25
- match("/", to:)
26
- end
27
-
28
- def resolve(path)
29
- @routes_by_path.fetch(path) { @routes_by_component.fetch(path) }
30
- end
31
-
32
- def delete(path)
33
- @routes.delete(path)
34
- end
35
-
36
- def filepaths
37
- @resources.map { |resource| rename_key(resource.url) }
38
- end
39
-
40
- private
41
-
42
- def rename_key(key)
43
- return "index.html" if key == "/"
44
-
45
- "#{key}.html"
46
- end
47
- end
48
- end
49
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Staticky
4
- class ViewContext
5
- def initialize(resource)
6
- @resource = resource
7
- end
8
-
9
- def root?
10
- @resource.root?
11
- end
12
-
13
- def current_path
14
- @resource.url
15
- end
16
- end
17
- end