moon-stack 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: f95e318fbf5552586d120374e8bed6a12e08e61a9a8241c0df3b20586d5ca2b5
4
+ data.tar.gz: 76dc4f7e66adc6df37274a899d23fa7901038c2a9471f06925a6b61f8a5d4c95
5
+ SHA512:
6
+ metadata.gz: e1a242928911758ef3e9974db8269c8c8dd22aef8fe37898bbe34fac2f29ff3224109051b9a207f9f878b675fa87556a0960138687072eb93634113996b269ca
7
+ data.tar.gz: cbe3ec06f7117ba8728d7625907e7ae813122ea2cb50d06fbbdb8aa5ff0d3cdf10dd85e28373841060f1071803fa3756a52a905b226063fa99e004ce6c184e84
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026 tsuki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Moon Stack 🌙
2
+
3
+ Moon Stack is a stack, not a framework.
4
+
5
+ It doesn't reinvent routing, databases, styling, or HTTP.
6
+
7
+ It brings together tools that already do those jobs well and provides a convenient starting point for Ruby web apps.
8
+
9
+ Use what you want. Replace what you don't.
10
+
11
+ Happy hacking under the moon 🌙
12
+
13
+ ## Stack
14
+
15
+ - Ruby
16
+ - Sinatra
17
+ - Rack
18
+ - Puma
19
+ - Sequel
20
+ - SQLite
21
+ - ERB
22
+ - htmx
23
+ - Tailwind CSS
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ gem install moon-stack
29
+ ```
30
+
31
+ ## Create an app
32
+
33
+ ```bash
34
+ moon new myapp
35
+ cd myapp
36
+ bundle install
37
+ bundle exec puma
38
+ ```
39
+
40
+ Then open:
41
+
42
+ ```text
43
+ http://localhost:6767
44
+ ```
45
+
46
+ ## Philosophy
47
+
48
+ Moon Stack generates normal Ruby files.
49
+
50
+ There is no Moon runtime.
51
+
52
+ Once your app has been generated, Moon Stack is no longer required.
53
+
54
+ Replace anything you want.
55
+
data/bin/moon ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'moon_stack'
4
+
5
+ command = ARGV.shift
6
+
7
+ case command
8
+ when 'new'
9
+ name = ARGV.shift
10
+
11
+ abort 'Usage: moon new APP_NAME' unless name
12
+
13
+ MoonStack::Generator.new(name).run
14
+ when '--version', '-v'
15
+ puts "Moon Stack #{MoonStack::VERSION}"
16
+ when '--help', '-h', nil
17
+ puts <<~HELP
18
+ Moon Stack 🌙
19
+
20
+ Usage:
21
+ moon new APP_NAME
22
+ moon --version
23
+ moon --help
24
+ HELP
25
+ else
26
+ abort "Unknown command: #{command}"
27
+ end
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+
3
+ module MoonStack
4
+ class Generator
5
+ TEMPLATE_DIR = File.expand_path('../../templates', __dir__)
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @destination = File.expand_path(name)
10
+ end
11
+
12
+ def run
13
+ abort "Directory already exists: #{@name}" if Dir.exist?(@destination)
14
+
15
+ puts
16
+ puts "🌙 Creating #{@name}..."
17
+ puts
18
+
19
+ create_directories
20
+ copy_templates
21
+
22
+ puts
23
+ puts 'Moon app ready 🌙'
24
+ puts
25
+ puts 'Run:'
26
+ puts
27
+ puts " cd #{@name}"
28
+ puts ' bundle install'
29
+ puts ' bundle exec puma'
30
+ puts
31
+ end
32
+
33
+ private
34
+
35
+ def create_directories
36
+ FileUtils.mkdir_p(@destination)
37
+ FileUtils.mkdir_p(File.join(@destination, 'views'))
38
+ FileUtils.mkdir_p(File.join(@destination, 'public'))
39
+ FileUtils.mkdir_p(File.join(@destination, 'config'))
40
+ end
41
+
42
+ def copy_templates
43
+ files = [
44
+ '.gitignore',
45
+ 'Gemfile',
46
+ 'app.rb',
47
+ 'config.ru',
48
+ 'db.rb',
49
+ 'views/layout.erb',
50
+ 'views/index.erb',
51
+ 'config/puma.rb'
52
+ ]
53
+ files.each do |file|
54
+ source = File.join(TEMPLATE_DIR, file)
55
+ destination = File.join(@destination, file)
56
+
57
+ FileUtils.cp(source, destination)
58
+
59
+ puts " create #{file}"
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ module MoonStack
2
+ VERSION = '0.1.0'
3
+ end
data/lib/moon_stack.rb ADDED
@@ -0,0 +1,2 @@
1
+ require_relative 'moon_stack/version'
2
+ require_relative 'moon_stack/generator'
@@ -0,0 +1,4 @@
1
+ .env
2
+ *.db
3
+ .bundle/
4
+ vendor/bundle/
data/templates/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'puma'
4
+ gem 'sequel'
5
+ gem 'sinatra'
6
+ gem 'sqlite3'
data/templates/app.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'sinatra'
2
+ require_relative 'db'
3
+
4
+ get '/' do
5
+ erb :index
6
+ end
@@ -0,0 +1 @@
1
+ port ENV.fetch('PORT', 6767)
@@ -0,0 +1,3 @@
1
+ require_relative 'app'
2
+
3
+ run Sinatra::Application
data/templates/db.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'sequel'
2
+
3
+ DB = Sequel.sqlite('app.db')
@@ -0,0 +1,7 @@
1
+ <h1 class="text-3xl font-bold">
2
+ Hello from Moon Stack 🌙
3
+ </h1>
4
+
5
+ <p class="mt-4 text-zinc-400">
6
+ Ruby + Sinatra + htmx under the moon.
7
+ </p>
@@ -0,0 +1,23 @@
1
+ <!doctype html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <meta
8
+ name="viewport"
9
+ content="width=device-width, initial-scale=1"
10
+ >
11
+
12
+ <title>Moon App</title>
13
+
14
+ <script src="https://unpkg.com/htmx.org"></script>
15
+ <script src="https://cdn.tailwindcss.com"></script>
16
+ </head>
17
+
18
+ <body class="bg-zinc-950 text-zinc-100">
19
+ <main class="max-w-4xl mx-auto p-6">
20
+ <%= yield %>
21
+ </main>
22
+ </body>
23
+ </html>
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moon-stack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tsuki
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Moon Stack generates a minimal Sinatra-based Ruby web app.
13
+ executables:
14
+ - moon
15
+ extensions: []
16
+ extra_rdoc_files: []
17
+ files:
18
+ - LICENSE
19
+ - README.md
20
+ - bin/moon
21
+ - lib/moon_stack.rb
22
+ - lib/moon_stack/generator.rb
23
+ - lib/moon_stack/version.rb
24
+ - templates/.gitignore
25
+ - templates/Gemfile
26
+ - templates/app.rb
27
+ - templates/config.ru
28
+ - templates/config/puma.rb
29
+ - templates/db.rb
30
+ - templates/views/index.erb
31
+ - templates/views/layout.erb
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '3.2'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 4.0.16
50
+ specification_version: 4
51
+ summary: A small Ruby web stack starter
52
+ test_files: []