Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
718d8ec
chore doc comments.
gemmaro Sep 6, 2025
d7fb774
Add Direnv config.
gemmaro Nov 7, 2025
ad4436d
Rename run all script.
gemmaro Nov 8, 2025
52e4784
Install Doxygen.
gemmaro Nov 8, 2025
623dd04
Add C include path.
gemmaro Nov 8, 2025
684b853
Add has-host check macro.
gemmaro Nov 8, 2025
296b4de
Do not use compiler specific defines.
gemmaro Nov 8, 2025
ca2acb3
Add host exist check.
gemmaro Nov 8, 2025
52bd2a1
Document host check.
gemmaro Nov 8, 2025
354acac
Add checker for URI copy function.
gemmaro Nov 8, 2025
528d95b
Refactor debug hook macro definition.
gemmaro Nov 8, 2025
8bcbd3d
Install mirb.
gemmaro Nov 8, 2025
1ecff3d
Implement dup and clone methods.
gemmaro Nov 8, 2025
34195b4
Add equals function checker.
gemmaro Nov 8, 2025
510a0a5
Implement URI equal check method.
gemmaro Nov 8, 2025
4de4e92
Format code.
gemmaro Nov 9, 2025
88f90b0
Draft set scheme method.
gemmaro Nov 9, 2025
e7d8fdf
Implement userinfo setter.
gemmaro Nov 9, 2025
4ddef7c
Implement host setter.
gemmaro Nov 9, 2025
0c094d9
Implement port setter.
gemmaro Nov 9, 2025
ca365ac
Implement path setter.
gemmaro Nov 9, 2025
6a20c2d
Implement query setter.
gemmaro Nov 9, 2025
001fdf7
Implement fragment setter.
gemmaro Nov 9, 2025
3f56c55
Add set scheme conditional.
gemmaro Nov 9, 2025
9ff7db4
Add set userinfo conditional.
gemmaro Nov 9, 2025
58357f7
Add set host conditional.
gemmaro Nov 9, 2025
dbf2d0b
Add set port conditional.
gemmaro Nov 9, 2025
bd49e92
Add set path conditional.
gemmaro Nov 9, 2025
e407abb
Add set query conditional.
gemmaro Nov 9, 2025
96f94b3
Add set fragment conditional.
gemmaro Nov 9, 2025
a9d6169
Split to Guix manifest.
gemmaro Nov 9, 2025
77dd18a
Move some Ruby code to TODO list.
gemmaro Nov 9, 2025
ce5c627
chore
gemmaro Nov 9, 2025
f56e807
Add GitHub Actions workflow for Doxygen.
gemmaro Nov 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use guix
dotenv
export C_INCLUDE_PATH="$PWD/include:$HOME/src/mruby/include:$C_INCLUDE_PATH"
37 changes: 37 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and deploy Doxygen to GitHub Pages
on:
push:
branches: [ "main" ]
pull_request:
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Doxygen and Graphviz
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz

- name: Run Doxygen
run: doxygen Doxyfile

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc/html

deploy:
needs: build-and-deploy
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
4 changes: 2 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
Expand Down Expand Up @@ -2390,7 +2390,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = HAVE_URI_HAS_HOST

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
64 changes: 64 additions & 0 deletions TODO.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
* URIParserモジュール
** ClassMethodsモジュール
*** splitメソッド
#+begin_src ruby
def split(uri)
uri = parse(uri)

# TODO: Support registry, path, and opaque
[uri.scheme, uri.userinfo,
nil, # host
uri.port,
nil, # registry
nil, # path
nil, # opaque
uri.query, uri.fragment]
end
#+end_src
** URIクラス
*** hierarchical?メソッド
#+begin_src ruby
def hierarchical?
path ? true : false
end
#+end_src
* Guixパッケージ
#+begin_src scheme
(define-public ruby-yard-mruby
(package
(name "ruby-yard-mruby")
(version "0.3.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "yard-mruby" version))
(sha256
(base32 "1vv4s9lv0bif1xcn12yavr05adpj41y0xkrvwzza9rxxr3jz6l7r"))))
(build-system ruby-build-system)
(arguments (list #:test-target "spec"))
(native-inputs (list ruby-rspec))
(propagated-inputs (list ruby-yard))
(synopsis "Generate Yard documentation for MRuby projects.")
(description "Generate Yard documentation for MRuby projects.")
(home-page "https://github.com/sagmor/yard-mruby")
(license license:expat)))

(define-public ruby-yard-coderay
(package
(name "ruby-yard-coderay")
(version "0.1.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "yard-coderay" version))
(sha256
(base32 "0gqn2m83vxvp579malqi1jhkh0xcwpbz9190qr64zwbiljp5kfrq"))))
(build-system ruby-build-system)
(arguments (list #:test-target "spec"))
(native-inputs (list ruby-rspec))
(propagated-inputs (list ruby-coderay ruby-yard))
(synopsis "Add's coderay syntax highlighting to YARD docs")
(description "Add's coderay syntax highlighting to YARD docs.")
(home-page "https://github.com/sagmor/yard-coderay")
(license license:expat)))
#+end_src
2 changes: 2 additions & 0 deletions build/check_uri_copy_uri.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriCopyUriA(NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_equals_uri.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriEqualsUriA(NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_has_host.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriHasHostA(NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_fragment.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetFragmentA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_host.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetHostAutoA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_path.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetPathA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_port.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetPortTextA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_query.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetQueryA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_scheme.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetSchemeA(NULL, NULL, NULL); }
2 changes: 2 additions & 0 deletions build/check_uri_set_userinfo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <uriparser/Uri.h>
int main(void) { uriSetUserInfoA(NULL, NULL, NULL); }
73 changes: 72 additions & 1 deletion build_config.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,84 @@
require "tmpdir"
require "shellwords"
require "open3"

def check_function(name:, checker:, macro:, conf:)
Dir.mktmpdir("mruby_check_") do |tmpdir|
exe = File.join(tmpdir, "check_#{name}")
command = [conf.cc.command,
*conf.cc.flags.flatten,
"-l", "uriparser",
'-o', exe,
File.join(__dir__, "build/#{checker}")]
output, status = Open3.capture2e(ENV, *command)
puts "status: #{status}"
output.strip!
if output
puts ">>> output >>>"
puts output
puts "<<< output <<<"
end
if status.success?
conf.defines << macro
puts "found #{name}"
else
warn "not found #{name}"
end
end
end

MRuby::Build.new do |conf|
toolchain :gcc
conf.gem File.expand_path(File.dirname(__FILE__))
conf.enable_test

conf.linker.libraries << 'uriparser'

check_function(name: "uriHasHostA",
checker: "check_uri_has_host.c",
macro: "HAVE_URI_HAS_HOST",
conf:)
check_function(name: "uriCopyUriA",
checker: "check_uri_copy_uri.c",
macro: "HAVE_URI_COPY_URI",
conf:)
check_function(name: "uriEqualsUriA",
checker: "check_uri_equals_uri.c",
macro: "HAVE_URI_EQUALS_URI",
conf:)
check_function(name: "uriSetSchemeA",
checker: "check_uri_set_scheme.c",
macro: "HAVE_URI_SET_SCHEME",
conf:)
check_function(name: "uriSetUserInfoA",
checker: "check_uri_set_userinfo.c",
macro: "HAVE_URI_SET_USERINFO",
conf:)
check_function(name: "uriSetHostAutoA",
checker: "check_uri_set_host.c",
macro: "HAVE_URI_SET_HOST",
conf:)
check_function(name: "uriSetPortTextA",
checker: "check_uri_set_port.c",
macro: "HAVE_URI_SET_PORT",
conf:)
check_function(name: "uriSetPathA",
checker: "check_uri_set_path.c",
macro: "HAVE_URI_SET_PATH",
conf:)
check_function(name: "uriSetQueryA",
checker: "check_uri_set_query.c",
macro: "HAVE_URI_SET_QUERY",
conf:)
check_function(name: "uriSetFragmentA",
checker: "check_uri_set_fragment.c",
macro: "HAVE_URI_SET_FRAGMENT",
conf:)

if ENV['DEBUG'] == 'true'
conf.enable_debug
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)
conf.defines << "MRB_ENABLE_DEBUG_HOOK"
conf.gem core: 'mruby-bin-debugger'
conf.gem core: 'mruby-bin-mirb'
end
end
8 changes: 8 additions & 0 deletions manifest.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(use-modules (guix profiles)
(gnu packages commencement)
(gnu packages web)
(gnu packages documentation))

(packages->manifest (list gcc-toolchain
uriparser
doxygen))
19 changes: 0 additions & 19 deletions mrblib/mrb_uriparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ def join(uri_str, *path)
# TODO: Remove parsing each path after implement accepting URI by merge methods.
path.reduce(URIParser.parse(uri_str)) { |memo, pat| memo.merge!(URIParser.parse(pat)) }
end

# TODO: Implement this.
def split(uri)
uri = parse(uri)

# TODO: Support registry, path, and opaque
[uri.scheme, uri.userinfo,
nil, # host
uri.port,
nil, # registry
nil, # path
nil, # opaque
uri.query, uri.fragment]
end
end

class << self
Expand Down Expand Up @@ -70,11 +56,6 @@ def to_filename(windows: false)
URIParser.uri_string_to_filename(to_s, windows:)
end

# TODO: Implement path.
def hierarchical?
path ? true : false
end

def relative?
!absolute?
end
Expand Down
File renamed without changes.
Loading