staticz 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/manifest/compilable/simple_file.rb +2 -4
- data/lib/manifest/compilable.rb +10 -3
- data/lib/manifest/manifest.rb +6 -2
- data/lib/server.rb +23 -11
- data/lib/staticz.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f4c779f303f2e6bfa06e6135323e61e4c089067361d4239d6c53903c239ae02
|
4
|
+
data.tar.gz: 8958a5a56ed411ef10584076a57994a67786cda23bf6d3f0d012d77cf7954ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e49f8abff572d050666d143a4a6bbf555e2d97dfbb9d0614950dd3f93ce1d8121e34c4dac74f730fc5b8e7c6d199a675c493074881ff1f74c3a3d6aefd4ecb6
|
7
|
+
data.tar.gz: 510b452f0dbd668b955ecd56f34e8ef468c42cec49e061968784d0eb9b1917572b1f78d6e5afa56c41635aa035a55c734583c544138eda6486ee30b3d5271e58
|
data/lib/manifest/compilable.rb
CHANGED
@@ -19,7 +19,7 @@ module Staticz
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def path_method_name
|
22
|
-
"#{path.gsub(/[
|
22
|
+
"#{path.gsub(/[.\/-]/, "_")}_path"
|
23
23
|
end
|
24
24
|
|
25
25
|
def valid?
|
@@ -35,8 +35,15 @@ module Staticz
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def create_link_function
|
38
|
-
link_path = "
|
39
|
-
|
38
|
+
link_path = "/#{name}.#{build_file_ending}"
|
39
|
+
shortened_link_path = "/#{name}"
|
40
|
+
Object.send(:define_method, path_method_name) do |shorten: false|
|
41
|
+
if shorten
|
42
|
+
shortened_link_path
|
43
|
+
else
|
44
|
+
link_path
|
45
|
+
end
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
def print(indentation)
|
data/lib/manifest/manifest.rb
CHANGED
@@ -56,12 +56,16 @@ module Staticz
|
|
56
56
|
def build
|
57
57
|
load "#{Dir.pwd}/manifest.rb"
|
58
58
|
|
59
|
+
create_link_functions
|
60
|
+
|
59
61
|
elements.each do |e|
|
60
|
-
e.
|
62
|
+
e.build
|
61
63
|
end
|
64
|
+
end
|
62
65
|
|
66
|
+
def create_link_functions
|
63
67
|
elements.each do |e|
|
64
|
-
e.
|
68
|
+
e.create_link_function
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
data/lib/server.rb
CHANGED
@@ -46,6 +46,7 @@ module Staticz
|
|
46
46
|
build_manifest
|
47
47
|
|
48
48
|
Thread.new { listen_to_file_changes }
|
49
|
+
Thread.new { listen_to_manifest_changes }
|
49
50
|
thin_server.start
|
50
51
|
end
|
51
52
|
|
@@ -68,25 +69,36 @@ module Staticz
|
|
68
69
|
folders << "lib" if Dir.exist? "lib"
|
69
70
|
|
70
71
|
listener = Listen.to(*folders) do |modified, added, removed|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
.join(", ")
|
72
|
+
trigger_rebuild(modified, added, removed)
|
73
|
+
end
|
74
|
+
listener.start
|
75
|
+
end
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
puts "Rebuilding successful"
|
77
|
+
def listen_to_manifest_changes
|
78
|
+
listener = Listen.to("./", only: /^manifest.rb$/) do |modified, added, removed|
|
79
|
+
trigger_rebuild(modified, added, removed)
|
81
80
|
end
|
82
81
|
listener.start
|
83
82
|
end
|
84
83
|
|
85
|
-
def
|
86
|
-
|
84
|
+
def trigger_rebuild(modified, added, removed)
|
85
|
+
file_names = (modified + added + removed)
|
86
|
+
.map do |file|
|
87
|
+
file.gsub "#{Dir.pwd}/", ""
|
88
|
+
end
|
89
|
+
.join(", ")
|
87
90
|
|
91
|
+
$stdout.clear_screen
|
92
|
+
puts "#{file_names} changed, rebuilding..."
|
93
|
+
build_manifest
|
94
|
+
puts "Rebuilding successful"
|
95
|
+
end
|
96
|
+
|
97
|
+
def build_manifest
|
88
98
|
Staticz::Builder.new
|
89
99
|
Staticz::Manifest.instance.print
|
100
|
+
|
101
|
+
Staticz::Modules::Reload.generate_hash
|
90
102
|
end
|
91
103
|
end
|
92
104
|
end
|
data/lib/staticz.rb
CHANGED
@@ -27,7 +27,12 @@ module Staticz
|
|
27
27
|
Staticz::Settings.development!
|
28
28
|
Staticz::Server.new
|
29
29
|
when 'manifest'
|
30
|
+
Staticz::Settings.development!
|
31
|
+
|
30
32
|
load "#{Dir.pwd}/manifest.rb"
|
33
|
+
Staticz::Modules::LibLoader.load_files
|
34
|
+
Staticz::Manifest.instance.create_link_functions
|
35
|
+
|
31
36
|
Staticz::Manifest.instance.print
|
32
37
|
when 'build'
|
33
38
|
Staticz::Settings.production!
|
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.10
|
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-06-
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|