solutus 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solutus.rb +26 -19
- data/resources/editBlog.html +1 -22
- data/resources/index.html +1 -19
- data/resources/login.html +1 -14
- data/resources/style.css +23 -0
- 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: ae52f904903e09196391fcb54016663146fb2a5d5684a1c108b4d49c5d6dd89b
|
4
|
+
data.tar.gz: e130edaeb9cedfef9f7514d70cd20df83575da31a1c936dde187298321085c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4eb0309c57ac9974e34df6ab2eadce3e26d9950845010537575dde21456117963ad1440cc622a7e648d3dc8f35299d34b39f1ee692280f6ab6e85e9ca3749b7
|
7
|
+
data.tar.gz: 42018df96fbc29c1a8c57fcd404be2f979f4cf21876cdc96de787772ea684cbb41684fa21f07cf3548f4bfab032d90242347b141f22c87d0cd9c5bf1a12b7405
|
data/lib/solutus.rb
CHANGED
@@ -30,7 +30,7 @@ class Solutus
|
|
30
30
|
PASSWORD_FILE = "password.txt"
|
31
31
|
DAY_ENDINGS = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st"]
|
32
32
|
|
33
|
-
VERSION = '0.1.
|
33
|
+
VERSION = '0.1.3'
|
34
34
|
|
35
35
|
@@blog_urls = Hash.new
|
36
36
|
@@page_urls = Array.new
|
@@ -54,6 +54,7 @@ class Solutus
|
|
54
54
|
end
|
55
55
|
|
56
56
|
class Solutus_Server < Sinatra::Base
|
57
|
+
CSS = File.read(File.join(File.dirname(File.expand_path(__FILE__)), '../resources', "style.css"))
|
57
58
|
enable :sessions
|
58
59
|
|
59
60
|
set :public_folder, SITE_PATH
|
@@ -64,6 +65,10 @@ class Solutus
|
|
64
65
|
set :global_settings, glob
|
65
66
|
end
|
66
67
|
|
68
|
+
def path_to_resources
|
69
|
+
File.join(File.dirname(File.expand_path(__FILE__)), '../resources')
|
70
|
+
end
|
71
|
+
|
67
72
|
class ServerStache < Mustache
|
68
73
|
end
|
69
74
|
|
@@ -213,10 +218,6 @@ class Solutus
|
|
213
218
|
send_file File.join(path_to_resources, "404.html")
|
214
219
|
end
|
215
220
|
|
216
|
-
def path_to_resources
|
217
|
-
File.join(File.dirname(File.expand_path(__FILE__)), '../resources')
|
218
|
-
end
|
219
|
-
|
220
221
|
def render_edit_page(path)
|
221
222
|
f = File.open(File.join(path_to_resources, "editPage.html"), "r")
|
222
223
|
template = ""
|
@@ -234,7 +235,8 @@ class Solutus
|
|
234
235
|
|
235
236
|
ServerStache.template = template
|
236
237
|
result = ServerStache.new
|
237
|
-
|
238
|
+
|
239
|
+
result[:css] = CSS
|
238
240
|
result[:title] = data["title"]
|
239
241
|
result[:path] = path
|
240
242
|
link = path.split("/")[-1].split(".")[0]
|
@@ -271,6 +273,7 @@ class Solutus
|
|
271
273
|
end
|
272
274
|
data = YAML.load(file_contents)
|
273
275
|
|
276
|
+
result[:css] = CSS
|
274
277
|
result[:title] = data["title"]
|
275
278
|
result[:date] = data["date"].strftime(BLOG_DATE_FORMAT)
|
276
279
|
result[:markdown] = file_contents.split("---")[-1]
|
@@ -285,6 +288,7 @@ class Solutus
|
|
285
288
|
ServerStache.template = File.read(File.join(path_to_resources, "login.html"))
|
286
289
|
result = ServerStache.new
|
287
290
|
result[:message] = message
|
291
|
+
result[:css] = CSS
|
288
292
|
result.render
|
289
293
|
end
|
290
294
|
|
@@ -302,6 +306,7 @@ class Solutus
|
|
302
306
|
end
|
303
307
|
result[:blogs] = blog_select
|
304
308
|
result[:pages] = page_select
|
309
|
+
result[:css] = CSS
|
305
310
|
result.render
|
306
311
|
end
|
307
312
|
|
@@ -566,16 +571,18 @@ HERE
|
|
566
571
|
content += "</div>\n"
|
567
572
|
end
|
568
573
|
end
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
574
|
+
if File.directory?(File.join(SITE_PATH, ARCHIVE))
|
575
|
+
path = File.join(SITE_PATH, ARCHIVE, "index.html")
|
576
|
+
data = Hash.new
|
577
|
+
data["title"] = "Archive"
|
578
|
+
data["content"] = content
|
579
|
+
data["recents"] = recents
|
580
|
+
html = render_page(@@templates, settings_data, data, false)
|
581
|
+
f = File.new(path, "w")
|
582
|
+
f.write(html)
|
583
|
+
f.close
|
584
|
+
puts "Created blog archive @ #{path}"
|
585
|
+
end
|
579
586
|
|
580
587
|
# Mirror build
|
581
588
|
if settings_data["mirror"]
|
@@ -593,16 +600,16 @@ HERE
|
|
593
600
|
end
|
594
601
|
result = SolutusStache.new
|
595
602
|
default_data.each do |key, val|
|
596
|
-
result[key.to_sym] = val
|
603
|
+
result[key.to_sym] = val || ""
|
597
604
|
end
|
598
605
|
data.each do |key, val|
|
599
606
|
next if key == "template"
|
600
607
|
if key != "title"
|
601
608
|
val = wrap_element(key, val)
|
602
609
|
end
|
603
|
-
result[key.to_sym] = val
|
610
|
+
result[key.to_sym] = val || ""
|
604
611
|
end
|
605
|
-
result[:blog] = blog
|
612
|
+
result[:blog] = blog || false
|
606
613
|
result[:year] = Time.now.year
|
607
614
|
result.render
|
608
615
|
end
|
data/resources/editBlog.html
CHANGED
@@ -2,28 +2,7 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Editing {{title}}</title>
|
4
4
|
<style type="text/css">
|
5
|
-
|
6
|
-
margin:40px auto;
|
7
|
-
background-color: #eeeeee;
|
8
|
-
max-width:650px;
|
9
|
-
line-height:1.6;
|
10
|
-
font-size:18px;
|
11
|
-
color:#444;
|
12
|
-
padding:0 10px;
|
13
|
-
font-family: "Segoe UI", sans-serif;
|
14
|
-
}
|
15
|
-
|
16
|
-
h1, h2, h3 {
|
17
|
-
line-height:1.2
|
18
|
-
}
|
19
|
-
|
20
|
-
input[type=text] {
|
21
|
-
width: 500px;
|
22
|
-
}
|
23
|
-
a {
|
24
|
-
text-decoration: none;
|
25
|
-
color: #4286f4;
|
26
|
-
}
|
5
|
+
{{css}}
|
27
6
|
</style>
|
28
7
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
29
8
|
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
data/resources/index.html
CHANGED
@@ -2,25 +2,7 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Editing {{name}}</title>
|
4
4
|
<style type="text/css">
|
5
|
-
|
6
|
-
margin:40px auto;
|
7
|
-
background-color: #eeeeee;
|
8
|
-
max-width:650px;
|
9
|
-
line-height:1.6;
|
10
|
-
font-size:18px;
|
11
|
-
color:#444;
|
12
|
-
padding:0 10px;
|
13
|
-
font-family: "Segoe UI", sans-serif;
|
14
|
-
}
|
15
|
-
|
16
|
-
h1, h2, h3 {
|
17
|
-
line-height:1.2
|
18
|
-
}
|
19
|
-
|
20
|
-
a {
|
21
|
-
text-decoration: none;
|
22
|
-
color: #4286f4;
|
23
|
-
}
|
5
|
+
{{css}}
|
24
6
|
</style>
|
25
7
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
|
26
8
|
</head>
|
data/resources/login.html
CHANGED
@@ -2,20 +2,7 @@
|
|
2
2
|
<head>
|
3
3
|
<title>Log in to edit</title>
|
4
4
|
<style type="text/css">
|
5
|
-
|
6
|
-
margin:40px auto;
|
7
|
-
background-color: #eeeeee;
|
8
|
-
max-width:650px;
|
9
|
-
line-height:1.6;
|
10
|
-
font-size:18px;
|
11
|
-
color:#444;
|
12
|
-
padding:0 10px;
|
13
|
-
font-family: "Segoe UI", sans-serif;
|
14
|
-
}
|
15
|
-
|
16
|
-
h1, h2, h3 {
|
17
|
-
line-height:1.2
|
18
|
-
}
|
5
|
+
{{css}}
|
19
6
|
</style>
|
20
7
|
</head>
|
21
8
|
|
data/resources/style.css
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
body {
|
2
|
+
margin:40px auto;
|
3
|
+
background-color: #eeeeee;
|
4
|
+
max-width:650px;
|
5
|
+
line-height:1.6;
|
6
|
+
font-size:18px;
|
7
|
+
color:#454545;
|
8
|
+
padding:0 10px;
|
9
|
+
font-family: "Segoe UI", sans-serif;
|
10
|
+
}
|
11
|
+
|
12
|
+
h1, h2, h3 {
|
13
|
+
line-height:1.2
|
14
|
+
}
|
15
|
+
|
16
|
+
input[type=text] {
|
17
|
+
width: 500px;
|
18
|
+
}
|
19
|
+
|
20
|
+
a {
|
21
|
+
text-decoration: none;
|
22
|
+
color: #4286f4;
|
23
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solutus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerome Wei
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- resources/editPage.html
|
81
81
|
- resources/index.html
|
82
82
|
- resources/login.html
|
83
|
+
- resources/style.css
|
83
84
|
homepage: https://github.com/jeromew21/solutus
|
84
85
|
licenses:
|
85
86
|
- MIT
|
@@ -100,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
103
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.7.
|
104
|
+
rubygems_version: 2.7.7
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: simplicity
|