statique 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/Gemfile +14 -12
- data/README.md +10 -9
- data/docs/assets/css/{app.scss → app.css} +0 -0
- data/docs/content/index.md +1 -1
- data/lib/statique/app.rb +11 -11
- data/lib/statique/cli/build.rb +5 -4
- data/lib/statique/cli/server.rb +1 -0
- data/lib/statique/configuration.rb +20 -0
- data/lib/statique/discover.rb +1 -1
- data/lib/statique/version.rb +1 -1
- data/lib/statique.rb +10 -20
- data/statique.gemspec +1 -4
- metadata +6 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2054cde4943aaa109efca61aaf7324a13c7b79f6799799c989a0a1741c3ca8f
|
4
|
+
data.tar.gz: 72d87387e9f0efd5221f243a5ff20e005d472117d251385c91b3e2b1c48875ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbbd3939295f1d514c2d88d359d4378b40c035c9f1dba4277520595988a156bdd03d38699d34030850eb99051beae0f3f03740479f0db2a5be284083d056a843
|
7
|
+
data.tar.gz: 299de1732a45c052a472ad81584329aae57b429d5c6eade81af2934c10171f8a6347f696b9cb392e818f4b38d1e77380c8995111a6e03ac6c4edf43528ede304
|
data/Dockerfile
CHANGED
@@ -7,7 +7,7 @@ ARG STATIQUE_VERSION
|
|
7
7
|
# RUN gem install statique --version $STATIQUE_VERSION
|
8
8
|
WORKDIR /pkg
|
9
9
|
COPY pkg/statique-$STATIQUE_VERSION.gem .
|
10
|
-
RUN apk add --no-cache --update --virtual .build-deps build-base
|
10
|
+
RUN apk add --no-cache --update --virtual .build-deps build-base && \
|
11
11
|
gem install /pkg/statique-$STATIQUE_VERSION.gem && rm -rf /root/.local/share/gem && rm -rf /usr/local/bundle/cache/*.gem && \
|
12
12
|
apk del .build-deps
|
13
13
|
|
data/Gemfile
CHANGED
@@ -7,15 +7,17 @@ source "https://rubygems.org"
|
|
7
7
|
# Specify your gem's dependencies in statique.gemspec
|
8
8
|
gemspec
|
9
9
|
|
10
|
-
|
11
|
-
gem "
|
12
|
-
gem "
|
13
|
-
gem "minitest
|
14
|
-
gem "
|
15
|
-
gem "
|
16
|
-
gem "
|
17
|
-
gem "
|
18
|
-
gem "rubocop-
|
19
|
-
gem "
|
20
|
-
gem "
|
21
|
-
gem "
|
10
|
+
group :development do
|
11
|
+
gem "benchmark-ips"
|
12
|
+
gem "bundle-audit", "~> 0.1.0"
|
13
|
+
gem "minitest", "~> 5.0"
|
14
|
+
gem "minitest-around", "~> 0.5.0"
|
15
|
+
gem "overcommit"
|
16
|
+
gem "rake", "~> 13.0"
|
17
|
+
gem "rbs"
|
18
|
+
gem "rubocop-minitest", "~> 0.17.0"
|
19
|
+
gem "rubocop-rake", "~> 0.6.0"
|
20
|
+
gem "solargraph"
|
21
|
+
gem "standard", "~> 1.3"
|
22
|
+
gem "typeprof"
|
23
|
+
end
|
data/README.md
CHANGED
@@ -10,15 +10,16 @@
|
|
10
10
|
# Statique
|
11
11
|
|
12
12
|
![Ruby](https://github.com/pusewicz/statique/actions/workflows/main.yml/badge.svg)
|
13
|
+
[![Gem Version](https://badge.fury.io/rb/statique.svg)](https://badge.fury.io/rb/statique)
|
13
14
|
|
14
|
-
Statique is a static site generator written in [Ruby](https://www.ruby-lang.org/) and utilising [Roda](https://roda.jeremyevans.net/) for the Rack middleware. By default, it comes with support for [Slim](http://slim-lang.com/)
|
15
|
+
Statique is a static site generator written in [Ruby](https://www.ruby-lang.org/) and utilising [Roda](https://roda.jeremyevans.net/) for the Rack middleware. By default, it comes with support for [Slim](http://slim-lang.com/) and [Markdown](https://daringfireball.net/projects/markdown/).
|
15
16
|
|
16
17
|
## Installation
|
17
18
|
|
18
19
|
Install it as a [Whalebrew](https://github.com/whalebrew/whalebrew) package (recommended):
|
19
20
|
|
20
21
|
$ whalebrew install pusewicz/statique
|
21
|
-
|
22
|
+
|
22
23
|
Install it as a Docker image:
|
23
24
|
|
24
25
|
$ docker pull pusewicz/statique
|
@@ -34,25 +35,25 @@ Install it as a Ruby gem:
|
|
34
35
|
#### Whalebrew package, Ruby gem
|
35
36
|
|
36
37
|
$ statique init my-website
|
37
|
-
|
38
|
+
|
38
39
|
#### Docker
|
39
40
|
|
40
41
|
$ docker run -it --rm -v "$PWD":/workdir -w /workdir pusewicz/statique init my-website
|
41
|
-
|
42
|
+
|
42
43
|
### Start the Statique server
|
43
44
|
|
44
45
|
First, change into your new Statique website directory:
|
45
46
|
|
46
47
|
$ cd my-website
|
47
|
-
|
48
|
+
|
48
49
|
#### Whalebrew package, Ruby gem
|
49
50
|
|
50
51
|
$ statique server
|
51
|
-
|
52
|
+
|
52
53
|
#### Docker
|
53
54
|
|
54
55
|
$ docker run -it --rm -p 3000:3000 -v "$PWD":/workdir -w /workdir pusewicz/statique server
|
55
|
-
|
56
|
+
|
56
57
|
### Build your Statique website
|
57
58
|
|
58
59
|
The final step before deploying your website to your preferred host is to build it. By default, the built website will be available in the `dist/` subdirectory.
|
@@ -60,11 +61,11 @@ The final step before deploying your website to your preferred host is to build
|
|
60
61
|
First, change into your new Statique website directory:
|
61
62
|
|
62
63
|
$ cd my-website
|
63
|
-
|
64
|
+
|
64
65
|
#### Whalebrew package, Ruby gem
|
65
66
|
|
66
67
|
$ statique build
|
67
|
-
|
68
|
+
|
68
69
|
#### Docker
|
69
70
|
|
70
71
|
$ docker run -it --rm -v "$PWD":/workdir -w /workdir pusewicz/statique build
|
File without changes
|
data/docs/content/index.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Statique is a static site generator written in [Ruby](https://www.ruby-lang.org/) and uses [Roda](https://roda.jeremyevans.net/) for the Rack middleware. By default, it comes with support for [Slim](http://slim-lang.com/)
|
1
|
+
Statique is a static site generator written in [Ruby](https://www.ruby-lang.org/) and uses [Roda](https://roda.jeremyevans.net/) for the Rack middleware. By default, it comes with support for [Slim](http://slim-lang.com/) and [Markdown](https://daringfireball.net/projects/markdown/).
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
data/lib/statique/app.rb
CHANGED
@@ -19,21 +19,21 @@ class Statique
|
|
19
19
|
|
20
20
|
def_delegators :Statique, :url, :root_url
|
21
21
|
|
22
|
-
opts[:root] = Statique.paths.pwd
|
22
|
+
opts[:root] = Statique.configuration.paths.pwd
|
23
23
|
|
24
24
|
plugin :environments
|
25
25
|
plugin :static_routing
|
26
|
-
plugin :render, views: Statique.paths.content.basename, engine: "slim", allowed_paths: [Statique.paths.content.basename, Statique.paths.layouts.basename]
|
27
|
-
plugin :partials, views: Statique.paths.layouts.basename
|
26
|
+
plugin :render, views: Statique.configuration.paths.content.basename, engine: "slim", allowed_paths: [Statique.configuration.paths.content.basename, Statique.configuration.paths.layouts.basename]
|
27
|
+
plugin :partials, views: Statique.configuration.paths.layouts.basename
|
28
28
|
|
29
|
-
if Statique.mode.server? && Statique.paths.public.exist?
|
30
|
-
plugin :public, root: Statique.paths.public.basename
|
29
|
+
if Statique.mode.server? && Statique.configuration.paths.public.exist?
|
30
|
+
plugin :public, root: Statique.configuration.paths.public.basename
|
31
31
|
end
|
32
32
|
|
33
|
-
if Statique.paths.assets.exist?
|
34
|
-
css_files = Statique.paths.assets.join("css").glob("*.{css,scss}")
|
35
|
-
js_files = Statique.paths.assets.join("js").glob("*.js")
|
36
|
-
plugin :assets, css: css_files.map { _1.basename.to_s }, js: js_files.map { _1.basename.to_s }, public: Statique.paths.destination, precompiled: Statique.paths.destination.join("assets/manifest.json"), relative_paths: true
|
33
|
+
if Statique.configuration.paths.assets.exist?
|
34
|
+
css_files = Statique.configuration.paths.assets.join("css").glob("*.{css,scss}")
|
35
|
+
js_files = Statique.configuration.paths.assets.join("js").glob("*.js")
|
36
|
+
plugin :assets, css: css_files.map { _1.basename.to_s }, js: js_files.map { _1.basename.to_s }, public: Statique.configuration.paths.destination, precompiled: Statique.configuration.paths.destination.join("assets/manifest.json"), relative_paths: true
|
37
37
|
plugin :assets_preloading
|
38
38
|
|
39
39
|
Statique.mode.build do
|
@@ -78,8 +78,8 @@ class Statique
|
|
78
78
|
|
79
79
|
if Statique.mode.server?
|
80
80
|
route do |r|
|
81
|
-
r.public if Statique.paths.public.exist?
|
82
|
-
r.assets if Statique.paths.assets.exist?
|
81
|
+
r.public if Statique.configuration.paths.public.exist?
|
82
|
+
r.assets if Statique.configuration.paths.assets.exist?
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/lib/statique/cli/build.rb
CHANGED
@@ -15,8 +15,9 @@ class Statique
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
+
require "statique/app"
|
18
19
|
time = Benchmark.realtime do
|
19
|
-
create_directory(Statique.paths.destination)
|
20
|
+
create_directory(Statique.configuration.paths.destination)
|
20
21
|
copy_public_assets
|
21
22
|
build_pages
|
22
23
|
end
|
@@ -41,7 +42,7 @@ class Statique
|
|
41
42
|
path = @queue.pop
|
42
43
|
response = mock_request.get(path)
|
43
44
|
if response.successful?
|
44
|
-
destination = Statique.paths.destination.join(File.extname(path).empty? ? "./#{path}/index.html" : "./#{path}")
|
45
|
+
destination = Statique.configuration.paths.destination.join(File.extname(path).empty? ? "./#{path}/index.html" : "./#{path}")
|
45
46
|
Statique.ui.info "Building page", path: path
|
46
47
|
create_directory(destination.dirname)
|
47
48
|
File.write(destination, response.body)
|
@@ -60,9 +61,9 @@ class Statique
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def copy_public_assets
|
63
|
-
assets = Statique.paths.public.glob("**/*.*")
|
64
|
+
assets = Statique.configuration.paths.public.glob("**/*.*")
|
64
65
|
Statique.ui.info "Copying public assets", assets:
|
65
|
-
FileUtils.cp_r(assets, Statique.paths.destination)
|
66
|
+
FileUtils.cp_r(assets, Statique.configuration.paths.destination)
|
66
67
|
end
|
67
68
|
|
68
69
|
private
|
data/lib/statique/cli/server.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Statique
|
4
|
+
class Configuration
|
5
|
+
attr_accessor :root_url
|
6
|
+
attr_accessor :paths
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@root_url = "/"
|
10
|
+
@paths = OpenStruct.new(
|
11
|
+
pwd: Pathname.pwd,
|
12
|
+
public: Pathname.pwd.join("public"),
|
13
|
+
content: Pathname.pwd.join("content"),
|
14
|
+
layouts: Pathname.pwd.join("layouts"),
|
15
|
+
assets: Pathname.pwd.join("assets"),
|
16
|
+
destination: Pathname.pwd.join("dist")
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/statique/discover.rb
CHANGED
@@ -56,7 +56,7 @@ class Statique
|
|
56
56
|
def watch_for_changes
|
57
57
|
require "filewatcher"
|
58
58
|
|
59
|
-
@filewatcher = Filewatcher.new([Statique.paths.content, Statique.paths.layouts])
|
59
|
+
@filewatcher = Filewatcher.new([Statique.configuration.paths.content, Statique.configuration.paths.layouts])
|
60
60
|
@filewatcher_thread = Thread.new(@filewatcher) do |watcher|
|
61
61
|
watcher.watch do |file, event|
|
62
62
|
Statique.ui.debug "File change event", file: file, event: event
|
data/lib/statique/version.rb
CHANGED
data/lib/statique.rb
CHANGED
@@ -6,37 +6,27 @@ require "pathname"
|
|
6
6
|
require "pagy"
|
7
7
|
require "rack"
|
8
8
|
require "tty-logger"
|
9
|
-
require "dry-configurable"
|
10
9
|
|
11
10
|
::FrontMatterParser::SyntaxParser::Builder = FrontMatterParser::SyntaxParser::MultiLineComment["=begin", "=end"]
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.expand_path("..", __FILE__))
|
14
|
-
require "zeitwerk"
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
require "statique/version"
|
15
|
+
require "statique/cli"
|
16
|
+
require "statique/mode"
|
17
|
+
require "statique/discover"
|
18
|
+
require "statique/document"
|
21
19
|
|
22
20
|
class Statique
|
23
|
-
extend Dry::Configurable
|
24
|
-
|
25
21
|
class Error < StandardError; end
|
26
22
|
|
27
|
-
setting :paths, reader: true do
|
28
|
-
setting :pwd, default: Pathname.pwd, constructor: -> { Pathname(_1) }
|
29
|
-
setting :public, default: Pathname.pwd.join("public"), constructor: -> { Statique.pwd.join(_1) }
|
30
|
-
setting :content, default: Pathname.pwd.join("content"), constructor: -> { Statique.pwd.join(_1) }
|
31
|
-
setting :layouts, default: Pathname.pwd.join("layouts"), constructor: -> { Statique.pwd.join(_1) }
|
32
|
-
setting :assets, default: Pathname.pwd.join("assets"), constructor: -> { Statique.pwd.join(_1) }
|
33
|
-
setting :destination, default: Pathname.pwd.join("dist"), constructor: -> { Statique.pwd.join(_1) }
|
34
|
-
end
|
35
|
-
setting :root_url, default: "/", reader: true
|
36
|
-
|
37
23
|
class << self
|
24
|
+
def configuration
|
25
|
+
@configuration ||= Configuration.new
|
26
|
+
end
|
27
|
+
|
38
28
|
def discover
|
39
|
-
@discover ||= Discover.new(paths.content)
|
29
|
+
@discover ||= Discover.new(configuration.paths.content)
|
40
30
|
end
|
41
31
|
|
42
32
|
def mode
|
data/statique.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Statique is a static website generator written in Ruby using Roda"
|
13
13
|
spec.homepage = "https://github.com/pusewicz/statique"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">=
|
15
|
+
spec.required_ruby_version = ">= 3.1.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/pusewicz/statique"
|
@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
33
|
spec.add_dependency "builder", "~> 3.2.4"
|
34
34
|
spec.add_dependency "commonmarker", "~> 0.23.2"
|
35
|
-
spec.add_dependency "dry-configurable", "~> 0.14.0"
|
36
35
|
spec.add_dependency "filewatcher", "~> 1.1.1"
|
37
36
|
spec.add_dependency "front_matter_parser", "~> 1.0.1"
|
38
37
|
spec.add_dependency "hashie", "~> 5.0.0"
|
@@ -40,13 +39,11 @@ Gem::Specification.new do |spec|
|
|
40
39
|
spec.add_dependency "pagy", "~> 5.9.3"
|
41
40
|
spec.add_dependency "rack-rewrite", "~> 1.5.1"
|
42
41
|
spec.add_dependency "roda", "~> 3.52"
|
43
|
-
spec.add_dependency "sassc", "~> 2.4.0"
|
44
42
|
spec.add_dependency "slim", "~> 4.1.0"
|
45
43
|
spec.add_dependency "thor", "~> 1.2.1"
|
46
44
|
spec.add_dependency "tilt", "~> 2.0.10"
|
47
45
|
spec.add_dependency "tty-logger", "~> 0.6.0"
|
48
46
|
spec.add_dependency "webrick", "~> 1.7.0"
|
49
|
-
spec.add_dependency "zeitwerk", "~> 2.5.4"
|
50
47
|
|
51
48
|
# For more information and examples about making a new gem, check out our
|
52
49
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statique
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Usewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.23.2
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: dry-configurable
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.14.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.14.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: filewatcher
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,20 +136,6 @@ dependencies:
|
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '3.52'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: sassc
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 2.4.0
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 2.4.0
|
167
139
|
- !ruby/object:Gem::Dependency
|
168
140
|
name: slim
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,20 +206,6 @@ dependencies:
|
|
234
206
|
- - "~>"
|
235
207
|
- !ruby/object:Gem::Version
|
236
208
|
version: 1.7.0
|
237
|
-
- !ruby/object:Gem::Dependency
|
238
|
-
name: zeitwerk
|
239
|
-
requirement: !ruby/object:Gem::Requirement
|
240
|
-
requirements:
|
241
|
-
- - "~>"
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: 2.5.4
|
244
|
-
type: :runtime
|
245
|
-
prerelease: false
|
246
|
-
version_requirements: !ruby/object:Gem::Requirement
|
247
|
-
requirements:
|
248
|
-
- - "~>"
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: 2.5.4
|
251
209
|
description: Statique is a static website generator written in Ruby using Roda
|
252
210
|
email:
|
253
211
|
- piotr@layer22.com
|
@@ -268,7 +226,7 @@ files:
|
|
268
226
|
- Rakefile
|
269
227
|
- bin/console
|
270
228
|
- bin/setup
|
271
|
-
- docs/assets/css/app.
|
229
|
+
- docs/assets/css/app.css
|
272
230
|
- docs/content/index.md
|
273
231
|
- docs/layouts/layout.slim
|
274
232
|
- exe/statique
|
@@ -278,6 +236,7 @@ files:
|
|
278
236
|
- lib/statique/cli/build.rb
|
279
237
|
- lib/statique/cli/init.rb
|
280
238
|
- lib/statique/cli/server.rb
|
239
|
+
- lib/statique/configuration.rb
|
281
240
|
- lib/statique/discover.rb
|
282
241
|
- lib/statique/document.rb
|
283
242
|
- lib/statique/mode.rb
|
@@ -295,7 +254,7 @@ licenses:
|
|
295
254
|
metadata:
|
296
255
|
homepage_uri: https://github.com/pusewicz/statique
|
297
256
|
source_code_uri: https://github.com/pusewicz/statique
|
298
|
-
changelog_uri: https://raw.githubusercontent.com/pusewicz/statique/v0.1.
|
257
|
+
changelog_uri: https://raw.githubusercontent.com/pusewicz/statique/v0.1.2/CHANGELOG.md
|
299
258
|
post_install_message:
|
300
259
|
rdoc_options: []
|
301
260
|
require_paths:
|
@@ -304,7 +263,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
304
263
|
requirements:
|
305
264
|
- - ">="
|
306
265
|
- !ruby/object:Gem::Version
|
307
|
-
version:
|
266
|
+
version: 3.1.0
|
308
267
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
268
|
requirements:
|
310
269
|
- - ">="
|