smartgen 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +7 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -1
- data/README.md +13 -0
- data/lib/smartgen/configuration.rb +2 -2
- data/lib/smartgen/generator.rb +1 -1
- data/lib/smartgen/rake_task.rb +20 -0
- data/lib/smartgen/version.rb +1 -1
- data/spec/lib/smartgen/configuration_spec.rb +4 -4
- data/spec/lib/smartgen/generator_spec.rb +13 -0
- metadata +7 -7
- data/bin/smartgen +0 -25
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smartgen (0.
|
4
|
+
smartgen (0.1.1)
|
5
5
|
RedCloth (>= 4.2.3)
|
6
6
|
activesupport (>= 2.3.5)
|
7
7
|
bluecloth (>= 2.0.9)
|
@@ -21,6 +21,7 @@ GEM
|
|
21
21
|
linecache (0.43)
|
22
22
|
linecache19 (0.5.11)
|
23
23
|
ruby_core_source (>= 0.1.4)
|
24
|
+
rake (0.8.7)
|
24
25
|
rspec (2.3.0)
|
25
26
|
rspec-core (~> 2.3.0)
|
26
27
|
rspec-expectations (~> 2.3.0)
|
@@ -54,6 +55,7 @@ DEPENDENCIES
|
|
54
55
|
activesupport (>= 2.3.5)
|
55
56
|
bluecloth (>= 2.0.9)
|
56
57
|
i18n (>= 0.5.0)
|
58
|
+
rake (= 0.8.7)
|
57
59
|
rspec (>= 2.3.0)
|
58
60
|
ruby-debug
|
59
61
|
ruby-debug19
|
data/README.md
CHANGED
@@ -117,3 +117,16 @@ You may create as many resource configurations as you want. You create a configu
|
|
117
117
|
|
118
118
|
Smartgen[:doc].generate!
|
119
119
|
Smartgen[:some_other_documentation].generate!
|
120
|
+
|
121
|
+
## Rake Task
|
122
|
+
|
123
|
+
You may also use a rake task:
|
124
|
+
|
125
|
+
require 'smartgen/rake_task'
|
126
|
+
|
127
|
+
Smartgen::RakeTask.new :my_doc do |config|
|
128
|
+
config.src_files = ['doc/**/*']
|
129
|
+
config.output_folder = 'public/docs'
|
130
|
+
end
|
131
|
+
|
132
|
+
The yielded config is exactly the same config yielded by Smartgen::Resource#configure method, so you can use any of the above configs.
|
data/lib/smartgen/generator.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/tasklib'
|
5
|
+
require 'smartgen'
|
6
|
+
|
7
|
+
module Smartgen
|
8
|
+
class RakeTask < ::Rake::TaskLib
|
9
|
+
def initialize(name=nil, &block)
|
10
|
+
name = name || :smartgen
|
11
|
+
|
12
|
+
Smartgen[name].configure(&block)
|
13
|
+
|
14
|
+
desc("Generate smartgen files") unless ::Rake.application.last_comment
|
15
|
+
task name do
|
16
|
+
Smartgen[name].generate!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/smartgen/version.rb
CHANGED
@@ -11,8 +11,8 @@ describe Smartgen::Configuration do
|
|
11
11
|
subject.src_files.should be_empty
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should initialize output folder to
|
15
|
-
subject.output_folder.should
|
14
|
+
it "should initialize output folder to nil" do
|
15
|
+
subject.output_folder.should be_nil
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should initialize layout to nil" do
|
@@ -23,8 +23,8 @@ describe Smartgen::Configuration do
|
|
23
23
|
subject.assets.should be_an_empty_array
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should initialize metadata_file to
|
27
|
-
subject.metadata_file.should
|
26
|
+
it "should initialize metadata_file to nil" do
|
27
|
+
subject.metadata_file.should be_nil
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -72,6 +72,19 @@ describe Smartgen::Generator do
|
|
72
72
|
read_output("index.html").should == read_fixture("expectations/common/index.html")
|
73
73
|
end
|
74
74
|
|
75
|
+
context "with nil layout" do
|
76
|
+
def options
|
77
|
+
{ :layout => nil }
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should not use layout" do
|
81
|
+
capture(:stdout) { subject.invoke_all }
|
82
|
+
actual_src_filenames.each do |src_filename, src_ext|
|
83
|
+
read_output("#{src_filename}.html").should == read_fixture("expectations/common/#{src_filename}.html")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
75
88
|
describe "with layout" do
|
76
89
|
def src_files
|
77
90
|
[fixture('src/with_layout/index.textile')]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vicente Mundim
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-25 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -117,8 +117,8 @@ dependencies:
|
|
117
117
|
description: Smartgen generates static HTML files from markup files, using textile or markdown, and ERB to create layout templates
|
118
118
|
email:
|
119
119
|
- vicente.mundim@gmail.com
|
120
|
-
executables:
|
121
|
-
|
120
|
+
executables: []
|
121
|
+
|
122
122
|
extensions: []
|
123
123
|
|
124
124
|
extra_rdoc_files: []
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/smartgen/generator.rb
|
133
133
|
- lib/smartgen/markup_file.rb
|
134
134
|
- lib/smartgen/object_hash.rb
|
135
|
+
- lib/smartgen/rake_task.rb
|
135
136
|
- lib/smartgen/renderers/erb.rb
|
136
137
|
- lib/smartgen/renderers.rb
|
137
138
|
- lib/smartgen/resource.rb
|
@@ -172,7 +173,6 @@ files:
|
|
172
173
|
- spec/lib/smartgen_spec.rb
|
173
174
|
- spec/sandbox/.gitkeep
|
174
175
|
- spec/spec_helper.rb
|
175
|
-
- bin/smartgen
|
176
176
|
has_rdoc: true
|
177
177
|
homepage: ""
|
178
178
|
licenses: []
|
data/bin/smartgen
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'smartgen/autorun'
|
5
|
-
rescue LoadError
|
6
|
-
$stderr.puts <<-EOS
|
7
|
-
#{'*'*50}
|
8
|
-
Could not find 'smartgen/autorun'
|
9
|
-
|
10
|
-
This may happen if you're using rubygems as your package manager, but it is not
|
11
|
-
being required through some mechanism before executing the rspec command.
|
12
|
-
|
13
|
-
You may need to do one of the following in your shell:
|
14
|
-
|
15
|
-
# for bash/zsh
|
16
|
-
export RUBYOPT=rubygems
|
17
|
-
|
18
|
-
# for csh, etc.
|
19
|
-
set RUBYOPT=rubygems
|
20
|
-
|
21
|
-
For background, please see http://gist.github.com/54177.
|
22
|
-
#{'*'*50}
|
23
|
-
EOS
|
24
|
-
exit(1)
|
25
|
-
end
|