phlexite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9628d7b3576b68aa89c824d70598adf4eb2b80239f4b32fd7cb314fef1a4429a
4
+ data.tar.gz: 85a7f76a5babfae4b2e5d77f3913639cc2bca590250b0abefda2ad29b732d9d2
5
+ SHA512:
6
+ metadata.gz: 9aa5db549c5734f9beda3252cd7843eea0491c76bf82ebc665e6203bb3810bb420a8584bf1995f51cc4a6f2d408ab2b9f27d61bf7c44d17104e6f0f83d6d54df
7
+ data.tar.gz: b7209f67cc384be691b7b9439426366325e57d4929192c05d2e8f1f2ad85d7369f9673578e649d0518a8f2c5544af1a9d1a3a8e267845d47bc7523beeecaae1d
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Aleks Rūtiņš
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Phlexite
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/phlexite`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/phlexite.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[test standard]
data/Steepfile ADDED
@@ -0,0 +1,28 @@
1
+ D = Steep::Diagnostic
2
+
3
+ target :lib do
4
+ signature "sig"
5
+
6
+ check "lib" # Directory name
7
+ # ignore "lib/templates/*.rb"
8
+
9
+ # library "pathname" # Standard libraries
10
+ # library "strong_json" # Gems
11
+ # library "phlex"
12
+
13
+ # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
14
+ # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
15
+ # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
16
+ # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
17
+ # configure_code_diagnostics do |hash| # You can setup everything yourself
18
+ # hash[D::Ruby::NoMethod] = :information
19
+ # end
20
+ end
21
+
22
+ # target :test do
23
+ # signature "sig", "sig-private"
24
+ #
25
+ # check "test"
26
+ #
27
+ # # library "pathname" # Standard libraries
28
+ # end
@@ -0,0 +1,23 @@
1
+ class Phlexite::Router
2
+ def initialize(base, site)
3
+ @base = base
4
+ @site = site
5
+ end
6
+
7
+ def group(new_base)
8
+ router = Phlexite::Router.new(File::join(@base, new_base), @site)
9
+ yield router
10
+ end
11
+
12
+ def page(out_path, component)
13
+ out = full_out_path(out_path)
14
+ system("mkdir -p #{File::dirname(out)}")
15
+ File::write(out, component.call)
16
+ end
17
+
18
+ private
19
+
20
+ def full_out_path(out_path)
21
+ File::join(@site.build_dir, @site.base_url, @base, out_path)
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'router.rb'
4
+
5
+ class Phlexite::Site < Phlexite::Router
6
+ attr_accessor :build_dir, :base_url
7
+
8
+ def initialize
9
+ super("/", self)
10
+ @build_dir = "_build"
11
+ @base_url = "/"
12
+ yield self
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlexite
4
+ VERSION = "0.1.0"
5
+ end
data/lib/phlexite.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "phlexite/version"
4
+
5
+ module Phlexite
6
+ class Error < StandardError; end
7
+ end
data/sig/phlexite.rbs ADDED
@@ -0,0 +1,25 @@
1
+ module Phlexite
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ class Error < StandardError
5
+ end
6
+
7
+ class Router
8
+ def initialize: (String, Site) -> void
9
+ def page: (String, untyped) -> void
10
+ def group: (String) { (Router) -> void } -> void
11
+
12
+ private
13
+ def full_out_path: (String) -> String
14
+ end
15
+
16
+ class Site < Router
17
+ def initialize: () { (Site) -> void } -> void
18
+
19
+ def build_dir: () -> String
20
+ def build_dir=: (String) -> void
21
+
22
+ def base_url: () -> String
23
+ def base_url=: (String) -> void
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phlexite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aleks Rūtiņš
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - aleks@rutins.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".standard.yml"
21
+ - LICENSE.txt
22
+ - README.md
23
+ - Rakefile
24
+ - Steepfile
25
+ - lib/phlexite.rb
26
+ - lib/phlexite/router.rb
27
+ - lib/phlexite/site.rb
28
+ - lib/phlexite/version.rb
29
+ - sig/phlexite.rbs
30
+ homepage: https://sr.ht/~aleksrutins/phlexite
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ allowed_push_host: https://rubygems.org
35
+ homepage_uri: https://sr.ht/~aleksrutins/phlexite
36
+ source_code_uri: https://git.sr.ht/~aleksrutins/phlexite
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.5.18
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: A tiny SSG as a library, using Phlex for rendering
56
+ test_files: []