gymmygem 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 +7 -0
- data/README.md +168 -0
- data/lib/gymmygem/ast.rb +6 -0
- data/lib/gymmygem/compiler.rb +41 -0
- data/lib/gymmygem/parser.rb +61 -0
- data/lib/gymmygem/version.rb +5 -0
- data/lib/gymmygem.rb +61 -0
- metadata +60 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f19a6b7c92cd8e228b52fdaea4e38835bd7ce535a0edfb0d23df86bec9d760d1
|
|
4
|
+
data.tar.gz: 50381d8faeae91891a76abddacd406fedbcccf81ea5976edbc182920d58c3cfd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4aea52274e5a748117e9b4aa23d5e7746603858ca9055d459f91ced792bfce19083efe7fa002a12fc2a4dc1a40ec2899b79ec20ea9aaa4befb14d9702cdf910c
|
|
7
|
+
data.tar.gz: 703027cdf7d08246d26e9ea37fdc0bfa0721bf8d012d7e2b302f802a95b956ec1121c362efc57e25524505d6fcfacffc81f0d8bbed44bf4b972bcdb55d15dfc8
|
data/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Gymmygem
|
|
2
|
+
|
|
3
|
+
Gymmygem is a Ruby-based web interface generator and static site builder.It lets you create beautiful, multi-page websites from templates and content files with a single command.
|
|
4
|
+
It is designed for developers who want to build modern web applications without the complexity of traditional frameworks. Gymmygem provides a simple, intuitive way to create interactive user interfaces using Ruby code.
|
|
5
|
+
|
|
6
|
+
It lets you design modern HTML interfaces using a clean DSL, then compiles them into interactive, production-ready websites.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Ruby-based DSL** for UI components
|
|
11
|
+
- Automatic HTML generation
|
|
12
|
+
- Built-in dev server with live reload
|
|
13
|
+
- Easy deployment to any static hosting platform
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install from RubyGems:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install gymmygem
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
TODO: Delete this and the text below, and describe your gem
|
|
25
|
+
|
|
26
|
+
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/gymmygem`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
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.
|
|
31
|
+
|
|
32
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
That’s the default `README.md` template Bundler generates when you run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bundle gem gymmygem
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Right now it’s just placeholders, so you’ll want to rewrite it to describe **what your gem does, how to install it, and how to use it**.
|
|
52
|
+
|
|
53
|
+
If you’re making a **website generator gem** in Ruby (like you mentioned earlier), here’s how you could rewrite it:
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
````markdown
|
|
58
|
+
# Gymmygem
|
|
59
|
+
|
|
60
|
+
Gymmygem is a lightweight static site generator written in Ruby.
|
|
61
|
+
It lets you create beautiful, multi-page websites from templates and content files with a single command.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
Add this line to your application's Gemfile:
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
gem "gymmygem"
|
|
69
|
+
````
|
|
70
|
+
|
|
71
|
+
Then execute:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bundle install
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or install it directly:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
gem install gymmygem
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
Generate a new site:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
gymmygem new mysite
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Serve locally:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
cd mysite
|
|
95
|
+
gymmygem serve
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Build for production:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
gymmygem build
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
After checking out the repo, run:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
bin/setup
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
To try the gem in an interactive console:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
bin/console
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
To install locally:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
bundle exec rake install
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
To release a new version:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bundle exec rake release
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Contributing
|
|
131
|
+
|
|
132
|
+
Bug reports and pull requests are welcome at [https://github.com/USERNAME/gymmygem](https://github.com/USERNAME/gymmygem).
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
Gymmygem is available under the MIT License.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
If you want, I can also:
|
|
143
|
+
- Set up **`bin/gymmygem`** so the CLI works
|
|
144
|
+
- Add a **`lib/gymmygem/generator.rb`** that actually builds sites
|
|
145
|
+
- Add an **EBNF parser** if you want templating to be DSL-based
|
|
146
|
+
|
|
147
|
+
Do you want me to set that up so `gymmygem new mysite` works out of the box? That would make this a functioning site generator.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
154
|
+
|
|
155
|
+
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).
|
|
156
|
+
|
|
157
|
+
## Contributing
|
|
158
|
+
|
|
159
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gymmygem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/gymmygem/blob/master/CODE_OF_CONDUCT.md).
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
164
|
+
|
|
165
|
+
## Code of Conduct
|
|
166
|
+
|
|
167
|
+
Everyone interacting in the Gymmygem project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gymmygem/blob/master/CODE_OF_CONDUCT.md).
|
|
168
|
+
# gymmygem.io
|
data/lib/gymmygem/ast.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Gymmygem
|
|
2
|
+
class Compiler
|
|
3
|
+
def initialize(ast)
|
|
4
|
+
@ast = ast
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def compile
|
|
8
|
+
@ast[:program].map { |component| compile_component(component) }.join("\n")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def compile_component(node)
|
|
12
|
+
name = node[:component_name]
|
|
13
|
+
arg = node[:arg]
|
|
14
|
+
html = compile_html(node[:body])
|
|
15
|
+
"<!-- Component: #{name}(#{arg}) -->\n#{html}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def compile_html(nodes)
|
|
19
|
+
nodes.map do |el|
|
|
20
|
+
tag = el[:tag]
|
|
21
|
+
classes = el[:classes]&.map { |c| c[0] }.join(" ")
|
|
22
|
+
content = compile_content(el[:content])
|
|
23
|
+
|
|
24
|
+
"<#{tag} class='#{classes}'>#{content}</#{tag}>"
|
|
25
|
+
end.join("\n")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def compile_content(content)
|
|
29
|
+
content.map do |c|
|
|
30
|
+
if c.is_a?(Hash) && c[:string]
|
|
31
|
+
c[:string]
|
|
32
|
+
elsif c.is_a?(Hash) && c[:interpolation]
|
|
33
|
+
"<%= #{c[:interpolation]} %>"
|
|
34
|
+
else
|
|
35
|
+
c.to_s
|
|
36
|
+
end
|
|
37
|
+
end.join
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "gymmygem/version"
|
|
4
|
+
|
|
5
|
+
require 'parslet'
|
|
6
|
+
|
|
7
|
+
module Gymmygem
|
|
8
|
+
class Parser < Parslet::Parser
|
|
9
|
+
rule(:space) { match('\s').repeat(1) }
|
|
10
|
+
rule(:space?) { space.maybe }
|
|
11
|
+
rule(:newline) { str("\n") }
|
|
12
|
+
|
|
13
|
+
rule(:identifier) { match('[a-zA-Z_]') >> match('[a-zA-Z0-9_]').repeat }
|
|
14
|
+
rule(:string) { str('"') >> (str('"').absent? >> any).repeat.as(:string) >> str('"') }
|
|
15
|
+
|
|
16
|
+
rule(:interpolation) { str('#{') >> (identifier).as(:interpolation) >> str('}') }
|
|
17
|
+
rule(:interpolated_string) do
|
|
18
|
+
str('"') >>
|
|
19
|
+
(
|
|
20
|
+
interpolation | (str('"').absent? >> any)
|
|
21
|
+
).repeat.as(:string) >>
|
|
22
|
+
str('"')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
rule(:tag_name) { match('[a-z]').repeat(1).as(:tag) }
|
|
26
|
+
|
|
27
|
+
rule(:html_block) do
|
|
28
|
+
tag_name >>
|
|
29
|
+
(str('.') >> identifier).repeat.as(:classes) >>
|
|
30
|
+
str('{') >> space? >>
|
|
31
|
+
(html_block | interpolated_string | string | identifier).repeat.as(:content) >>
|
|
32
|
+
str('}')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
rule(:action) do
|
|
36
|
+
str('action') >> space >> identifier.as(:action_name) >>
|
|
37
|
+
str('{') >>
|
|
38
|
+
(interpolated_string | function_call).repeat.as(:body) >>
|
|
39
|
+
str('}')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
rule(:function_call) do
|
|
43
|
+
identifier.as(:func) >> str('(') >>
|
|
44
|
+
(interpolated_string | identifier).repeat.as(:args) >>
|
|
45
|
+
str(')')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
rule(:component) do
|
|
49
|
+
str('component') >> space >> identifier.as(:component_name) >>
|
|
50
|
+
str('(') >> identifier.as(:arg) >> str(')') >>
|
|
51
|
+
str('{') >> html_block.repeat.as(:body) >> action.repeat.as(:actions) >> str('}')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
rule(:statement) { component }
|
|
55
|
+
rule(:program) { statement.repeat.as(:program) }
|
|
56
|
+
|
|
57
|
+
root :program
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
data/lib/gymmygem.rb
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "gymmygem/version"
|
|
4
|
+
|
|
5
|
+
require 'parslet'
|
|
6
|
+
|
|
7
|
+
module Gymmygem
|
|
8
|
+
class Parser < Parslet::Parser
|
|
9
|
+
rule(:space) { match('\s').repeat(1) }
|
|
10
|
+
rule(:space?) { space.maybe }
|
|
11
|
+
rule(:newline) { str("\n") }
|
|
12
|
+
|
|
13
|
+
rule(:identifier) { match('[a-zA-Z_]') >> match('[a-zA-Z0-9_]').repeat }
|
|
14
|
+
rule(:string) { str('"') >> (str('"').absent? >> any).repeat.as(:string) >> str('"') }
|
|
15
|
+
|
|
16
|
+
rule(:interpolation) { str('#{') >> (identifier).as(:interpolation) >> str('}') }
|
|
17
|
+
rule(:interpolated_string) do
|
|
18
|
+
str('"') >>
|
|
19
|
+
(
|
|
20
|
+
interpolation | (str('"').absent? >> any)
|
|
21
|
+
).repeat.as(:string) >>
|
|
22
|
+
str('"')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
rule(:tag_name) { match('[a-z]').repeat(1).as(:tag) }
|
|
26
|
+
|
|
27
|
+
rule(:html_block) do
|
|
28
|
+
tag_name >>
|
|
29
|
+
(str('.') >> identifier).repeat.as(:classes) >>
|
|
30
|
+
str('{') >> space? >>
|
|
31
|
+
(html_block | interpolated_string | string | identifier).repeat.as(:content) >>
|
|
32
|
+
str('}')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
rule(:action) do
|
|
36
|
+
str('action') >> space >> identifier.as(:action_name) >>
|
|
37
|
+
str('{') >>
|
|
38
|
+
(interpolated_string | function_call).repeat.as(:body) >>
|
|
39
|
+
str('}')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
rule(:function_call) do
|
|
43
|
+
identifier.as(:func) >> str('(') >>
|
|
44
|
+
(interpolated_string | identifier).repeat.as(:args) >>
|
|
45
|
+
str(')')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
rule(:component) do
|
|
49
|
+
str('component') >> space >> identifier.as(:component_name) >>
|
|
50
|
+
str('(') >> identifier.as(:arg) >> str(')') >>
|
|
51
|
+
str('{') >> html_block.repeat.as(:body) >> action.repeat.as(:actions) >> str('}')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
rule(:statement) { component }
|
|
55
|
+
rule(:program) { statement.repeat.as(:program) }
|
|
56
|
+
|
|
57
|
+
root :program
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
metadata
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gymmygem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- uknown-one
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2025-08-16 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: parslet
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.0'
|
|
26
|
+
description: html page builder.
|
|
27
|
+
email:
|
|
28
|
+
- 222345231+uknown-one@users.noreply.github.com
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- README.md
|
|
34
|
+
- lib/gymmygem.rb
|
|
35
|
+
- lib/gymmygem/ast.rb
|
|
36
|
+
- lib/gymmygem/compiler.rb
|
|
37
|
+
- lib/gymmygem/parser.rb
|
|
38
|
+
- lib/gymmygem/version.rb
|
|
39
|
+
homepage: https://github.com/uknown-one/gymmygem.io.git
|
|
40
|
+
licenses:
|
|
41
|
+
- MIT
|
|
42
|
+
metadata: {}
|
|
43
|
+
rdoc_options: []
|
|
44
|
+
require_paths:
|
|
45
|
+
- lib
|
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '0'
|
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '0'
|
|
56
|
+
requirements: []
|
|
57
|
+
rubygems_version: 3.6.2
|
|
58
|
+
specification_version: 4
|
|
59
|
+
summary: page builder
|
|
60
|
+
test_files: []
|