A => .gitignore +3 -0
@@ 1,3 @@
+/.bundle
+/public/**/*.html
+/vendor
A => Gemfile +8 -0
@@ 1,8 @@
+# frozen_string_literal: true
+
+source 'https://rubygems.org'
+
+gem 'haml', '~> 5.2.2'
+gem 'leanweb', '~> 0.5.0'
+gem 'puma'
+gem 'rake'
A => Gemfile.lock +28 -0
@@ 1,28 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ haml (5.2.2)
+ temple (>= 0.8.0)
+ tilt
+ leanweb (0.5.0)
+ rack (~> 2.2.4)
+ tilt (~> 2.0.11)
+ nio4r (2.5.9)
+ puma (6.2.2)
+ nio4r (~> 2.0)
+ rack (2.2.7)
+ rake (13.0.6)
+ temple (0.10.0)
+ tilt (2.0.11)
+
+PLATFORMS
+ x86_64-linux
+
+DEPENDENCIES
+ haml (~> 5.2.2)
+ leanweb (~> 0.5.0)
+ puma
+ rake
+
+BUNDLED WITH
+ 2.2.5
A => Rakefile +10 -0
@@ 1,10 @@
+# frozen_string_literal: true
+
+require 'leanweb'
+
+task default: %w[build_static]
+
+task :build_static do
+ require_relative 'routes'
+ LeanWeb::App.new(ROUTES).build_static
+end
A => config.ru +16 -0
@@ 1,16 @@
+# frozen_string_literal: true
+
+require 'leanweb'
+require_relative 'routes'
+
+if ENV['RACK_ENV'] == 'development'
+ use(Rack::Reloader, 0)
+ app = Rack::Cascade.new([
+ LeanWeb::App.new(ROUTES),
+ Rack::Files.new(LeanWeb::PUBLIC_PATH)
+ ])
+else
+ app = LeanWeb::App.new(ROUTES)
+end
+
+run app
A => routes.rb +3 -0
@@ 1,3 @@
+# frozen_string_literal: true
+
+ROUTES = [{ path: '/' }].freeze
A => src/controllers/main_controller.rb +10 -0
@@ 1,10 @@
+# frozen_string_literal: true
+
+require 'leanweb'
+
+# Main controller is the default controller.
+class MainController < LeanWeb::Controller
+ def index_get
+ render_response 'index.haml'
+ end
+end
A => src/views/index.haml +8 -0
@@ 1,8 @@
+!!!
+%html
+ %head
+ %meta{charset: "utf-8"}
+ %meta{name: "viewport", content: "width=device-width, initial-scale=1"}
+ %title LeanWeb framework
+ %body
+ %h1 It works!