runecms 0.0.11 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.lt3 +70 -6
- data/README.md +73 -26
- data/bin/rcms +1 -6
- data/examples/ex1/config.txt +2 -2
- data/lib/runecms/commands.rb +33 -19
- data/lib/runecms/support.rb +29 -7
- data/lib/runecms/version.rb +1 -1
- data/runecms.gemspec +6 -4
- metadata +3 -6
- data/examples/ex1/target/file2.html +0 -3
- data/examples/ex1/target/file3.html +0 -10
- data/examples/ex1/target/index.html +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc04745ed11b9b44de73a58febc4525ea2aac352f4396a46fe86ea9db3019756
|
4
|
+
data.tar.gz: '08ce062e18a1775343d4f01ad0963b835985509da733d0ae989eb5b716bbd94d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9619e3058fd89d910fd6ed7a07de894f0bc68e0884fd7436b9bba8a8248000d38650e9c86fe8a2e498ecaf6b4ae170f82a71dd916c5be4e9e8a5a9846fdd43e7
|
7
|
+
data.tar.gz: ca0cdf6c1235c3b314669a395ad9407dc18df48f1a2950534830d69b0970ff18b96dcf318e33fb3c5957d3709e78b8e37b7092f8245f1ca6392513b18af164c8
|
data/README.lt3
CHANGED
@@ -1,23 +1,44 @@
|
|
1
|
+
. Note: at present, paragraphs are broken in livetext. Hence the .br
|
2
|
+
|
1
3
|
RuneCMS is intended to be a simple, lightweight tool for building
|
2
4
|
and deploying static websites.
|
3
5
|
|
6
|
+
.br 2
|
7
|
+
|
4
8
|
It's based on Livetext, but could be generalized to be agnostic of
|
5
9
|
that tool. It is abstracted from a portion of RuneBlog.
|
6
10
|
|
11
|
+
.br 2
|
12
|
+
|
7
13
|
In its present form, the `rcms command simply takes a parameter.
|
8
|
-
|
14
|
+
Choices are:
|
15
|
+
|
16
|
+
.br 2
|
17
|
+
|
9
18
|
.xtable
|
10
|
-
`[
|
11
|
-
|
12
|
-
`[
|
13
|
-
|
14
|
-
`[
|
19
|
+
`[rcms version] :: Print the version number of RuneCMS
|
20
|
+
|
21
|
+
`[rcms config] :: Initialize `config.txt if necessary and edit with `vi
|
22
|
+
|
23
|
+
`[rcms check] :: List stale files, but do nothing else
|
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
|
15
34
|
.end
|
16
35
|
|
17
36
|
At present, there is no check for these to be done in order. For example,
|
18
37
|
you could publish without a generate (analogous to editing a C program
|
19
38
|
and running the executable without recompiling it).
|
20
39
|
|
40
|
+
.br 2
|
41
|
+
|
21
42
|
The assumption is made that keys for the user and server are already
|
22
43
|
set up. The `config.txt file looks like:
|
23
44
|
|
@@ -27,6 +48,49 @@ path: /var/www/foo
|
|
27
48
|
user: hal9000
|
28
49
|
</pre>
|
29
50
|
|
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
|
30
94
|
|
31
95
|
More details later...
|
32
96
|
|
data/README.md
CHANGED
@@ -1,53 +1,100 @@
|
|
1
1
|
RuneCMS is intended to be a simple, lightweight tool for building
|
2
2
|
and deploying static websites.
|
3
|
-
<
|
4
|
-
|
3
|
+
<br><br>
|
5
4
|
It's based on Livetext, but could be generalized to be agnostic of
|
6
5
|
that tool. It is abstracted from a portion of RuneBlog.
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
<br><br>
|
7
|
+
In its present form, the <t>rcms</t> command simply takes a parameter.
|
8
|
+
Choices are:
|
9
|
+
<br><br>
|
11
10
|
<br><center><table width=90% cellpadding=5>
|
12
11
|
<tr>
|
13
|
-
<td valign=top><
|
14
|
-
<td valign=top>
|
12
|
+
<td valign=top><t>rcms version</t></td>
|
13
|
+
<td valign=top>Print the version number of RuneCMS</td>
|
15
14
|
</tr>
|
16
15
|
<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>
|
19
16
|
</tr>
|
20
17
|
<tr>
|
21
|
-
<td valign=top><
|
22
|
-
<td valign=top>
|
18
|
+
<td valign=top><t>rcms config</t></td>
|
19
|
+
<td valign=top>Initialize <t>config.txt</t> if necessary and edit with <t>vi</t></td>
|
23
20
|
</tr>
|
24
21
|
<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>
|
27
22
|
</tr>
|
28
23
|
<tr>
|
29
|
-
<td valign=top><
|
24
|
+
<td valign=top><t>rcms check</t></td>
|
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>
|
30
55
|
<td valign=top>Browse the current state of the remote server</td>
|
31
56
|
</tr>
|
32
57
|
</table></center>
|
33
58
|
At present, there is no check for these to be done in order. For example,
|
34
59
|
you could publish without a generate (analogous to editing a C program
|
35
60
|
and running the executable without recompiling it).
|
36
|
-
<
|
37
|
-
|
61
|
+
<br><br>
|
38
62
|
The assumption is made that keys for the user and server are already
|
39
|
-
set up. The <
|
40
|
-
<p>
|
41
|
-
|
63
|
+
set up. The <t>config.txt</t> file looks like:
|
42
64
|
<pre>
|
43
65
|
server: foo.com
|
44
66
|
path: /var/www/foo
|
45
67
|
user: hal9000
|
46
68
|
</pre>
|
47
|
-
<
|
48
|
-
|
49
|
-
<
|
50
|
-
|
69
|
+
<hr>
|
70
|
+
<b>Original notes:</b>
|
71
|
+
<pre>
|
72
|
+
General idea: Website is stored in a directory tree. Use Livetext (etc.?) to create target files
|
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>
|
51
100
|
More details later...
|
52
|
-
<p>
|
53
|
-
|
data/bin/rcms
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$LOAD_PATH << "lib"
|
4
|
-
$LOAD_PATH << "../../lib" # for examples/ex1/ etc.
|
5
|
-
|
6
|
-
require 'rubygems'
|
3
|
+
$LOAD_PATH << "lib"
|
7
4
|
|
8
5
|
require 'runecms'
|
9
6
|
|
@@ -15,7 +12,5 @@ cmd = ARGV.first
|
|
15
12
|
|
16
13
|
abort "Don't know #{cmd}" unless command?(cmd)
|
17
14
|
|
18
|
-
read_config
|
19
|
-
|
20
15
|
execute(cmd)
|
21
16
|
|
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,29 +3,52 @@ 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
|
+
|
6
21
|
def run_config
|
7
|
-
unless
|
8
|
-
File.open(
|
22
|
+
unless read_config
|
23
|
+
File.open("config.txt", "w") do |f|
|
9
24
|
f.puts "server: "
|
10
|
-
f.puts "path:
|
11
|
-
f.puts "user:
|
25
|
+
f.puts "path: "
|
26
|
+
f.puts "user: "
|
12
27
|
end
|
13
28
|
end
|
14
|
-
system("vi
|
29
|
+
system("vi config.txt")
|
15
30
|
end
|
16
31
|
|
17
32
|
def run_generate
|
18
33
|
verify_dirs # handle missing subdirectories
|
19
|
-
|
20
|
-
|
21
|
-
puts "
|
22
|
-
|
23
|
-
|
34
|
+
stale = stale_files("source")
|
35
|
+
if stale.empty?
|
36
|
+
puts "Nothing to do"
|
37
|
+
else
|
38
|
+
puts "Stale files:"
|
39
|
+
stale.each do |file|
|
40
|
+
puts " " + file
|
24
41
|
update_target(file)
|
25
42
|
end
|
43
|
+
puts
|
26
44
|
end
|
27
45
|
end
|
28
46
|
|
47
|
+
def run_update
|
48
|
+
run_generate
|
49
|
+
run_publish
|
50
|
+
end
|
51
|
+
|
29
52
|
def run_view
|
30
53
|
# FIXME index is hardcoded...
|
31
54
|
system("open target/index.html")
|
@@ -34,19 +57,10 @@ end
|
|
34
57
|
def run_publish
|
35
58
|
cmd = "rsync -r -z target/ #@user@#@server:#@path/"
|
36
59
|
system(cmd)
|
37
|
-
# puts "Would run: '#{cmd}'"
|
38
|
-
# puts
|
39
|
-
end
|
40
|
-
|
41
|
-
def run_update
|
42
|
-
run_generate
|
43
|
-
run_publish
|
44
60
|
end
|
45
61
|
|
46
62
|
def run_browse
|
47
63
|
system("open #@server")
|
48
|
-
# puts "Would run: 'open #@server'"
|
49
|
-
# puts
|
50
64
|
end
|
51
65
|
|
52
66
|
def command?(cmd)
|
data/lib/runecms/support.rb
CHANGED
@@ -3,19 +3,32 @@ 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
|
6
7
|
rcms generate Find stale files under source/ and generate them under target/
|
7
8
|
rcms view View the current state of target/ via browser (local files)
|
8
9
|
rcms publish Publish target/ to the remote server
|
9
10
|
rcms update Shortcut - Like a generate followed by a push
|
10
11
|
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
|
+
|
11
20
|
TEXT
|
12
21
|
puts
|
13
22
|
exit
|
14
23
|
end
|
15
24
|
|
16
|
-
def
|
17
|
-
list =
|
18
|
-
|
25
|
+
def stale_files(dir)
|
26
|
+
list = nil
|
27
|
+
path = "#{Dir.pwd}/#{dir}/"
|
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) }
|
19
32
|
end
|
20
33
|
|
21
34
|
def stale?(file) # without source/ or target/
|
@@ -44,7 +57,6 @@ def update_target(file)
|
|
44
57
|
cmd = "cp source/#{file} target/#{file2}"
|
45
58
|
end
|
46
59
|
end
|
47
|
-
# puts cmd
|
48
60
|
system(cmd)
|
49
61
|
end
|
50
62
|
|
@@ -74,13 +86,23 @@ def fix_extension(file)
|
|
74
86
|
end
|
75
87
|
|
76
88
|
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
|
77
96
|
lines = File.readlines("config.txt")
|
78
97
|
# Example: "user: hal9000"
|
79
98
|
lines.each do |line|
|
80
99
|
var, val = line.split(": ")
|
81
|
-
instance_variable_set("@"+var, val.chomp.strip)
|
100
|
+
instance_variable_set("@" + var, val.chomp.strip)
|
82
101
|
end
|
83
|
-
|
84
|
-
|
102
|
+
return true
|
103
|
+
rescue => e
|
104
|
+
puts "Can't read config file: here = #{here} pwd = #{Dir.pwd}"
|
105
|
+
puts e
|
106
|
+
return false
|
85
107
|
end
|
86
108
|
|
data/lib/runecms/version.rb
CHANGED
data/runecms.gemspec
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'find'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require "runecms"
|
4
|
+
require_relative "lib/runecms"
|
7
5
|
|
8
6
|
Gem::Specification.new do |s|
|
9
7
|
def s.file_trees(*dirs)
|
10
8
|
list = []
|
11
|
-
dirs.each
|
9
|
+
dirs.each do |dir|
|
10
|
+
stuff = Find.find(dir).to_a
|
11
|
+
list += stuff
|
12
|
+
end
|
12
13
|
list
|
13
14
|
end
|
14
15
|
|
@@ -34,4 +35,5 @@ Gem::Specification.new do |s|
|
|
34
35
|
s.files = main + misc
|
35
36
|
s.homepage = 'https://github.com/Hal9000/runecms'
|
36
37
|
s.license = "Ruby"
|
38
|
+
s.post_install_message = "\n Success! For help, run 'rcms' with no parameters.\n "
|
37
39
|
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.15
|
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-07-02 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,9 +24,6 @@ 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
|
30
27
|
- lib/runecms.rb
|
31
28
|
- lib/runecms/commands.rb
|
32
29
|
- lib/runecms/support.rb
|
@@ -36,7 +33,7 @@ homepage: https://github.com/Hal9000/runecms
|
|
36
33
|
licenses:
|
37
34
|
- Ruby
|
38
35
|
metadata: {}
|
39
|
-
post_install_message:
|
36
|
+
post_install_message: "\n Success! For help, run 'rcms' with no parameters.\n "
|
40
37
|
rdoc_options: []
|
41
38
|
require_paths:
|
42
39
|
- lib
|