jarrett-quarto 0.1.0 → 0.2.0
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/bin/quarto +22 -0
- data/spec/children_spec.rb +2 -0
- data/spec/element_wrapper_spec.rb +2 -0
- data/spec/init_project_spec.rb +42 -0
- data/spec/matchers/file_matchers.rb +20 -0
- data/spec/spec_helper.rb +4 -2
- metadata +6 -4
data/bin/quarto
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
def require_quarto
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
4
|
+
require 'quarto'
|
5
|
+
end
|
6
|
+
|
7
|
+
case ARGV[0]
|
8
|
+
when 'help'
|
9
|
+
when 'init'
|
10
|
+
require_quarto
|
11
|
+
project_path = ARGV[1] || Dir.getwd
|
12
|
+
Quarto.init_project(project_path)
|
13
|
+
exit 0
|
14
|
+
when 'generate'
|
15
|
+
require_quarto
|
16
|
+
project_path = ARGV[1] || Dir.getwd
|
17
|
+
Quarto.generate_from_project_path(project_path)
|
18
|
+
exit 0
|
19
|
+
else
|
20
|
+
puts "Usage:\n quarto init [project_path]\n quarto generate [project_path]\n quarto help"
|
21
|
+
exit -1
|
22
|
+
end
|
data/spec/children_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/sample_project/models/company')
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/sample_project/models/employee')
|
2
4
|
|
3
5
|
describe Quarto::ElementWrapperChildren do
|
4
6
|
before :each do
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/sample_project/models/company')
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/sample_project/models/employee')
|
2
4
|
|
3
5
|
describe Quarto::ElementWrapper do
|
4
6
|
before :each do
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe Quarto do
|
5
|
+
include FileMatchers
|
6
|
+
|
7
|
+
context '.init_project on an empty directory' do
|
8
|
+
before :all do
|
9
|
+
@temp_project_path = SAMPLE_DIR + '/../temp_sample_project'
|
10
|
+
FileUtils::rm_rf @temp_project_path
|
11
|
+
Quarto.init_project(@temp_project_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
after :all do
|
15
|
+
FileUtils::rm_rf @temp_project_path
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should create the project folder' do
|
19
|
+
@temp_project_path.should exist_on_disk
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should create all the subfolders' do
|
23
|
+
Quarto::PROJECT_SUBFOLDERS.each do |folder|
|
24
|
+
(@temp_project_path + '/' + folder).should exist_on_disk
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should create a starter generate.rb' do
|
29
|
+
generate_file = @temp_project_path + '/generate.rb'
|
30
|
+
generate_file.should exist_on_disk
|
31
|
+
File.read(generate_file).should == Quarto::STARTER_GENERATE_FILE
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should not raise an error if the user attempts to reinitialize an existing project' do
|
35
|
+
Quarto.init_project(@temp_project_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return true on success' do
|
39
|
+
Quarto.init_project(@temp_project_path).should == true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module FileMatchers
|
2
|
+
class ExistOnDisk
|
3
|
+
def matches?(target)
|
4
|
+
@target = File.expand_path(target)
|
5
|
+
File.exists?(@target)
|
6
|
+
end
|
7
|
+
|
8
|
+
def failure_message
|
9
|
+
"Expected file #{@target} to exist"
|
10
|
+
end
|
11
|
+
|
12
|
+
def negative_failure_message
|
13
|
+
"Expected file #{@target} not to exist"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def exist_on_disk
|
18
|
+
ExistOnDisk.new
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,5 +6,7 @@ SPEC_DIR = File.expand_path(File.dirname(__FILE__))
|
|
6
6
|
SAMPLE_DIR = SPEC_DIR + '/sample_project'
|
7
7
|
|
8
8
|
require(File.expand_path(File.dirname(__FILE__)) + '/../lib/quarto')
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
Dir.glob(SPEC_DIR + '/matchers/*.rb').each do |matcher_lib|
|
11
|
+
require matcher_lib
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jarrett-quarto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarrett Colby
|
@@ -10,13 +10,13 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
|
12
12
|
date: 2009-06-04 00:00:00 -07:00
|
13
|
-
default_executable:
|
13
|
+
default_executable: quarto
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Quarto is a Ruby framework for generating collections of documents from XML. It steps in where XSLT just won't cut it. Potential applications include web sites and e-books. It's built on top of ERB and REXML.
|
17
17
|
email: jarrett@uchicago.edu
|
18
|
-
executables:
|
19
|
-
|
18
|
+
executables:
|
19
|
+
- quarto
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
@@ -53,6 +53,8 @@ test_files:
|
|
53
53
|
- spec/children_spec.rb
|
54
54
|
- spec/element_wrapper_spec.rb
|
55
55
|
- spec/generator_spec.rb
|
56
|
+
- spec/init_project_spec.rb
|
57
|
+
- spec/matchers/file_matchers.rb
|
56
58
|
- spec/sample_project/generate.rb
|
57
59
|
- spec/sample_project/models/company.rb
|
58
60
|
- spec/sample_project/models/employee.rb
|