runecms 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.lt3 +6 -70
- data/README.md +26 -73
- data/bin/rcms +6 -1
- data/examples/ex1/config.txt +2 -2
- data/examples/ex1/target/file2.html +3 -0
- data/examples/ex1/target/file3.html +10 -0
- data/examples/ex1/target/index.html +7 -0
- data/lib/runecms/commands.rb +18 -33
- data/lib/runecms/support.rb +12 -35
- data/lib/runecms/version.rb +1 -1
- data/runecms.gemspec +4 -6
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede0ce49bdbce41d4a5b21380d2917194d2c4cff1c102820f6d79a93f425121b
|
4
|
+
data.tar.gz: 43bb06d716a28baf22ad7e8eaec55ff0d584c55f2d1feb091201386af71006e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8570f0907a13e4bed0d0568e9b688fb24985c094289d6e0c09bbe0300ab6ab4ec5a58f8e64ac4d270e769345e7af068f6fc09f6f28ee12b592368ac15514ca32
|
7
|
+
data.tar.gz: d7c612dad92069bb329a3d68772e3a588c708db2dc1f87a371d8f3509a1016f7d7276516c034ee2f3bd982fe5c98a618a92b1116808e274cc1a4b63081ac9d1c
|
data/README.lt3
CHANGED
@@ -1,44 +1,23 @@
|
|
1
|
-
. Note: at present, paragraphs are broken in livetext. Hence the .br
|
2
|
-
|
3
1
|
RuneCMS is intended to be a simple, lightweight tool for building
|
4
2
|
and deploying static websites.
|
5
3
|
|
6
|
-
.br 2
|
7
|
-
|
8
4
|
It's based on Livetext, but could be generalized to be agnostic of
|
9
5
|
that tool. It is abstracted from a portion of RuneBlog.
|
10
6
|
|
11
|
-
.br 2
|
12
|
-
|
13
7
|
In its present form, the `rcms command simply takes a parameter.
|
14
|
-
|
15
|
-
|
16
|
-
.br 2
|
17
|
-
|
8
|
+
Your choices are:
|
18
9
|
.xtable
|
19
|
-
`[rcms
|
20
|
-
|
21
|
-
`[rcms
|
22
|
-
|
23
|
-
`[rcms
|
24
|
-
|
25
|
-
`[rcms generate] :: Find stale files under `source/ and generate them under `target/
|
26
|
-
|
27
|
-
`[rcms publish] :: Publish `target/ to the remote server
|
28
|
-
|
29
|
-
`[rcms update] :: Shortcut - Like a generate followed by a publish
|
30
|
-
|
31
|
-
`[rcms view] :: View the current state of `target/ via browser (local files)
|
32
|
-
|
33
|
-
`[rcms browse] :: Browse the current state of the remote server
|
10
|
+
`[ rcms config] :: Initialize `config.txt if necessary and edit with `vi
|
11
|
+
`[ rcms generate] :: Find stale files under `source/ and generate them under `target/
|
12
|
+
`[ rcms view] :: View the current state of `target/ via browser (local files)
|
13
|
+
`[ rcms publish] :: Publish `target/ to the remote server
|
14
|
+
`[ rcms browse] :: Browse the current state of the remote server
|
34
15
|
.end
|
35
16
|
|
36
17
|
At present, there is no check for these to be done in order. For example,
|
37
18
|
you could publish without a generate (analogous to editing a C program
|
38
19
|
and running the executable without recompiling it).
|
39
20
|
|
40
|
-
.br 2
|
41
|
-
|
42
21
|
The assumption is made that keys for the user and server are already
|
43
22
|
set up. The `config.txt file looks like:
|
44
23
|
|
@@ -48,49 +27,6 @@ path: /var/www/foo
|
|
48
27
|
user: hal9000
|
49
28
|
</pre>
|
50
29
|
|
51
|
-
<hr>
|
52
|
-
|
53
|
-
*[Original notes:]
|
54
|
-
|
55
|
-
<pre>
|
56
|
-
General idea: Website is stored in a directory tree. Use Livetext (etc.?) to create target files
|
57
|
-
and rsync to upload.
|
58
|
-
|
59
|
-
.br 2
|
60
|
-
|
61
|
-
Config will comprise:
|
62
|
-
- server
|
63
|
-
- user
|
64
|
-
- root/path
|
65
|
-
|
66
|
-
.br 2
|
67
|
-
|
68
|
-
Dir structure:
|
69
|
-
|
70
|
-
.br 2
|
71
|
-
|
72
|
-
site
|
73
|
-
|
|
74
|
-
+---- config.lt3
|
75
|
-
+---- source/...
|
76
|
-
+---- target/...
|
77
|
-
|
78
|
-
.br 2
|
79
|
-
|
80
|
-
Logic flow:
|
81
|
-
1. Edit file(s) under source/ tree
|
82
|
-
2. Generate
|
83
|
-
- reads config
|
84
|
-
- finds modified files under source/
|
85
|
-
- runs livetext on each
|
86
|
-
- results go under target/
|
87
|
-
3. View target/ locally to verify
|
88
|
-
4. Publish via rsync
|
89
|
-
# cmd = "rsync -r -z #{target}/ #@user@#@server:#{path}/"
|
90
|
-
|
91
|
-
</pre>
|
92
|
-
|
93
|
-
.br 2
|
94
30
|
|
95
31
|
More details later...
|
96
32
|
|
data/README.md
CHANGED
@@ -1,100 +1,53 @@
|
|
1
1
|
RuneCMS is intended to be a simple, lightweight tool for building
|
2
2
|
and deploying static websites.
|
3
|
-
<
|
3
|
+
<p>
|
4
|
+
|
4
5
|
It's based on Livetext, but could be generalized to be agnostic of
|
5
6
|
that tool. It is abstracted from a portion of RuneBlog.
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<p>
|
8
|
+
|
9
|
+
In its present form, the <font size=+1><tt>rcms</tt></font> command simply takes a parameter.
|
10
|
+
Your choices are:
|
10
11
|
<br><center><table width=90% cellpadding=5>
|
11
12
|
<tr>
|
12
|
-
<td valign=top><
|
13
|
-
<td valign=top>
|
13
|
+
<td valign=top><font size=+1><tt>rcms config</tt></font> </td>
|
14
|
+
<td valign=top>Initialize <font size=+1><tt>config.txt</tt></font> if necessary and edit with <font size=+1><tt>vi</tt></font></td>
|
14
15
|
</tr>
|
15
16
|
<tr>
|
17
|
+
<td valign=top><font size=+1><tt>rcms generate</tt></font></td>
|
18
|
+
<td valign=top>Find stale files under <font size=+1><tt>source/</tt></font> and generate them under <font size=+1><tt>target/</tt></font></td>
|
16
19
|
</tr>
|
17
20
|
<tr>
|
18
|
-
<td valign=top><
|
19
|
-
<td valign=top>
|
21
|
+
<td valign=top><font size=+1><tt>rcms view</tt></font> </td>
|
22
|
+
<td valign=top>View the current state of <font size=+1><tt>target/</tt></font> via browser (local files)</td>
|
20
23
|
</tr>
|
21
24
|
<tr>
|
25
|
+
<td valign=top><font size=+1><tt>rcms publish</tt></font> </td>
|
26
|
+
<td valign=top>Publish <font size=+1><tt>target/</tt></font> to the remote server</td>
|
22
27
|
</tr>
|
23
28
|
<tr>
|
24
|
-
<td valign=top><
|
25
|
-
<td valign=top> List stale files, but do nothing else</td>
|
26
|
-
</tr>
|
27
|
-
<tr>
|
28
|
-
</tr>
|
29
|
-
<tr>
|
30
|
-
<td valign=top><t>rcms generate</t></td>
|
31
|
-
<td valign=top>Find stale files under <t>source/</t> and generate them under <t>target/</t></td>
|
32
|
-
</tr>
|
33
|
-
<tr>
|
34
|
-
</tr>
|
35
|
-
<tr>
|
36
|
-
<td valign=top><t>rcms publish</t></td>
|
37
|
-
<td valign=top>Publish <t>target/</t> to the remote server</td>
|
38
|
-
</tr>
|
39
|
-
<tr>
|
40
|
-
</tr>
|
41
|
-
<tr>
|
42
|
-
<td valign=top><t>rcms update</t> </td>
|
43
|
-
<td valign=top>Shortcut - Like a generate followed by a publish</td>
|
44
|
-
</tr>
|
45
|
-
<tr>
|
46
|
-
</tr>
|
47
|
-
<tr>
|
48
|
-
<td valign=top><t>rcms view</t></td>
|
49
|
-
<td valign=top>View the current state of <t>target/</t> via browser (local files)</td>
|
50
|
-
</tr>
|
51
|
-
<tr>
|
52
|
-
</tr>
|
53
|
-
<tr>
|
54
|
-
<td valign=top><t>rcms browse</t></td>
|
29
|
+
<td valign=top><font size=+1><tt>rcms browse</tt></font> </td>
|
55
30
|
<td valign=top>Browse the current state of the remote server</td>
|
56
31
|
</tr>
|
57
32
|
</table></center>
|
58
33
|
At present, there is no check for these to be done in order. For example,
|
59
34
|
you could publish without a generate (analogous to editing a C program
|
60
35
|
and running the executable without recompiling it).
|
61
|
-
<
|
36
|
+
<p>
|
37
|
+
|
62
38
|
The assumption is made that keys for the user and server are already
|
63
|
-
set up. The <
|
39
|
+
set up. The <font size=+1><tt>config.txt</tt></font> file looks like:
|
40
|
+
<p>
|
41
|
+
|
64
42
|
<pre>
|
65
43
|
server: foo.com
|
66
44
|
path: /var/www/foo
|
67
45
|
user: hal9000
|
68
46
|
</pre>
|
69
|
-
<
|
70
|
-
|
71
|
-
<
|
72
|
-
|
73
|
-
and rsync to upload.
|
74
|
-
<br><br>
|
75
|
-
Config will comprise:
|
76
|
-
- server
|
77
|
-
- user
|
78
|
-
- root/path
|
79
|
-
<br><br>
|
80
|
-
Dir structure:
|
81
|
-
<br><br>
|
82
|
-
site
|
83
|
-
|
|
84
|
-
+---- config.lt3
|
85
|
-
+---- source/...
|
86
|
-
+---- target/...
|
87
|
-
<br><br>
|
88
|
-
Logic flow:
|
89
|
-
1. Edit file(s) under source/ tree
|
90
|
-
2. Generate
|
91
|
-
- reads config
|
92
|
-
- finds modified files under source/
|
93
|
-
- runs livetext on each
|
94
|
-
- results go under target/
|
95
|
-
3. View target/ locally to verify
|
96
|
-
4. Publish via rsync
|
97
|
-
# cmd = "rsync -r -z #{target}/ #@user@#@server:#{path}/"
|
98
|
-
</pre>
|
99
|
-
<br><br>
|
47
|
+
<p>
|
48
|
+
|
49
|
+
<p>
|
50
|
+
|
100
51
|
More details later...
|
52
|
+
<p>
|
53
|
+
|
data/bin/rcms
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$LOAD_PATH << "lib"
|
3
|
+
$LOAD_PATH << "lib"
|
4
|
+
$LOAD_PATH << "../../lib" # for examples/ex1/ etc.
|
5
|
+
|
6
|
+
require 'rubygems'
|
4
7
|
|
5
8
|
require 'runecms'
|
6
9
|
|
@@ -12,5 +15,7 @@ cmd = ARGV.first
|
|
12
15
|
|
13
16
|
abort "Don't know #{cmd}" unless command?(cmd)
|
14
17
|
|
18
|
+
read_config
|
19
|
+
|
15
20
|
execute(cmd)
|
16
21
|
|
data/examples/ex1/config.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
server: foo.com
|
2
|
-
path:
|
3
|
-
user:
|
2
|
+
path: /var/www/foo
|
3
|
+
user: hal9000
|
data/lib/runecms/commands.rb
CHANGED
@@ -3,52 +3,28 @@ require 'find'
|
|
3
3
|
|
4
4
|
CONFIG = "config.txt"
|
5
5
|
|
6
|
-
def run_version
|
7
|
-
puts RuneCMS::VERSION
|
8
|
-
end
|
9
|
-
|
10
|
-
def run_check
|
11
|
-
stale = stale_files("source")
|
12
|
-
if stale.empty?
|
13
|
-
puts "No stale files"
|
14
|
-
else
|
15
|
-
puts "Stale files:"
|
16
|
-
stale.each {|x| puts " " + x }
|
17
|
-
puts
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
6
|
def run_config
|
22
|
-
unless
|
23
|
-
File.open(
|
7
|
+
unless File.exist?(CONFIG)
|
8
|
+
File.open(CONFIG, "w") do |f|
|
24
9
|
f.puts "server: "
|
25
|
-
f.puts "path:
|
26
|
-
f.puts "user:
|
10
|
+
f.puts "path: "
|
11
|
+
f.puts "user: "
|
27
12
|
end
|
28
13
|
end
|
29
|
-
system("vi
|
14
|
+
system("vi #{CONFIG}")
|
30
15
|
end
|
31
16
|
|
32
17
|
def run_generate
|
33
18
|
verify_dirs # handle missing subdirectories
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
puts "Stale files:"
|
39
|
-
stale.each do |file|
|
40
|
-
puts " " + x
|
19
|
+
list = find_files("source")
|
20
|
+
list.each do |file|
|
21
|
+
if stale?(file)
|
22
|
+
puts " #{file} is stale"
|
41
23
|
update_target(file)
|
42
24
|
end
|
43
|
-
puts
|
44
25
|
end
|
45
26
|
end
|
46
27
|
|
47
|
-
def run_update
|
48
|
-
run_generate
|
49
|
-
run_publish
|
50
|
-
end
|
51
|
-
|
52
28
|
def run_view
|
53
29
|
# FIXME index is hardcoded...
|
54
30
|
system("open target/index.html")
|
@@ -57,10 +33,19 @@ end
|
|
57
33
|
def run_publish
|
58
34
|
cmd = "rsync -r -z target/ #@user@#@server:#@path/"
|
59
35
|
system(cmd)
|
36
|
+
# puts "Would run: '#{cmd}'"
|
37
|
+
# puts
|
38
|
+
end
|
39
|
+
|
40
|
+
def run_update
|
41
|
+
run_generate
|
42
|
+
run_publish
|
60
43
|
end
|
61
44
|
|
62
45
|
def run_browse
|
63
46
|
system("open #@server")
|
47
|
+
# puts "Would run: 'open #@server'"
|
48
|
+
# puts
|
64
49
|
end
|
65
50
|
|
66
51
|
def command?(cmd)
|
data/lib/runecms/support.rb
CHANGED
@@ -3,32 +3,19 @@ def usage_message
|
|
3
3
|
puts
|
4
4
|
puts <<-TEXT
|
5
5
|
rcms config Initialize config.txt if necessary and edit with vi
|
6
|
-
rcms check List stale files, but do nothing else
|
7
6
|
rcms generate Find stale files under source/ and generate them under target/
|
8
7
|
rcms view View the current state of target/ via browser (local files)
|
9
8
|
rcms publish Publish target/ to the remote server
|
10
9
|
rcms update Shortcut - Like a generate followed by a push
|
11
10
|
rcms browse Browse the current state of the remote server
|
12
|
-
|
13
|
-
Run from a directory with a config.txt, a source/ dir, and a target/ dir.
|
14
|
-
|
15
|
-
Config file looks like:
|
16
|
-
server: example.com
|
17
|
-
path: /some/arbitrary/path
|
18
|
-
user: myuser
|
19
|
-
|
20
11
|
TEXT
|
21
12
|
puts
|
22
13
|
exit
|
23
14
|
end
|
24
15
|
|
25
|
-
def
|
26
|
-
list =
|
27
|
-
|
28
|
-
list = Find.find(path).to_a
|
29
|
-
list = list.select {|x| ! File.directory?(x) }
|
30
|
-
list.map! {|x| x.sub(path, "") }
|
31
|
-
list.select {|x| stale?(x) }
|
16
|
+
def find_files(dir)
|
17
|
+
list = Find.find(dir).to_a - [dir]
|
18
|
+
list.map {|x| x.sub("#{dir}/","") }
|
32
19
|
end
|
33
20
|
|
34
21
|
def stale?(file) # without source/ or target/
|
@@ -49,14 +36,14 @@ end
|
|
49
36
|
def update_target(file)
|
50
37
|
file2 = fix_extension(file)
|
51
38
|
if lt3?(file)
|
52
|
-
|
39
|
+
update = "livetext"
|
40
|
+
redir = ">"
|
53
41
|
else
|
54
|
-
|
55
|
-
|
56
|
-
else
|
57
|
-
cmd = "cp source/#{file} target/#{file2}"
|
58
|
-
end
|
42
|
+
update = "cp"
|
43
|
+
redir = ""
|
59
44
|
end
|
45
|
+
cmd = "#{update} source/#{file} #{redir} target/#{file2}"
|
46
|
+
# puts cmd
|
60
47
|
system(cmd)
|
61
48
|
end
|
62
49
|
|
@@ -86,23 +73,13 @@ def fix_extension(file)
|
|
86
73
|
end
|
87
74
|
|
88
75
|
def read_config
|
89
|
-
config = "config.txt"
|
90
|
-
here = Dir.pwd
|
91
|
-
loop do
|
92
|
-
raise if Dir.pwd == "/" # shouldn't get this far
|
93
|
-
break if File.exist?(config)
|
94
|
-
Dir.chdir("..")
|
95
|
-
end
|
96
76
|
lines = File.readlines("config.txt")
|
97
77
|
# Example: "user: hal9000"
|
98
78
|
lines.each do |line|
|
99
79
|
var, val = line.split(": ")
|
100
|
-
instance_variable_set("@"
|
80
|
+
instance_variable_set("@"+var, val.chomp.strip)
|
101
81
|
end
|
102
|
-
|
103
|
-
|
104
|
-
puts "Can't read config file: here = #{here} pwd = #{Dir.pwd}"
|
105
|
-
puts e
|
106
|
-
return false
|
82
|
+
rescue => err
|
83
|
+
abort "Can't open config file: #{err}"
|
107
84
|
end
|
108
85
|
|
data/lib/runecms/version.rb
CHANGED
data/runecms.gemspec
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'find'
|
3
3
|
|
4
|
-
|
4
|
+
$LOAD_PATH << "lib"
|
5
|
+
|
6
|
+
require "runecms"
|
5
7
|
|
6
8
|
Gem::Specification.new do |s|
|
7
9
|
def s.file_trees(*dirs)
|
8
10
|
list = []
|
9
|
-
dirs.each
|
10
|
-
stuff = Find.find(dir).to_a
|
11
|
-
list += stuff
|
12
|
-
end
|
11
|
+
dirs.each {|dir| list += Find.find(dir).to_a }
|
13
12
|
list
|
14
13
|
end
|
15
14
|
|
@@ -35,5 +34,4 @@ Gem::Specification.new do |s|
|
|
35
34
|
s.files = main + misc
|
36
35
|
s.homepage = 'https://github.com/Hal9000/runecms'
|
37
36
|
s.license = "Ruby"
|
38
|
-
s.post_install_message = "\n Success! For help, run 'rcms' with no parameters.\n "
|
39
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runecms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple static website manager based on Livetext (and Ruby)
|
14
14
|
email: rubyhacker@gmail.com
|
@@ -24,6 +24,9 @@ files:
|
|
24
24
|
- examples/ex1/source/file2.html
|
25
25
|
- examples/ex1/source/file3.lt3
|
26
26
|
- examples/ex1/source/index.lt3
|
27
|
+
- examples/ex1/target/file2.html
|
28
|
+
- examples/ex1/target/file3.html
|
29
|
+
- examples/ex1/target/index.html
|
27
30
|
- lib/runecms.rb
|
28
31
|
- lib/runecms/commands.rb
|
29
32
|
- lib/runecms/support.rb
|
@@ -33,7 +36,7 @@ homepage: https://github.com/Hal9000/runecms
|
|
33
36
|
licenses:
|
34
37
|
- Ruby
|
35
38
|
metadata: {}
|
36
|
-
post_install_message:
|
39
|
+
post_install_message:
|
37
40
|
rdoc_options: []
|
38
41
|
require_paths:
|
39
42
|
- lib
|