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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc6ec34343c5dcae981f7cdb429ca0a9c5109ebe3b45821cb9d0382c3e951476
4
- data.tar.gz: 0161f8b46af91f9095b684ce9f4eef86fda1c681d1386257e9441cecdb73c7db
3
+ metadata.gz: ede0ce49bdbce41d4a5b21380d2917194d2c4cff1c102820f6d79a93f425121b
4
+ data.tar.gz: 43bb06d716a28baf22ad7e8eaec55ff0d584c55f2d1feb091201386af71006e9
5
5
  SHA512:
6
- metadata.gz: f2e2e03011516e173831f408488975af35ebb1e4b69e2e8644648217e7f43af188355aed37b1148a1a77d92cd7965c70c17df8d7324941ee891296108f8ac6bb
7
- data.tar.gz: 51ba755814dcde8aef77a26139d35b8b9432ec18064156b8b171e5984f34e9577d20f9f55a6383e7c5407926ec562548abc190ee7a1d2dda19ba3e2f83a97dad
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
- Choices are:
15
-
16
- .br 2
17
-
8
+ Your choices are:
18
9
  .xtable
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
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
- <br><br>
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
- <br><br>
7
- In its present form, the <t>rcms</t> command simply takes a parameter.
8
- Choices are:
9
- <br><br>
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><t>rcms version</t></td>
13
- <td valign=top>Print the version number of RuneCMS</td>
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><t>rcms config</t></td>
19
- <td valign=top>Initialize <t>config.txt</t> if necessary and edit with <t>vi</t></td>
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><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>
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
- <br><br>
36
+ <p>
37
+
62
38
  The assumption is made that keys for the user and server are already
63
- set up. The <t>config.txt</t> file looks like:
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
- <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>
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
 
@@ -1,3 +1,3 @@
1
1
  server: foo.com
2
- path: /var/www/foo
3
- user: hal9000
2
+ path: /var/www/foo
3
+ user: hal9000
@@ -0,0 +1,3 @@
1
+ <h3>This file is in HTML</h3>
2
+
3
+ It would get copied over with no processing.
@@ -0,0 +1,10 @@
1
+ <h3>This file...</h3>
2
+ <p>
3
+
4
+ is a <font size=+1><tt>.lt3</tt></font> file, which means livetext would process it
5
+ before it is copied from source/ to target/
6
+ <p>
7
+
8
+ That's all for now.
9
+ <p>
10
+
@@ -0,0 +1,7 @@
1
+ <h1>Well, here we are</h1>
2
+ <p>
3
+
4
+ <b>Not much to see here, really</b>
5
+ <p>
6
+
7
+ But maybe later there will be.
@@ -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 read_config
23
- File.open("config.txt", "w") do |f|
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 config.txt")
14
+ system("vi #{CONFIG}")
30
15
  end
31
16
 
32
17
  def run_generate
33
18
  verify_dirs # handle missing subdirectories
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 " " + 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)
@@ -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 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) }
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
- cmd = "livetext source/#{file} > target/#{file2}"
39
+ update = "livetext"
40
+ redir = ">"
53
41
  else
54
- if File.directory?(file)
55
- cmd = "mkdir target/#{file2}"
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("@" + var, val.chomp.strip)
80
+ instance_variable_set("@"+var, val.chomp.strip)
101
81
  end
102
- return true
103
- rescue => e
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
 
@@ -1,3 +1,3 @@
1
1
  class RuneCMS
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
data/runecms.gemspec CHANGED
@@ -1,15 +1,14 @@
1
1
  require 'date'
2
2
  require 'find'
3
3
 
4
- require_relative "lib/runecms"
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 do |dir|
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.5
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-07-02 00:00:00.000000000 Z
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: "\n Success! For help, run 'rcms' with no parameters.\n "
39
+ post_install_message:
37
40
  rdoc_options: []
38
41
  require_paths:
39
42
  - lib