staticz 1.0.11 → 1.0.12
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 +7 -5
- data/lib/commands/base_command.rb +33 -0
- data/lib/commands/build_command.rb +108 -0
- data/lib/commands/manifest_command.rb +37 -0
- data/lib/commands/new_command.rb +41 -0
- data/lib/commands/server_command.rb +61 -0
- data/lib/manifest/compilable/cs.rb +7 -1
- data/lib/manifest/compilable/haml.rb +7 -2
- data/lib/manifest/compilable/js.rb +7 -1
- data/lib/manifest/compilable/react.rb +7 -1
- data/lib/manifest/compilable/sass.rb +7 -1
- data/lib/manifest/compilable/scss.rb +7 -1
- data/lib/manifest/compilable/simple_file.rb +7 -1
- data/lib/manifest/compilable.rb +1 -0
- data/lib/manifest/css_bundle.rb +12 -2
- data/lib/manifest/js_bundle.rb +12 -2
- data/lib/manifest/manifest.rb +8 -2
- data/lib/manifest/sub.rb +8 -2
- data/lib/server.rb +7 -4
- data/lib/settings.rb +16 -0
- data/lib/staticz.rb +19 -37
- data/lib/template.rb +2 -0
- metadata +35 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514a1a85d3b4dfaa09b9f9b193e8e7e8d6ab5932233ddc23e28982c0b9bd33b4
|
4
|
+
data.tar.gz: 6ed2e3c26f0e82a78fa3669aa0ce0d1753875d8e27d71b07ccacd54092b08dfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ded82ed2f8c9af219f81624e7210537d88dd0ee0f0d3188d50a2616f29e4473f2866b10b9b057d41cab6e63e54849365aae1480b86ec5301910dacc6cd340a6b
|
7
|
+
data.tar.gz: 33ee4a79b001ede15aa7fcb05ecbede3e8edd30c099eb82798f0da3ed4070424ea5789136389682e2c92149abe3da713e57e7e6be16aefb732e444579e65d9af
|
data/lib/builder.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
require "tty-spinner"
|
1
2
|
require_relative "modules/lib_loader"
|
3
|
+
require_relative "manifest/manifest"
|
2
4
|
|
3
5
|
module Staticz
|
4
6
|
class Builder
|
5
|
-
def initialize
|
6
|
-
|
7
|
+
def initialize(listener_class: nil)
|
8
|
+
@listener_class = listener_class
|
7
9
|
end
|
8
10
|
|
9
|
-
private
|
10
|
-
|
11
11
|
def build
|
12
12
|
Staticz::Modules::LibLoader.load_files
|
13
13
|
|
14
14
|
Dir.mkdir('build') unless File.exist?('build')
|
15
15
|
|
16
|
-
Staticz::Manifest.instance.build
|
16
|
+
Staticz::Manifest.instance.build(listener_class: @listener_class)
|
17
|
+
|
18
|
+
Staticz::Manifest.instance.valid?
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "tty-option"
|
2
|
+
|
3
|
+
module Staticz
|
4
|
+
class BaseCommand
|
5
|
+
include TTY::Option
|
6
|
+
|
7
|
+
usage do
|
8
|
+
program "staticz"
|
9
|
+
no_command
|
10
|
+
|
11
|
+
description "Staticz helps create static websites",
|
12
|
+
"\nCommands:",
|
13
|
+
" staticz new - Create a new project",
|
14
|
+
" staticz server - Run the development server",
|
15
|
+
" staticz manifest - Print out all files and how they will be built",
|
16
|
+
" staticz build - Compile the project"
|
17
|
+
end
|
18
|
+
|
19
|
+
argument :mode do
|
20
|
+
desc "[new server manifest build]"
|
21
|
+
end
|
22
|
+
|
23
|
+
flag :help do
|
24
|
+
short "-h"
|
25
|
+
long "--help"
|
26
|
+
desc "Print this page"
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
print help
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require "tty-option"
|
2
|
+
require_relative "../settings"
|
3
|
+
require_relative "../builder"
|
4
|
+
require_relative "../utils/colors"
|
5
|
+
|
6
|
+
module Staticz
|
7
|
+
class BuildCommand
|
8
|
+
include TTY::Option
|
9
|
+
|
10
|
+
usage do
|
11
|
+
program "staticz"
|
12
|
+
command "build"
|
13
|
+
|
14
|
+
description "Compile the project"
|
15
|
+
end
|
16
|
+
|
17
|
+
flag :verbose do
|
18
|
+
short "-v"
|
19
|
+
long "--verbose"
|
20
|
+
desc "Use verbose output"
|
21
|
+
end
|
22
|
+
|
23
|
+
flag :help do
|
24
|
+
short "-h"
|
25
|
+
long "--help"
|
26
|
+
desc "Print this page"
|
27
|
+
end
|
28
|
+
|
29
|
+
option :environment do
|
30
|
+
desc "Set the environment"
|
31
|
+
short "-e"
|
32
|
+
long "--environment environment"
|
33
|
+
|
34
|
+
default :production
|
35
|
+
permit [:development, :production]
|
36
|
+
convert :symbol
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
if params[:help]
|
41
|
+
print help
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
if !params[:environment]
|
46
|
+
puts "Environment must either be development or production"
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
|
50
|
+
if params[:verbose]
|
51
|
+
Staticz::Settings.verbose!
|
52
|
+
end
|
53
|
+
|
54
|
+
Staticz::Settings.set_environment(params[:environment])
|
55
|
+
|
56
|
+
result = Staticz::Builder.new(listener_class: BuildListener).build
|
57
|
+
|
58
|
+
if result.flatten.include? false
|
59
|
+
exit 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class BuildListener
|
65
|
+
def initialize(compilable)
|
66
|
+
@compilable = compilable
|
67
|
+
|
68
|
+
if Staticz::Settings.verbose?
|
69
|
+
puts "Compiling #{generate_text}"
|
70
|
+
else
|
71
|
+
@spinner = TTY::Spinner.new(
|
72
|
+
"[:spinner] #{generate_text}",
|
73
|
+
format: :classic,
|
74
|
+
success_mark: Colors.in_green("✔"),
|
75
|
+
error_mark: Colors.in_red("✖")
|
76
|
+
)
|
77
|
+
|
78
|
+
@spinner.auto_spin
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def finish
|
83
|
+
@spinner.success(Colors.in_green("(successful)")) if !Staticz::Settings.verbose?
|
84
|
+
end
|
85
|
+
|
86
|
+
def error
|
87
|
+
if Staticz::Settings.verbose?
|
88
|
+
puts Colors.in_red("Error:")
|
89
|
+
else
|
90
|
+
@spinner.error(Colors.in_red("(error)"))
|
91
|
+
end
|
92
|
+
|
93
|
+
@compilable.errors.each do |error|
|
94
|
+
puts Colors.in_red(error)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def generate_text
|
101
|
+
if @compilable.is_a? Staticz::JSBundle
|
102
|
+
@compilable.name
|
103
|
+
else
|
104
|
+
"#{@compilable.source_path} -> #{@compilable.build_path}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "tty-option"
|
2
|
+
require_relative "../settings"
|
3
|
+
require_relative "../modules/lib_loader"
|
4
|
+
require_relative "../manifest/manifest"
|
5
|
+
|
6
|
+
module Staticz
|
7
|
+
class ManifestCommand
|
8
|
+
include TTY::Option
|
9
|
+
|
10
|
+
usage do
|
11
|
+
program "staticz"
|
12
|
+
command "manifest"
|
13
|
+
|
14
|
+
description "Print out all files and how they will be built"
|
15
|
+
end
|
16
|
+
|
17
|
+
flag :help do
|
18
|
+
short "-h"
|
19
|
+
long "--help"
|
20
|
+
desc "Print this page"
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
if params[:help]
|
25
|
+
print help
|
26
|
+
else
|
27
|
+
Staticz::Settings.development!
|
28
|
+
|
29
|
+
load "#{Dir.pwd}/manifest.rb"
|
30
|
+
Staticz::Modules::LibLoader.load_files
|
31
|
+
Staticz::Manifest.instance.create_link_functions
|
32
|
+
|
33
|
+
Staticz::Manifest.instance.print
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "tty-option"
|
2
|
+
require_relative "../template"
|
3
|
+
|
4
|
+
module Staticz
|
5
|
+
class NewCommand
|
6
|
+
include TTY::Option
|
7
|
+
|
8
|
+
usage do
|
9
|
+
program "staticz"
|
10
|
+
command "staticz"
|
11
|
+
|
12
|
+
description "Create a new project"
|
13
|
+
end
|
14
|
+
|
15
|
+
argument :name do
|
16
|
+
required
|
17
|
+
desc "testies"
|
18
|
+
end
|
19
|
+
|
20
|
+
flag :help do
|
21
|
+
short "-h"
|
22
|
+
long "--help"
|
23
|
+
desc "Print this page"
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
if params[:help]
|
28
|
+
print help
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
if !params[:name]
|
33
|
+
puts "Name missing"
|
34
|
+
print help
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
Staticz::Template.new(params[:name])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "tty-option"
|
2
|
+
require_relative "../settings"
|
3
|
+
require_relative "../server"
|
4
|
+
|
5
|
+
module Staticz
|
6
|
+
class ServerCommand
|
7
|
+
include TTY::Option
|
8
|
+
|
9
|
+
usage do
|
10
|
+
program "staticz"
|
11
|
+
command "server"
|
12
|
+
|
13
|
+
description "Run the development server"
|
14
|
+
end
|
15
|
+
|
16
|
+
flag :help do
|
17
|
+
short "-h"
|
18
|
+
long "--help"
|
19
|
+
desc "Print this page"
|
20
|
+
end
|
21
|
+
|
22
|
+
option :port do
|
23
|
+
desc "Define the port used for the webserver"
|
24
|
+
short "-p"
|
25
|
+
long "--port port"
|
26
|
+
|
27
|
+
default 3000
|
28
|
+
convert :integer
|
29
|
+
end
|
30
|
+
|
31
|
+
option :environment do
|
32
|
+
desc "Set the environment"
|
33
|
+
short "-e"
|
34
|
+
long "--environment environment"
|
35
|
+
|
36
|
+
default :development
|
37
|
+
permit [:development, :production]
|
38
|
+
convert :symbol
|
39
|
+
end
|
40
|
+
|
41
|
+
def run
|
42
|
+
if params[:help]
|
43
|
+
print help
|
44
|
+
exit
|
45
|
+
end
|
46
|
+
|
47
|
+
if !params[:port]
|
48
|
+
puts "A given port must be an integer"
|
49
|
+
exit 1
|
50
|
+
end
|
51
|
+
|
52
|
+
if !params[:environment]
|
53
|
+
puts "Environment must either be development or production"
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
|
57
|
+
Staticz::Settings.set_environment(params[:environment])
|
58
|
+
Staticz::Server.new(params[:port])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -14,9 +14,15 @@ module Staticz
|
|
14
14
|
@name = name
|
15
15
|
end
|
16
16
|
|
17
|
-
def build
|
17
|
+
def build(listener_class: nil)
|
18
|
+
listener = listener_class&.new(self)
|
19
|
+
|
18
20
|
if exists?
|
19
21
|
File.write build_path, render
|
22
|
+
|
23
|
+
listener&.finish
|
24
|
+
else
|
25
|
+
listener&.error
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
@@ -29,11 +29,16 @@ module Staticz
|
|
29
29
|
errors
|
30
30
|
end
|
31
31
|
|
32
|
-
def build
|
32
|
+
def build(listener_class: nil)
|
33
|
+
listener = listener_class&.new(self)
|
34
|
+
|
33
35
|
if valid?
|
34
36
|
engine = ::Haml::Engine.new(File.read(source_path))
|
35
|
-
|
36
37
|
File.write build_path, engine.render
|
38
|
+
|
39
|
+
listener&.finish
|
40
|
+
else
|
41
|
+
listener&.error
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
@@ -13,9 +13,15 @@ module Staticz
|
|
13
13
|
@name = name
|
14
14
|
end
|
15
15
|
|
16
|
-
def build
|
16
|
+
def build(listener_class: nil)
|
17
|
+
listener = listener_class&.new(self)
|
18
|
+
|
17
19
|
if exists?
|
18
20
|
File.write build_path, render
|
21
|
+
|
22
|
+
listener&.finish
|
23
|
+
else
|
24
|
+
listener&.error
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
@@ -14,9 +14,15 @@ module Staticz
|
|
14
14
|
@name = name
|
15
15
|
end
|
16
16
|
|
17
|
-
def build
|
17
|
+
def build(listener_class: nil)
|
18
|
+
listener = listener_class&.new(self)
|
19
|
+
|
18
20
|
if exists?
|
19
21
|
File.write build_path, render
|
22
|
+
|
23
|
+
listener&.finish
|
24
|
+
else
|
25
|
+
listener&.error
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
@@ -14,9 +14,15 @@ module Staticz
|
|
14
14
|
@name = name
|
15
15
|
end
|
16
16
|
|
17
|
-
def build
|
17
|
+
def build(listener_class: nil)
|
18
|
+
listener = listener_class&.new(self)
|
19
|
+
|
18
20
|
if valid?
|
19
21
|
File.write build_path, render
|
22
|
+
|
23
|
+
listener&.finish
|
24
|
+
else
|
25
|
+
listener&.error
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
@@ -14,9 +14,15 @@ module Staticz
|
|
14
14
|
@name = name
|
15
15
|
end
|
16
16
|
|
17
|
-
def build
|
17
|
+
def build(listener_class: nil)
|
18
|
+
listener = listener_class&.new(self)
|
19
|
+
|
18
20
|
if valid?
|
19
21
|
File.write build_path, render
|
22
|
+
|
23
|
+
listener&.finish
|
24
|
+
else
|
25
|
+
listener&.error
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
@@ -26,9 +26,15 @@ module Staticz
|
|
26
26
|
@name = name
|
27
27
|
end
|
28
28
|
|
29
|
-
def build
|
29
|
+
def build(listener_class: nil)
|
30
|
+
listener = listener_class&.new(self)
|
31
|
+
|
30
32
|
if exists?
|
31
33
|
File.write build_path, File.read(source_path)
|
34
|
+
|
35
|
+
listener&.finish
|
36
|
+
else
|
37
|
+
listener&.error
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
data/lib/manifest/compilable.rb
CHANGED
data/lib/manifest/css_bundle.rb
CHANGED
@@ -32,8 +32,12 @@ module Staticz
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def build
|
35
|
+
def build(listener_class: nil)
|
36
|
+
listener = listener_class&.new(self)
|
37
|
+
|
36
38
|
File.write "build/#{name}_bundle.css", render
|
39
|
+
|
40
|
+
listener&.finish
|
37
41
|
end
|
38
42
|
|
39
43
|
def render
|
@@ -67,6 +71,12 @@ module Staticz
|
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
74
|
+
def valid?
|
75
|
+
elements.map do |e|
|
76
|
+
e.valid?
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
70
80
|
def print(indentation)
|
71
81
|
puts "#{" " * (indentation * 3)}└─ CSSBundle: #{name} -> #{path_method_name}"
|
72
82
|
elements.each do |e|
|
@@ -78,4 +88,4 @@ module Staticz
|
|
78
88
|
"src/#{name}"
|
79
89
|
end
|
80
90
|
end
|
81
|
-
end
|
91
|
+
end
|
data/lib/manifest/js_bundle.rb
CHANGED
@@ -36,8 +36,12 @@ module Staticz
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def build
|
39
|
+
def build(listener_class: nil)
|
40
|
+
listener = listener_class&.new(self)
|
41
|
+
|
40
42
|
File.write "build/#{name}_bundle.js", render
|
43
|
+
|
44
|
+
listener&.finish
|
41
45
|
end
|
42
46
|
|
43
47
|
def render
|
@@ -71,6 +75,12 @@ module Staticz
|
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
78
|
+
def valid?
|
79
|
+
elements.map do |e|
|
80
|
+
e.valid?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
74
84
|
def print(indentation)
|
75
85
|
puts "#{" " * (indentation * 3)}└─ JSBundle: #{name} -> #{path_method_name}"
|
76
86
|
elements.each do |e|
|
@@ -82,4 +92,4 @@ module Staticz
|
|
82
92
|
"src/#{name}"
|
83
93
|
end
|
84
94
|
end
|
85
|
-
end
|
95
|
+
end
|
data/lib/manifest/manifest.rb
CHANGED
@@ -69,13 +69,13 @@ module Staticz
|
|
69
69
|
s.instance_eval(&block)
|
70
70
|
end
|
71
71
|
|
72
|
-
def build
|
72
|
+
def build(listener_class: nil)
|
73
73
|
load "#{Dir.pwd}/manifest.rb"
|
74
74
|
|
75
75
|
create_link_functions
|
76
76
|
|
77
77
|
elements.each do |e|
|
78
|
-
e.build
|
78
|
+
e.build(listener_class: listener_class)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -85,6 +85,12 @@ module Staticz
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def valid?
|
89
|
+
elements.map do |e|
|
90
|
+
e.valid?
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
88
94
|
def self.define(&block)
|
89
95
|
Staticz::Manifest.instance.define(block)
|
90
96
|
end
|
data/lib/manifest/sub.rb
CHANGED
@@ -55,11 +55,11 @@ module Staticz
|
|
55
55
|
s.instance_eval(&block)
|
56
56
|
end
|
57
57
|
|
58
|
-
def build
|
58
|
+
def build(listener_class: nil)
|
59
59
|
Dir.mkdir("build/#{name}") if !Dir.exist?("build/#{name}")
|
60
60
|
|
61
61
|
elements.each do |e|
|
62
|
-
e.build
|
62
|
+
e.build(listener_class: listener_class)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -69,6 +69,12 @@ module Staticz
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
def valid?
|
73
|
+
elements.map do |e|
|
74
|
+
e.valid?
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
72
78
|
def print(indentation, *args)
|
73
79
|
puts "#{" " * (indentation * 3)}└─ Sub: #{name}"
|
74
80
|
elements.each do |e|
|
data/lib/server.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
require "thin"
|
2
2
|
require "listen"
|
3
3
|
require "io/console"
|
4
|
-
|
5
4
|
require_relative "manifest/manifest"
|
6
5
|
require_relative "modules/reload"
|
6
|
+
require_relative "builder"
|
7
|
+
require_relative "utils/helpers"
|
7
8
|
|
8
9
|
module Staticz
|
9
10
|
class Server
|
10
|
-
def initialize
|
11
|
+
def initialize(port)
|
12
|
+
@port = port
|
13
|
+
|
11
14
|
Thin::Logging.silent = true
|
12
15
|
|
13
16
|
app = Rack::Builder.new do
|
@@ -40,7 +43,7 @@ module Staticz
|
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
|
-
thin_server = Thin::Server.new '127.0.0.1',
|
46
|
+
thin_server = Thin::Server.new '127.0.0.1', port
|
44
47
|
thin_server.app = app
|
45
48
|
|
46
49
|
build_manifest
|
@@ -95,7 +98,7 @@ module Staticz
|
|
95
98
|
end
|
96
99
|
|
97
100
|
def build_manifest
|
98
|
-
Staticz::Builder.new
|
101
|
+
Staticz::Builder.new.build
|
99
102
|
Staticz::Manifest.instance.print
|
100
103
|
|
101
104
|
Staticz::Modules::Reload.generate_hash
|
data/lib/settings.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
module Staticz
|
2
2
|
class Settings
|
3
|
+
def self.set_environment(environment)
|
4
|
+
@@env = environment
|
5
|
+
end
|
6
|
+
|
3
7
|
def self.development!
|
4
8
|
@@env = :development
|
5
9
|
end
|
@@ -15,6 +19,18 @@ module Staticz
|
|
15
19
|
def self.production?
|
16
20
|
@@env == :production
|
17
21
|
end
|
22
|
+
|
23
|
+
def self.verbose!
|
24
|
+
@@verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.verbose?
|
28
|
+
if defined? @@verbose
|
29
|
+
@@verbose == true
|
30
|
+
else
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
18
34
|
end
|
19
35
|
end
|
20
36
|
|
data/lib/staticz.rb
CHANGED
@@ -1,44 +1,26 @@
|
|
1
|
-
|
2
|
-
require_relative "
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
6
|
-
require_relative "
|
1
|
+
require "tty-option"
|
2
|
+
require_relative "commands/base_command"
|
3
|
+
require_relative "commands/new_command"
|
4
|
+
require_relative "commands/server_command"
|
5
|
+
require_relative "commands/manifest_command"
|
6
|
+
require_relative "commands/build_command"
|
7
7
|
|
8
8
|
module Staticz
|
9
9
|
def self.init
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
case ARGV[0]
|
20
|
-
when 'new'
|
21
|
-
if ARGV[1]
|
22
|
-
Staticz::Template.new(ARGV[1])
|
23
|
-
else
|
24
|
-
puts usage
|
25
|
-
end
|
26
|
-
when 'server'
|
27
|
-
Staticz::Settings.development!
|
28
|
-
Staticz::Server.new
|
29
|
-
when 'manifest'
|
30
|
-
Staticz::Settings.development!
|
31
|
-
|
32
|
-
load "#{Dir.pwd}/manifest.rb"
|
33
|
-
Staticz::Modules::LibLoader.load_files
|
34
|
-
Staticz::Manifest.instance.create_link_functions
|
35
|
-
|
36
|
-
Staticz::Manifest.instance.print
|
37
|
-
when 'build'
|
38
|
-
Staticz::Settings.production!
|
39
|
-
Staticz::Builder.new
|
10
|
+
cmd, args = case ARGV[0]
|
11
|
+
when "new"
|
12
|
+
[Staticz::NewCommand.new, ARGV[1..]]
|
13
|
+
when "server"
|
14
|
+
[Staticz::ServerCommand.new, ARGV[1..]]
|
15
|
+
when "manifest"
|
16
|
+
[Staticz::ManifestCommand.new, ARGV[1..]]
|
17
|
+
when "build"
|
18
|
+
[Staticz::BuildCommand.new, ARGV[1..]]
|
40
19
|
else
|
41
|
-
|
20
|
+
[Staticz::BaseCommand.new, ARGV]
|
42
21
|
end
|
22
|
+
|
23
|
+
cmd.parse args
|
24
|
+
cmd.run
|
43
25
|
end
|
44
26
|
end
|
data/lib/template.rb
CHANGED
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.12
|
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-
|
11
|
+
date: 2022-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -108,6 +108,34 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: tty-option
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.2'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.2'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: tty-spinner
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.9'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.9'
|
111
139
|
description: Create websites with haml and sass, and compile them into static html
|
112
140
|
and css
|
113
141
|
email:
|
@@ -119,6 +147,11 @@ extra_rdoc_files: []
|
|
119
147
|
files:
|
120
148
|
- bin/staticz
|
121
149
|
- lib/builder.rb
|
150
|
+
- lib/commands/base_command.rb
|
151
|
+
- lib/commands/build_command.rb
|
152
|
+
- lib/commands/manifest_command.rb
|
153
|
+
- lib/commands/new_command.rb
|
154
|
+
- lib/commands/server_command.rb
|
122
155
|
- lib/manifest/compilable.rb
|
123
156
|
- lib/manifest/compilable/cs.rb
|
124
157
|
- lib/manifest/compilable/haml.rb
|