lennarb 1.2.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd399f9aecbae5c09d1928317826fd82c62207a36d76ad6a1591a7757811d6e4
4
- data.tar.gz: 3f1ecf28399eeb28a8d739e50ffc01ecd0ae7328057c4132f15e6a12b65cd1e9
3
+ metadata.gz: fb597d27bfaffebc72a4b7aa52f74dd0c5e94c60d401c4f8c30558246509a59d
4
+ data.tar.gz: 0a49adeeb50aee3f5d09a641535d9e230aadeb40d69dc9a1883551641f045999
5
5
  SHA512:
6
- metadata.gz: b32f1d120bfd85de2512721631c90e95aa32622dfd69e41e90ce66f7d61b22db235b30c5de8329bfd1669dc4ca9b880bcb858068246362422e0c0b545b1e29af
7
- data.tar.gz: 28e13690c911ddb81d97c9e4fab95c270eb7e0367d2a26ea89b959252b3a449d611cb9dc067d0428e8959aa2beb96a9e9f3240462c97fbe480aecfd47ae169fd
6
+ metadata.gz: 4a682640f80f02dc84fba9e1f9aa7f666b68b08101c19e2ab406dc9e5367352be25bf7f9f91b26b39ff2f92f9a2c472cc7ba1c306679970fa510fbca73806a04
7
+ data.tar.gz: cb431441f0481b65774ed39f83bf12bb19a2316e3815bfba88388cefc7a641c712777727de51a3a03f60fde4a6de078b2c34d4abb25481835958cc9bb4eb2377
@@ -0,0 +1,8 @@
1
+ # Released under the MIT License.
2
+ # Copyright, 2023, by Aristóteles Coutinho.
3
+
4
+ # [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
5
+ ARG VARIANT="3"
6
+ FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}
7
+
8
+ RUN apt-get update
@@ -0,0 +1,20 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "Lennarb project development",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ // "image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye"
7
+ "build": {
8
+ "dockerfile": "Dockerfile"
9
+ }
10
+ // Features to add to the dev container. More info: https://containers.dev/features.
11
+ // "features": {},
12
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
13
+ // "forwardPorts": [],
14
+ // Use 'postCreateCommand' to run commands after the container is created.
15
+ // "postCreateCommand": "ruby --version",
16
+ // Configure tool-specific properties.
17
+ // "customizations": {},
18
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
19
+ // "remoteUser": "root"
20
+ }
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+
7
+ [*.{yml,yaml}]
8
+ indent_style = space
9
+ indent_size = 2
@@ -0,0 +1,58 @@
1
+ name: Coverage
2
+
3
+ on: [push, pull_request]
4
+
5
+ permissions:
6
+ contents: read
7
+
8
+ env:
9
+ CONSOLE_OUTPUT: XTerm
10
+ COVERAGE: PartialSummary
11
+ BUNDLE_WITH: maintenance
12
+
13
+ jobs:
14
+ test:
15
+ name: ${{matrix.ruby}} on ${{matrix.os}}
16
+ runs-on: ${{matrix.os}}-latest
17
+
18
+ strategy:
19
+ matrix:
20
+ os:
21
+ - ubuntu
22
+ - macos
23
+
24
+ ruby:
25
+ - '3.4'
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{matrix.ruby}}
32
+ bundler-cache: true
33
+
34
+ - name: Run tests
35
+ timeout-minutes: 5
36
+ run: bundle exec rake
37
+
38
+ - uses: actions/upload-artifact@v4
39
+ with:
40
+ name: coverage-${{matrix.os}}-${{matrix.ruby}}
41
+ path: .covered.db
42
+
43
+ validate:
44
+ needs: test
45
+ runs-on: ubuntu-latest
46
+
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: '3.4'
52
+ bundler-cache: true
53
+
54
+ - uses: actions/download-artifact@v4
55
+
56
+ - name: Validate coverage
57
+ timeout-minutes: 5
58
+ run: bundle exec bake covered:validate --paths */.covered.db \;
@@ -0,0 +1,47 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: 'pages'
17
+ cancel-in-progress: true
18
+
19
+ env:
20
+ CONSOLE_OUTPUT: XTerm
21
+ BUNDLE_WITH: maintenance
22
+
23
+ jobs:
24
+ generate:
25
+ runs-on: ubuntu-latest
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: '3.4'
33
+ bundler-cache: true
34
+
35
+ - name: Installing packages
36
+ run: sudo apt-get install wget
37
+
38
+ - name: Prepare GitHub Pages
39
+ run: bundle exec bake github:pages:prepare --directory docs
40
+
41
+ - name: Generate documentation
42
+ timeout-minutes: 5
43
+ run: bundle exec bake utopia:project:static --force no
44
+
45
+ - name: Deploy GitHub Pages
46
+ run: bundle exec bake github:pages:commit --directory docs
47
+
@@ -0,0 +1,27 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ name: Ruby ${{ matrix.ruby }}
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - '3.4'
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run the default task
27
+ run: bundle exec rake test
@@ -0,0 +1,49 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ permissions:
6
+ contents: read
7
+
8
+ env:
9
+ CONSOLE_OUTPUT: XTerm
10
+
11
+ jobs:
12
+ test:
13
+ name: ${{matrix.ruby}} on ${{matrix.os}}
14
+ runs-on: ${{matrix.os}}-latest
15
+ continue-on-error: ${{matrix.experimental}}
16
+
17
+ strategy:
18
+ matrix:
19
+ os:
20
+ - ubuntu
21
+ - macos
22
+
23
+ ruby:
24
+ - '3.3'
25
+ - '3.4'
26
+
27
+ experimental: [false]
28
+
29
+ include:
30
+ - os: ubuntu
31
+ ruby: truffleruby
32
+ experimental: true
33
+ - os: ubuntu
34
+ ruby: jruby
35
+ experimental: true
36
+ - os: ubuntu
37
+ ruby: head
38
+ experimental: true
39
+
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ - uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{matrix.ruby}}
45
+ bundler-cache: true
46
+
47
+ - name: Run tests
48
+ timeout-minutes: 10
49
+ run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /pkg/
3
+ /gems.locked
4
+ /.covered.db
5
+ /external
6
+ /docs
7
+ .DS_Store
8
+ *.gem
9
+ *.rbc
10
+ .git
11
+ .ruby-lsp
12
+ coverage/
data/.standard.yml ADDED
@@ -0,0 +1,23 @@
1
+ ruby_version: 3.4.1
2
+
3
+ ignore:
4
+ - 'bin/**/*'
5
+ - 'vendor/**/*'
6
+ - 'db/schema.rb'
7
+
8
+ plugins:
9
+ - standard-custom
10
+ - standard-performance
11
+
12
+ standard_custom:
13
+ rules:
14
+ lambda_call_style:
15
+ enabled: false
16
+ style: "call"
17
+
18
+ lambda_syntax:
19
+ enabled: false
20
+ style: "line_count_dependent"
21
+
22
+ copyright_notice:
23
+ enabled: false
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.4.1
data/LICENCE ADDED
@@ -0,0 +1,24 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023, Aristóteles Coutinho costa
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task default: %i[test]
Binary file
data/benchmark/rps.png ADDED
Binary file
Binary file
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/lennarb"
4
+ # You can add fixtures and/or initialization code here to make experimenting
5
+ # with your gem easier. You can also use a different console, if you like.
6
+
7
+ require "irb"
8
+ IRB.start(__FILE__)
data/bin/release ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'lennarb/version'
4
+ require 'colorize'
5
+
6
+ puts 'Generating gem version...'.green
7
+ system('bundle exec gem build lennarb.gemspec')
8
+ puts 'Gem version generated successfully'.green
9
+
10
+ puts 'Installing gem version...'.green
11
+
12
+ version = Lennarb::VERSION
13
+ system("gem install ./lennarb-#{version}.gem")
14
+ puts 'Lenna installed successfully'.green
15
+
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/changelog.md CHANGED
@@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.4.0] - 2025-02-09
11
+
12
+ ### Changed
13
+
14
+ - The `freeze!` method was removed from the `Lennarb` class. Use `initializer!` to build and freeze the application.
15
+
16
+ ```rb
17
+ # app.rb
18
+
19
+ require 'lennarb'
20
+
21
+ MyApp = Lennarb.new do |router|
22
+ router.get '/hello' do |req, res|
23
+ res.html('Hello World')
24
+ end
25
+ end
26
+
27
+ MyApp.initializer!
28
+
29
+ run MyApp
30
+ ```
31
+
32
+ ### Remove
33
+
34
+ - Removes bake scripts from the project. Use `rack'` to run tasks.
35
+ - Removes `plugin` module and basic plugins from the project. Now, the `Lennarb` class is the main class of the project.
36
+ - Removes unnecessary tests.
37
+ - Removes `.rubocop.yml` file from the project. Now, the project uses the default configuration of the `standard` gem.
38
+
39
+ ### Added
40
+
41
+ - Add `simplecov` gem to generate the test coverage report.
42
+ - Add `m` gem to run the tests.
43
+
44
+ ## [1.3.0] - 2024-11-21
45
+
46
+ ### Added
47
+
48
+ - Add `Lennarb::Plugin` module to manage the plugins in the project. Now, the `Lennarb` class is the main class of the project.
49
+
50
+ - Automatically loads plugins from the default directory
51
+
52
+ - Supports custom plugin directories via `LENNARB_PLUGINS_PATH`
53
+
54
+ - Configurable through environment variables
55
+
56
+ ### Changed
57
+
58
+ - Change the `finish` method from `Lennarb` class to call `halt(@res.finish)` method to finish the response.
59
+
60
+ ### Removed
61
+
62
+ - Remove `Lennarb::ApplicationBase` class from the project. Now, the `Lennarb` class is the main class of the project.
63
+
10
64
  ## [0.6.1] - 2024-05-17
11
65
 
12
66
  ### Added
@@ -58,9 +112,9 @@ That permits to create a new application with the `Lennarb::ApplicationBase` cla
58
112
  require 'lennarb'
59
113
 
60
114
  class MyApp < Lennarb::ApplicationBase
61
- get '/hello' do |req, res|
62
- res.html('Hello World')
63
- end
115
+ get '/hello' do |req, res|
116
+ res.html('Hello World')
117
+ end
64
118
  end
65
119
  ```
66
120
 
@@ -68,7 +122,6 @@ end
68
122
 
69
123
  - Remove `Lennarb::Application` module from the project. Now, the `Lennarb` class is the main class of the project.
70
124
 
71
-
72
125
  ## [0.4.0] - 2024-07-02
73
126
 
74
127
  ### Added
@@ -85,9 +138,9 @@ require 'lennarb'
85
138
  class MyApp
86
139
  include Lennarb::ApplicationBase
87
140
 
88
- get '/hello' do |req, res|
89
- res.html('Hello World')
90
- end
141
+ get '/hello' do |req, res|
142
+ res.html('Hello World')
143
+ end
91
144
  end
92
145
  ```
93
146
 
data/exe/lenna CHANGED
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
3
  # Released under the MIT License.
5
- # Copyright, 2023, by Aristóteles Coutinho.
4
+ # Copyright, 2023-2025, by Aristóteles Coutinho.
6
5
 
7
6
  # Require the main file
8
7
  #
9
8
  # @private `Since v0.1`
10
9
  #
11
- require 'lennarb'
10
+ require "lennarb"
12
11
 
13
12
  # Show the version
14
13
  #
data/gems.rb ADDED
@@ -0,0 +1,29 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in lennarb.gemspec
4
+ gemspec
5
+
6
+ group :maintenance, optional: true do
7
+ # [https://rubygems.org/gems/bake]
8
+ # Bake is a Ruby library that helps you to create a new project.
9
+ gem "bake"
10
+ # [https://rubygems.org/gems/covered]
11
+ # Covered is a Ruby library that helps you to test your project.
12
+ gem "covered"
13
+ # [https://rubygems.org/gems/bake-gem]
14
+ # Bake Gem is a Bake extension that helps you to create a new Ruby
15
+ # gem.
16
+ gem "bake-gem"
17
+ # [https://rubygems.org/gems/bake-modernize]
18
+ # Bake Modernize is a Bake extension that helps you to modernize your
19
+ # Ruby code.
20
+ gem "bake-modernize"
21
+ # [https://rubygems.org/gems/bake-github-pages]
22
+ # Bake Github Pages is a Bake extension that helps you to publish your
23
+ # project documentation to Github Pages.
24
+ gem "bake-github-pages"
25
+ # [https://rubygems.org/gems/utpia-project]
26
+ # Utopia Project is a Bake extension that helps you to create a new
27
+ # project.
28
+ gem "utopia-project"
29
+ end