smallcage 0.1.8 → 0.1.9
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.
- data/History.txt +4 -0
- data/README.rdoc +2 -2
- data/Rakefile +38 -11
- data/VERSION +1 -1
- data/lib/smallcage/application.rb +6 -1
- data/lib/smallcage/commands/uri.rb +56 -0
- data/lib/smallcage/runner.rb +6 -1
- data/lib/smallcage/version.rb +1 -1
- data/project/standard/_smc/templates/header.rhtml +1 -1
- data/smallcage.gemspec +11 -5
- data/spec/data/multifiles/_smc/templates/items.uri.rhtml +1 -1
- data/spec/data/multifiles/index.html.smc +1 -0
- data/spec/spec_helper.rb +8 -3
- data/spec/uri_spec.rb +58 -0
- metadata +18 -5
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= SmallCage --
|
1
|
+
= SmallCage -- simple website generator
|
2
2
|
|
3
3
|
|
4
4
|
== Installation
|
@@ -12,7 +12,7 @@ If successfully installed, smc command will be available.
|
|
12
12
|
|
13
13
|
$ smc
|
14
14
|
Usage: smc <subcommand> [options]
|
15
|
-
SmallCage 0.1.
|
15
|
+
SmallCage 0.1.9 - simple website generator
|
16
16
|
Subcommands are:
|
17
17
|
update [path] Build smc contents.
|
18
18
|
clean [path] Remove files generated from *.smc source.
|
data/Rakefile
CHANGED
@@ -1,18 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
1
4
|
begin
|
2
5
|
require 'jeweler'
|
3
|
-
Jeweler::Tasks.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "smallcage"
|
8
|
+
gem.summary = "Lightweight CMS package."
|
9
|
+
gem.description = "Lightweight CMS package."
|
10
|
+
gem.email = "smallcage@googlegroups.com"
|
11
|
+
gem.homepage = "http://www.smallcage.org"
|
12
|
+
gem.authors = ["SAITO Toshihiro", "gommmmmm", "KOSEKI Kengo"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
11
15
|
end
|
12
16
|
Jeweler::GemcutterTasks.new
|
13
|
-
Jeweler::RubyforgeTasks.new do |rubyforge|
|
14
|
-
rubyforge.doc_task = "rdoc"
|
15
|
-
end
|
16
17
|
rescue LoadError
|
17
18
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
19
|
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "smallcage #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class SmallCage::Application
|
2
2
|
require 'optparse'
|
3
|
-
VERSION_NOTE = "SmallCage #{SmallCage::VERSION::STRING} -
|
3
|
+
VERSION_NOTE = "SmallCage #{SmallCage::VERSION::STRING} - simple website generator"
|
4
4
|
|
5
5
|
@@signal_handlers = nil
|
6
6
|
|
@@ -53,6 +53,7 @@ Subcommands are:
|
|
53
53
|
auto [path] [port] Start auto update server.
|
54
54
|
import [name|uri] Import project.
|
55
55
|
export [path] [outputpath] Export project.
|
56
|
+
uri [path] Print URIs.
|
56
57
|
manifest [path] Generate Manifest.html file.
|
57
58
|
|
58
59
|
Options are:
|
@@ -89,6 +90,7 @@ BANNER
|
|
89
90
|
:import => "smc import [name|uri]",
|
90
91
|
:export => "smc export [path] [outputpath]",
|
91
92
|
:help => "smc help [command]\n",
|
93
|
+
:uri => "smc uri [path]\n",
|
92
94
|
}
|
93
95
|
|
94
96
|
banners.each do |k,v|
|
@@ -151,6 +153,9 @@ BANNER
|
|
151
153
|
@options[:path] = ARGV.shift
|
152
154
|
@options[:path] ||= "."
|
153
155
|
@options[:out] = ARGV.shift
|
156
|
+
elsif @options[:command] == :uri
|
157
|
+
@options[:path] = ARGV.shift
|
158
|
+
@options[:path] ||= "."
|
154
159
|
elsif @options[:command] == :manifest
|
155
160
|
@options[:path] = ARGV.shift
|
156
161
|
@options[:path] ||= "."
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module SmallCage::Commands
|
2
|
+
class Uri
|
3
|
+
|
4
|
+
def self.execute(opts)
|
5
|
+
self.new(opts).execute
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(opts)
|
9
|
+
@opts = opts
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
target = Pathname.new(@opts[:path])
|
14
|
+
unless target.exist?
|
15
|
+
raise "target directory or file does not exist.: " + target.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
@loader = SmallCage::Loader.new(target)
|
19
|
+
@renderer = SmallCage::Renderer.new(@loader)
|
20
|
+
print_uris
|
21
|
+
end
|
22
|
+
|
23
|
+
def print_uris
|
24
|
+
@loader.each_smc_obj do |obj|
|
25
|
+
print_default_or_template_uris(obj)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
private :print_uris
|
29
|
+
|
30
|
+
def print_default_or_template_uris(obj)
|
31
|
+
uris = @renderer.render(obj["template"] + ".uri", obj)
|
32
|
+
if uris
|
33
|
+
print_uri_templates(obj, uris.split(/\r\n|\r|\n/))
|
34
|
+
else
|
35
|
+
puts obj["uri"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
private :print_default_or_template_uris
|
39
|
+
|
40
|
+
def print_uri_templates(obj, uris)
|
41
|
+
|
42
|
+
uris = uris.map {|uri| uri.strip }
|
43
|
+
base = obj['path'].parent
|
44
|
+
uris.each_with_index do |uri, index|
|
45
|
+
if uri.empty?
|
46
|
+
puts ""
|
47
|
+
else
|
48
|
+
docpath = SmallCage::DocumentPath.create_with_uri(@loader.root, uri, base)
|
49
|
+
puts docpath.uri
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
private :print_uri_templates
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/smallcage/runner.rb
CHANGED
@@ -44,8 +44,13 @@ module SmallCage
|
|
44
44
|
SmallCage::Commands::Export.execute(@opts)
|
45
45
|
end
|
46
46
|
|
47
|
+
def uri
|
48
|
+
require_command "uri"
|
49
|
+
SmallCage::Commands::Uri.execute(@opts)
|
50
|
+
end
|
51
|
+
|
47
52
|
def require_command(name)
|
48
53
|
require "smallcage/commands/#{name}.rb"
|
49
54
|
end
|
50
55
|
end
|
51
|
-
end
|
56
|
+
end
|
data/lib/smallcage/version.rb
CHANGED
data/smallcage.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{smallcage}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["SAITO Toshihiro", "gommmmmm", "KOSEKI Kengo"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-09}
|
13
13
|
s.default_executable = %q{smc}
|
14
14
|
s.description = %q{Lightweight CMS package.}
|
15
15
|
s.email = %q{smallcage@googlegroups.com}
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/smallcage/commands/manifest.rb",
|
36
36
|
"lib/smallcage/commands/server.rb",
|
37
37
|
"lib/smallcage/commands/update.rb",
|
38
|
+
"lib/smallcage/commands/uri.rb",
|
38
39
|
"lib/smallcage/document_path.rb",
|
39
40
|
"lib/smallcage/erb_base.rb",
|
40
41
|
"lib/smallcage/http_server.rb",
|
@@ -126,6 +127,7 @@ Gem::Specification.new do |s|
|
|
126
127
|
"spec/data/multifiles/_smc/templates/default.rhtml",
|
127
128
|
"spec/data/multifiles/_smc/templates/items.rhtml",
|
128
129
|
"spec/data/multifiles/_smc/templates/items.uri.rhtml",
|
130
|
+
"spec/data/multifiles/index.html.smc",
|
129
131
|
"spec/data/multifiles/items/index.html.smc",
|
130
132
|
"spec/data/updatelists/list1.yml",
|
131
133
|
"spec/document_path_spec.rb",
|
@@ -138,12 +140,12 @@ Gem::Specification.new do |s|
|
|
138
140
|
"spec/spec.opts",
|
139
141
|
"spec/spec_helper.rb",
|
140
142
|
"spec/update_list_spec.rb",
|
141
|
-
"spec/update_spec.rb"
|
143
|
+
"spec/update_spec.rb",
|
144
|
+
"spec/uri_spec.rb"
|
142
145
|
]
|
143
146
|
s.homepage = %q{http://www.smallcage.org}
|
144
147
|
s.rdoc_options = ["--charset=UTF-8"]
|
145
148
|
s.require_paths = ["lib"]
|
146
|
-
s.rubyforge_project = %q{smallcage}
|
147
149
|
s.rubygems_version = %q{1.3.5}
|
148
150
|
s.summary = %q{Lightweight CMS package.}
|
149
151
|
s.test_files = [
|
@@ -156,7 +158,8 @@ Gem::Specification.new do |s|
|
|
156
158
|
"spec/smallcage_spec.rb",
|
157
159
|
"spec/spec_helper.rb",
|
158
160
|
"spec/update_list_spec.rb",
|
159
|
-
"spec/update_spec.rb"
|
161
|
+
"spec/update_spec.rb",
|
162
|
+
"spec/uri_spec.rb"
|
160
163
|
]
|
161
164
|
|
162
165
|
if s.respond_to? :specification_version then
|
@@ -164,9 +167,12 @@ Gem::Specification.new do |s|
|
|
164
167
|
s.specification_version = 3
|
165
168
|
|
166
169
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
170
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
167
171
|
else
|
172
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
168
173
|
end
|
169
174
|
else
|
175
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
170
176
|
end
|
171
177
|
end
|
172
178
|
|
@@ -0,0 +1 @@
|
|
1
|
+
template: default
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
$LOAD_PATH.unshift
|
2
|
-
|
3
|
-
require '
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'smallcage'
|
4
4
|
require 'spec'
|
5
|
+
require 'spec/autorun'
|
6
|
+
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
|
9
|
+
end
|
data/spec/uri_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require 'smallcage/commands/uri'
|
3
|
+
|
4
|
+
describe SmallCage::Commands::Uri do
|
5
|
+
it "should prints all uris" do
|
6
|
+
path = Pathname.new(File.dirname(__FILE__) + "/data/multifiles")
|
7
|
+
|
8
|
+
old_stdout = $stdout
|
9
|
+
begin
|
10
|
+
$stdout = StringIO.new
|
11
|
+
opts = { :command => "uri", :path => path.to_s }
|
12
|
+
SmallCage::Runner.run(opts)
|
13
|
+
$stdout.string.should == <<EOT
|
14
|
+
/index.html
|
15
|
+
/items/items-000.html
|
16
|
+
/items/items-001.html
|
17
|
+
/items/items-002.html
|
18
|
+
/items/items-003.html
|
19
|
+
/items/items-004.html
|
20
|
+
|
21
|
+
/items/items-after-emptyline.html
|
22
|
+
EOT
|
23
|
+
ensure
|
24
|
+
$stdout = old_stdout
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should prints partial uris" do
|
29
|
+
path = Pathname.new(File.dirname(__FILE__) + "/data/multifiles")
|
30
|
+
|
31
|
+
old_stdout = $stdout
|
32
|
+
begin
|
33
|
+
$stdout = StringIO.new
|
34
|
+
opts = { :command => "uri", :path => path.to_s + "/index.html.smc" }
|
35
|
+
SmallCage::Runner.run(opts)
|
36
|
+
$stdout.string.should == <<EOT
|
37
|
+
/index.html
|
38
|
+
EOT
|
39
|
+
|
40
|
+
$stdout = StringIO.new
|
41
|
+
opts = { :command => "uri", :path => path.to_s + "/items/index.html.smc"}
|
42
|
+
SmallCage::Runner.run(opts)
|
43
|
+
$stdout.string.should == <<EOT
|
44
|
+
/items/items-000.html
|
45
|
+
/items/items-001.html
|
46
|
+
/items/items-002.html
|
47
|
+
/items/items-003.html
|
48
|
+
/items/items-004.html
|
49
|
+
|
50
|
+
/items/items-after-emptyline.html
|
51
|
+
EOT
|
52
|
+
|
53
|
+
ensure
|
54
|
+
$stdout = old_stdout
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smallcage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SAITO Toshihiro
|
@@ -11,10 +11,19 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-11-
|
14
|
+
date: 2009-11-09 00:00:00 +09:00
|
15
15
|
default_executable: smc
|
16
|
-
dependencies:
|
17
|
-
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rspec
|
19
|
+
type: :development
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 1.2.9
|
26
|
+
version:
|
18
27
|
description: Lightweight CMS package.
|
19
28
|
email: smallcage@googlegroups.com
|
20
29
|
executables:
|
@@ -41,6 +50,7 @@ files:
|
|
41
50
|
- lib/smallcage/commands/manifest.rb
|
42
51
|
- lib/smallcage/commands/server.rb
|
43
52
|
- lib/smallcage/commands/update.rb
|
53
|
+
- lib/smallcage/commands/uri.rb
|
44
54
|
- lib/smallcage/document_path.rb
|
45
55
|
- lib/smallcage/erb_base.rb
|
46
56
|
- lib/smallcage/http_server.rb
|
@@ -132,6 +142,7 @@ files:
|
|
132
142
|
- spec/data/multifiles/_smc/templates/default.rhtml
|
133
143
|
- spec/data/multifiles/_smc/templates/items.rhtml
|
134
144
|
- spec/data/multifiles/_smc/templates/items.uri.rhtml
|
145
|
+
- spec/data/multifiles/index.html.smc
|
135
146
|
- spec/data/multifiles/items/index.html.smc
|
136
147
|
- spec/data/updatelists/list1.yml
|
137
148
|
- spec/document_path_spec.rb
|
@@ -145,6 +156,7 @@ files:
|
|
145
156
|
- spec/spec_helper.rb
|
146
157
|
- spec/update_list_spec.rb
|
147
158
|
- spec/update_spec.rb
|
159
|
+
- spec/uri_spec.rb
|
148
160
|
has_rdoc: true
|
149
161
|
homepage: http://www.smallcage.org
|
150
162
|
licenses: []
|
@@ -168,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
180
|
version:
|
169
181
|
requirements: []
|
170
182
|
|
171
|
-
rubyforge_project:
|
183
|
+
rubyforge_project:
|
172
184
|
rubygems_version: 1.3.5
|
173
185
|
signing_key:
|
174
186
|
specification_version: 3
|
@@ -184,3 +196,4 @@ test_files:
|
|
184
196
|
- spec/spec_helper.rb
|
185
197
|
- spec/update_list_spec.rb
|
186
198
|
- spec/update_spec.rb
|
199
|
+
- spec/uri_spec.rb
|