staticz 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/builder.rb +4 -0
- data/lib/modules/lib_loader.rb +18 -0
- data/lib/modules/reload.rb +1 -1
- data/lib/server.rb +6 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d778ec6e3bd50f39361d84393c7de56ae57888e5bc59d22a6237af9f81c9ba4
|
4
|
+
data.tar.gz: 655bf3dff47d221a2b8baa1e84917d9dd958c641b278ecd1e4cb3bf1ea2e8a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 505c8756fdb68da5e127cb84f0df493615f5390f5abeed9b1a739b77fa42c2f76582ce1ac1979eb58589f2cdbd90f144d52e225710f42f8816481993e34a4914
|
7
|
+
data.tar.gz: f8936d899637624582117c0178c90c0494f7696d78874d99e02a056a96f4775117de5d521fbaf301f083035690c6e72557f9662eaf16dc179c4e826516c71318
|
data/lib/builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative "modules/lib_loader"
|
2
|
+
|
1
3
|
module Staticz
|
2
4
|
class Builder
|
3
5
|
def initialize
|
@@ -7,6 +9,8 @@ module Staticz
|
|
7
9
|
private
|
8
10
|
|
9
11
|
def build
|
12
|
+
Staticz::Modules::LibLoader.load_files
|
13
|
+
|
10
14
|
Dir.mkdir('build') unless File.exist?('build')
|
11
15
|
|
12
16
|
Staticz::Manifest.instance.build
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Staticz
|
2
|
+
module Modules
|
3
|
+
class LibLoader
|
4
|
+
def self.load_files
|
5
|
+
return if !Dir.exist? "lib"
|
6
|
+
|
7
|
+
Dir["lib/**/*.rb"].each do |rb_file|
|
8
|
+
begin
|
9
|
+
load rb_file
|
10
|
+
rescue SyntaxError => e
|
11
|
+
puts Colors.in_red("Could not load #{rb_file}:")
|
12
|
+
puts Colors.in_red(e.message)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/modules/reload.rb
CHANGED
@@ -14,7 +14,7 @@ module Staticz
|
|
14
14
|
function checkForChanges() {
|
15
15
|
console.log("Check for file changes");
|
16
16
|
var response = new XMLHttpRequest();
|
17
|
-
response.open("GET", "api/
|
17
|
+
response.open("GET", "api/hash", true);
|
18
18
|
response.onload = function() {
|
19
19
|
if (response.status === 200) {
|
20
20
|
if (!hash) {
|
data/lib/server.rb
CHANGED
@@ -20,7 +20,7 @@ module Staticz
|
|
20
20
|
]
|
21
21
|
}
|
22
22
|
end
|
23
|
-
map "/api/
|
23
|
+
map "/api/hash" do
|
24
24
|
run lambda { |env|
|
25
25
|
[
|
26
26
|
200,
|
@@ -64,10 +64,13 @@ module Staticz
|
|
64
64
|
private
|
65
65
|
|
66
66
|
def listen_to_file_changes
|
67
|
-
|
67
|
+
folders = ["src"]
|
68
|
+
folders << "lib" if Dir.exist? "lib"
|
69
|
+
|
70
|
+
listener = Listen.to(*folders) do |modified, added, removed|
|
68
71
|
file_names = (modified + added + removed)
|
69
72
|
.map do |file|
|
70
|
-
file.gsub "#{Dir.pwd}/
|
73
|
+
file.gsub "#{Dir.pwd}/", ""
|
71
74
|
end
|
72
75
|
.join(", ")
|
73
76
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: staticz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/manifest/compilable/simple_file.rb
|
130
130
|
- lib/manifest/manifest.rb
|
131
131
|
- lib/manifest/sub.rb
|
132
|
+
- lib/modules/lib_loader.rb
|
132
133
|
- lib/modules/reload.rb
|
133
134
|
- lib/server.rb
|
134
135
|
- lib/settings.rb
|