frank 0.4.1 → 1.0.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/Gemfile +11 -12
- data/Gemfile.lock +5 -6
- data/README.md +20 -9
- data/autotest/discover.rb +1 -0
- data/bin/frank +1 -114
- data/frank.gemspec +12 -10
- data/lib/frank.rb +4 -1
- data/lib/frank/base.rb +49 -21
- data/lib/frank/cli.rb +152 -0
- data/lib/frank/compile.rb +65 -0
- data/lib/frank/lorem.rb +10 -14
- data/lib/frank/publish.rb +46 -0
- data/lib/frank/settings.rb +40 -0
- data/lib/frank/template_helpers.rb +9 -9
- data/lib/template/setup.rb +17 -0
- data/spec/base_spec.rb +0 -2
- data/spec/{output_spec.rb → compile_spec.rb} +3 -13
- data/spec/publish_spec.rb +23 -0
- data/spec/render_spec.rb +1 -8
- data/spec/template/setup.rb +4 -1
- data/spec/template_helpers_spec.rb +1 -3
- metadata +14 -15
- data/Featurelist +0 -6
- data/bin/frankout +0 -67
- data/bin/frankup +0 -69
- data/lib/frank/output.rb +0 -63
- data/spec/template/dynamic/mustache.mustache +0 -1
data/Gemfile
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
source :gemcutter
|
2
|
-
gem
|
3
|
-
gem
|
4
|
-
gem
|
5
|
-
gem
|
2
|
+
gem 'rack', '>=1.0'
|
3
|
+
gem 'mongrel', '>=1.0'
|
4
|
+
gem 'haml', '>=3.0'
|
5
|
+
gem 'tilt', '=0.9'
|
6
|
+
gem 'net-ssh', '>=2.0'
|
7
|
+
gem 'net-scp', '>=1.0'
|
6
8
|
|
7
9
|
# dev dependencies
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
10
|
+
gem 'jeweler'
|
11
|
+
gem 'rspec', '>=2.0.0.beta.19'
|
12
|
+
gem 'rack-test', '>=0.5'
|
13
|
+
gem 'rake'
|
12
14
|
|
13
15
|
# tilt dev dependencies
|
14
16
|
gem 'contest'
|
15
17
|
gem 'builder'
|
16
18
|
gem 'erubis'
|
17
19
|
gem 'compass', '>= 0.10.2'
|
18
|
-
gem 'mustache'
|
19
20
|
gem 'rdiscount'
|
20
21
|
gem 'liquid'
|
21
22
|
gem 'less'
|
22
23
|
gem 'coffee-script'
|
23
|
-
gem
|
24
|
-
|
25
|
-
gem "mini_magick"
|
24
|
+
gem 'RedCloth'
|
26
25
|
|
27
26
|
gem 'ruby-debug'
|
data/Gemfile.lock
CHANGED
@@ -29,15 +29,15 @@ GEM
|
|
29
29
|
treetop (>= 1.4.2)
|
30
30
|
linecache (0.43)
|
31
31
|
liquid (2.1.2)
|
32
|
-
mini_magick (1.3.1)
|
33
|
-
subexec (~> 0.0.4)
|
34
32
|
mongrel (1.1.5)
|
35
33
|
cgi_multipart_eof_fix (>= 2.4)
|
36
34
|
daemons (>= 1.0.3)
|
37
35
|
fastthread (>= 1.0.1)
|
38
36
|
gem_plugin (>= 0.2.3)
|
39
|
-
mustache (0.11.2)
|
40
37
|
mutter (0.5.3)
|
38
|
+
net-scp (1.0.1)
|
39
|
+
net-ssh (>= 1.99.1)
|
40
|
+
net-ssh (2.0.23)
|
41
41
|
polyglot (0.3.1)
|
42
42
|
rack (1.2.1)
|
43
43
|
rack-test (0.5.4)
|
@@ -59,7 +59,6 @@ GEM
|
|
59
59
|
linecache (>= 0.3)
|
60
60
|
rubyforge (2.0.4)
|
61
61
|
json_pure (>= 1.1.7)
|
62
|
-
subexec (0.0.4)
|
63
62
|
tilt (0.9)
|
64
63
|
treetop (1.4.8)
|
65
64
|
polyglot (>= 0.3.1)
|
@@ -78,9 +77,9 @@ DEPENDENCIES
|
|
78
77
|
jeweler
|
79
78
|
less
|
80
79
|
liquid
|
81
|
-
mini_magick
|
82
80
|
mongrel (>= 1.0)
|
83
|
-
|
81
|
+
net-scp (>= 1.0)
|
82
|
+
net-ssh (>= 2.0)
|
84
83
|
rack (>= 1.0)
|
85
84
|
rack-test (>= 0.5)
|
86
85
|
rake
|
data/README.md
CHANGED
@@ -3,12 +3,13 @@ Frank
|
|
3
3
|
|
4
4
|
Inspired by [Sinatra][0]'s simplicity and ease of use, Frank lets you build
|
5
5
|
static sites using your favorite libs. Frank has a built in development server
|
6
|
-
for previewing work as you develop
|
7
|
-
your work out to static html and css
|
6
|
+
for previewing work as you develop, an "export" command for compiling and saving
|
7
|
+
your work out to static html and css, and a publish command for copying your
|
8
|
+
exported pages to a server.
|
8
9
|
|
9
10
|
Frank uses [Tilt][1], so it
|
10
|
-
comes with support for [Haml & Sass][2], [LESS][10], [Builder][3], [ERB][4],
|
11
|
-
[Liquid][5]
|
11
|
+
comes with support for [Haml & Sass][2], [LESS][10], [Builder][3], [ERB][4], and
|
12
|
+
[Liquid][5].
|
12
13
|
|
13
14
|
Overview
|
14
15
|
--------
|
@@ -38,11 +39,23 @@ to compile templates and copy them--along with static your assets--into `<export
|
|
38
39
|
|
39
40
|
to compile & copy over, but organized to work as a static website in production. (e.g. folders named after your views, with an `index.html` inside)
|
40
41
|
|
41
|
-
|
42
|
+
You can add publish settings in setup.rb and publish directly to a server via scp.
|
43
|
+
|
44
|
+
$ frank publish
|
45
|
+
|
46
|
+
Upgrading
|
42
47
|
-------------------------
|
43
48
|
|
44
49
|
As of version 0.4, Frank no longer uses settings.yml. However you can use `frank upgrade` in order convert your old settings.yml to the new setup.rb format.
|
45
50
|
|
51
|
+
|
52
|
+
Frank Templates
|
53
|
+
-------------------------
|
54
|
+
|
55
|
+
Frank (as of 1.0) has support for saving "templates" in `~/.frank_templates`. This is very handy if find yourself wanting a custom starting point. All you have to do to use the feature is create a `~/.frank_templates` folder and start putting templates in it.
|
56
|
+
|
57
|
+
Once you have a few templates saved you can simply run `frank new` to be presented with a list of templates to choose from as the starting point for the project.
|
58
|
+
|
46
59
|
Views & Meta Data
|
47
60
|
-------------------------
|
48
61
|
|
@@ -146,7 +159,7 @@ Built-in Helpers
|
|
146
159
|
|
147
160
|
### Auto-Refresh
|
148
161
|
|
149
|
-
Frank
|
162
|
+
Frank has a handy automatic page refreshing helper. Just include `= refresh`
|
150
163
|
(or equivalent) in your view, and Frank will automatically refresh the page for you whenever you
|
151
164
|
save a project file. This eliminates the tedium of hundreds of manual refreshes over the course
|
152
165
|
of building a project.
|
@@ -190,6 +203,7 @@ Frank now uses [placehold.it][14] for placeholder images, the `lorem.image` help
|
|
190
203
|
### Replacement Text
|
191
204
|
|
192
205
|
All of the lorem helpers accept an optional "replacement" argument. This will be the text rendered when you `frank export`.
|
206
|
+
|
193
207
|
For example `lorem.sentence("<%= page.content %>")` will generate a lorem sentence when you view the page using the `frank server` for development.
|
194
208
|
However, when you `frank export` the template will render "<%= page.content %>". This is useful if you plan on moving a frank project
|
195
209
|
into a framework. (e.g. rails, sinatra, django, etc)
|
@@ -204,8 +218,6 @@ Check the comments there if you need help.
|
|
204
218
|
Installation
|
205
219
|
------------
|
206
220
|
|
207
|
-
### [Gemcutter](http://gemcutter.org/)
|
208
|
-
|
209
221
|
$ gem install frank
|
210
222
|
|
211
223
|
|
@@ -215,7 +227,6 @@ Installation
|
|
215
227
|
[3]: http://builder.rubyforge.org/
|
216
228
|
[4]: http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/
|
217
229
|
[5]: http://www.liquidmarkup.org/
|
218
|
-
[6]: http://github.com/defunkt/mustache
|
219
230
|
[8]: http://lesscss.org/
|
220
231
|
[9]: http://rack.rubyforge.org/
|
221
232
|
[10]: http://lesscss.org/
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { 'rspec2' }
|
data/bin/frank
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
3
3
|
|
4
4
|
require 'frank'
|
5
|
-
require 'optparse'
|
6
5
|
|
7
6
|
begin
|
8
7
|
# try to use bundler if its available
|
@@ -18,116 +17,4 @@ rescue LoadError
|
|
18
17
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
banner = <<-USAGE
|
24
|
-
Usage:
|
25
|
-
frank new PROJECT_PATH
|
26
|
-
frank server [options]
|
27
|
-
frank export PATH [options]
|
28
|
-
|
29
|
-
Description:
|
30
|
-
The `frank new' command generates a frank template project with the default
|
31
|
-
directory structure and configuration at the given path.
|
32
|
-
|
33
|
-
Once you have a frank project you can use the `frank server' or the aliased 'frank up' commands
|
34
|
-
to start the development server and begin developing your project.
|
35
|
-
|
36
|
-
When you are finished working and ready to export you can use
|
37
|
-
the `frank export' or aliased `frank out' commands.
|
38
|
-
|
39
|
-
Example:
|
40
|
-
frank new ~/Dev/blah.com
|
41
|
-
cd ~/Dev/blah.com
|
42
|
-
frank server
|
43
|
-
|
44
|
-
# do some development
|
45
|
-
|
46
|
-
frank export ~/Dev/html/blah.com
|
47
|
-
USAGE
|
48
|
-
|
49
|
-
|
50
|
-
opts = OptionParser.new do |opts|
|
51
|
-
opts.banner = banner
|
52
|
-
|
53
|
-
opts.separator ''
|
54
|
-
opts.separator 'Options:'
|
55
|
-
|
56
|
-
opts.on('--server [HANDLER]', 'Set the server handler (frank server)') do |handler|
|
57
|
-
options[:server]['handler'] = handler unless handler.nil?
|
58
|
-
end
|
59
|
-
|
60
|
-
opts.on('--hostname [HOSTNAME]', 'Set the server hostname (frank server)') do |hostname|
|
61
|
-
options[:server]['hostname'] = hostname unless hostname.nil?
|
62
|
-
end
|
63
|
-
|
64
|
-
opts.on('--port [PORT]', 'Set the server port (frank server)') do |port|
|
65
|
-
options[:server]['port'] = port unless port.nil?
|
66
|
-
end
|
67
|
-
|
68
|
-
opts.on('--dynamic_folder [FOLDER]', 'Set the dynamic folder (frank server)') do |folder|
|
69
|
-
options[:dynamic_folder] = folder unless folder.nil?
|
70
|
-
end
|
71
|
-
|
72
|
-
opts.on('--static_folder [FOLDER]', 'Set the static folder (frank server)') do |folder|
|
73
|
-
options[:static_folder] = folder unless folder.nil?
|
74
|
-
end
|
75
|
-
|
76
|
-
opts.on('--production', 'Production ready export (frank export) i.e. ([FOLDER]/index.html)') do |handler|
|
77
|
-
options[:production] = true
|
78
|
-
end
|
79
|
-
|
80
|
-
opts.on('-v', '--version', 'Show the frank version and exit') do
|
81
|
-
puts "Frank v#{Frank::VERSION}"
|
82
|
-
exit
|
83
|
-
end
|
84
|
-
|
85
|
-
opts.on( '-h', '--help', 'Display this help' ) do
|
86
|
-
puts opts
|
87
|
-
exit
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
opts.parse!
|
92
|
-
|
93
|
-
if ARGV.empty?
|
94
|
-
puts opts
|
95
|
-
exit
|
96
|
-
else
|
97
|
-
if %w[server up export out upgrade s e].include? ARGV.first
|
98
|
-
begin
|
99
|
-
Frank.bootstrap(Dir.pwd)
|
100
|
-
rescue Errno::ENOENT
|
101
|
-
if File.exist? File.join(Dir.pwd, 'helpers.rb')
|
102
|
-
puts "Frank could not find setup.rb, perhaps you need to upgrade with the `frank upgrade' command"
|
103
|
-
else
|
104
|
-
puts "Frank could not find setup.rb"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
case ARGV.first
|
110
|
-
when 'new', 'n'
|
111
|
-
# stub out the project
|
112
|
-
Frank.stub(ARGV[1])
|
113
|
-
when 'server', 's', 'up'
|
114
|
-
# setup server from options
|
115
|
-
server_options = options[:server]
|
116
|
-
Frank.server.handler = server_options['handler'] if server_options['handler']
|
117
|
-
Frank.server.hostname = server_options['hostname'] if server_options['hostname']
|
118
|
-
Frank.server.port = server_options['port'] if server_options['port']
|
119
|
-
|
120
|
-
# setup folder options
|
121
|
-
Frank.dynamic_folder = options[:dynamic_folder] if options[:dynamic_folder]
|
122
|
-
Frank.static_folder = options[:static_folder] if options[:static_folder]
|
123
|
-
Frank.new
|
124
|
-
when 'export', 'e', 'out'
|
125
|
-
Frank.production! if options[:production]
|
126
|
-
Frank::Output.new do
|
127
|
-
set :environment, :output
|
128
|
-
set :output_folder, ARGV[1]
|
129
|
-
end.dump(options[:production])
|
130
|
-
when 'upgrade'
|
131
|
-
Frank.upgrade!
|
132
|
-
end
|
133
|
-
end
|
20
|
+
Frank::CLI.run
|
data/frank.gemspec
CHANGED
@@ -5,37 +5,38 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{frank}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["blahed", "nwah"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-08}
|
13
|
+
s.default_executable = %q{frank}
|
13
14
|
s.description = %q{Rapidly develop static sites using any supported templating language}
|
14
15
|
s.email = %q{travis.dunn@thisismedium.com}
|
15
|
-
s.executables = ["frank"
|
16
|
+
s.executables = ["frank"]
|
16
17
|
s.extra_rdoc_files = [
|
17
18
|
"LICENSE",
|
18
19
|
"README.md"
|
19
20
|
]
|
20
21
|
s.files = [
|
21
22
|
".gitignore",
|
22
|
-
"Featurelist",
|
23
23
|
"Gemfile",
|
24
24
|
"Gemfile.lock",
|
25
25
|
"LICENSE",
|
26
26
|
"README.md",
|
27
27
|
"Rakefile",
|
28
|
+
"autotest/discover.rb",
|
28
29
|
"bin/frank",
|
29
|
-
"bin/frankout",
|
30
|
-
"bin/frankup",
|
31
30
|
"frank.gemspec",
|
32
31
|
"lib/frank.rb",
|
33
32
|
"lib/frank/base.rb",
|
33
|
+
"lib/frank/cli.rb",
|
34
|
+
"lib/frank/compile.rb",
|
34
35
|
"lib/frank/lorem.rb",
|
35
36
|
"lib/frank/middleware/imager.rb",
|
36
37
|
"lib/frank/middleware/refresh.rb",
|
37
38
|
"lib/frank/middleware/statik.rb",
|
38
|
-
"lib/frank/
|
39
|
+
"lib/frank/publish.rb",
|
39
40
|
"lib/frank/rescue.rb",
|
40
41
|
"lib/frank/settings.rb",
|
41
42
|
"lib/frank/template_helpers.rb",
|
@@ -64,8 +65,9 @@ Gem::Specification.new do |s|
|
|
64
65
|
"lib/template/static/images/frank-med.png",
|
65
66
|
"lib/template/static/js/frank.js",
|
66
67
|
"spec/base_spec.rb",
|
68
|
+
"spec/compile_spec.rb",
|
67
69
|
"spec/helper.rb",
|
68
|
-
"spec/
|
70
|
+
"spec/publish_spec.rb",
|
69
71
|
"spec/render_spec.rb",
|
70
72
|
"spec/template/dynamic/500.haml",
|
71
73
|
"spec/template/dynamic/_partial.haml",
|
@@ -79,7 +81,6 @@ Gem::Specification.new do |s|
|
|
79
81
|
"spec/template/dynamic/lorem_test.haml",
|
80
82
|
"spec/template/dynamic/markdown.md",
|
81
83
|
"spec/template/dynamic/markdown_in_haml.md",
|
82
|
-
"spec/template/dynamic/mustache.mustache",
|
83
84
|
"spec/template/dynamic/nested/child.haml",
|
84
85
|
"spec/template/dynamic/nested/deeper/deep.haml",
|
85
86
|
"spec/template/dynamic/no_layout.haml",
|
@@ -106,8 +107,9 @@ Gem::Specification.new do |s|
|
|
106
107
|
s.summary = %q{Static Site Non-Framework}
|
107
108
|
s.test_files = [
|
108
109
|
"spec/base_spec.rb",
|
110
|
+
"spec/compile_spec.rb",
|
109
111
|
"spec/helper.rb",
|
110
|
-
"spec/
|
112
|
+
"spec/publish_spec.rb",
|
111
113
|
"spec/render_spec.rb",
|
112
114
|
"spec/template/helpers.rb",
|
113
115
|
"spec/template/setup.rb",
|
data/lib/frank.rb
CHANGED
@@ -12,9 +12,12 @@ require 'rubygems'
|
|
12
12
|
require 'yaml'
|
13
13
|
require 'fileutils'
|
14
14
|
require 'rack'
|
15
|
+
require 'net/ssh'
|
15
16
|
require 'frank/settings'
|
16
17
|
require 'frank/base'
|
17
|
-
require 'frank/
|
18
|
+
require 'frank/compile'
|
19
|
+
require 'frank/publish'
|
20
|
+
require 'frank/cli'
|
18
21
|
|
19
22
|
# relay
|
20
23
|
module Frank
|
data/lib/frank/base.rb
CHANGED
@@ -6,7 +6,7 @@ require 'frank/middleware/statik'
|
|
6
6
|
require 'frank/middleware/refresh'
|
7
7
|
|
8
8
|
module Frank
|
9
|
-
VERSION = '0.
|
9
|
+
VERSION = '1.0.0'
|
10
10
|
extend Frank::Upgrades
|
11
11
|
|
12
12
|
module Render; end
|
@@ -17,10 +17,6 @@ module Frank
|
|
17
17
|
include Frank::TemplateHelpers
|
18
18
|
include Frank::Render
|
19
19
|
|
20
|
-
def initialize(&block)
|
21
|
-
instance_eval(&block) if block_given?
|
22
|
-
end
|
23
|
-
|
24
20
|
def call(env)
|
25
21
|
dup.call!(env)
|
26
22
|
end
|
@@ -36,13 +32,6 @@ module Frank
|
|
36
32
|
|
37
33
|
private
|
38
34
|
|
39
|
-
# setter for options
|
40
|
-
def set(option, value)
|
41
|
-
if respond_to?("#{option}=")
|
42
|
-
send "#{option}=", value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
35
|
# attempt to render with the request path,
|
47
36
|
# if it cannot be found, render error page
|
48
37
|
def process
|
@@ -74,11 +63,11 @@ module Frank
|
|
74
63
|
module Render
|
75
64
|
|
76
65
|
TMPL_EXTS = {
|
77
|
-
:html => %w[haml erb rhtml builder liquid
|
66
|
+
:html => %w[haml erb rhtml builder liquid textile md mkd markdown],
|
78
67
|
:css => %w[sass less scss]
|
79
68
|
}
|
80
69
|
|
81
|
-
LAYOUT_EXTS = %w[.haml .erb .rhtml .liquid
|
70
|
+
LAYOUT_EXTS = %w[.haml .erb .rhtml .liquid]
|
82
71
|
|
83
72
|
# render request path or template path
|
84
73
|
def render(path, partial = false, local_vars = nil)
|
@@ -121,11 +110,6 @@ module Frank
|
|
121
110
|
# add layout_path to locals
|
122
111
|
raise Frank::TemplateError, "Layout not found #{layout_path}" unless File.exist? layout_path
|
123
112
|
|
124
|
-
# original
|
125
|
-
# tilt(File.extname(layout), layout_path, locals) do
|
126
|
-
# tilt(ext, template, locals)
|
127
|
-
# end
|
128
|
-
|
129
113
|
page_content = tilt(page, ext, template, locals)
|
130
114
|
tilt(page, File.extname(layout), layout_path, locals) do
|
131
115
|
page_content
|
@@ -267,8 +251,24 @@ module Frank
|
|
267
251
|
|
268
252
|
# try to pull in setup
|
269
253
|
setup = File.join(Frank.root, 'setup.rb')
|
254
|
+
|
270
255
|
if File.exists?(setup)
|
271
256
|
load setup
|
257
|
+
elsif File.exist? File.join(Dir.pwd, 'settings.yml')
|
258
|
+
puts "\033[31mFrank could not find setup.rb, perhaps you need to upgrade with the `frank upgrade\' command \033[0m"
|
259
|
+
exit
|
260
|
+
else
|
261
|
+
puts " \033[31mFrank could not find setup.rb \033[0m"
|
262
|
+
exit
|
263
|
+
end
|
264
|
+
|
265
|
+
if Frank.publish.host || Frank.publish.path || Frank.publish.username || Frank.publish.password
|
266
|
+
begin
|
267
|
+
require 'net/scp'
|
268
|
+
rescue LoadError
|
269
|
+
puts "\033[31m`frank publish' requires the 'net-scp' gem. `gem install net-scp'\033[0m"
|
270
|
+
exit
|
271
|
+
end
|
272
272
|
end
|
273
273
|
|
274
274
|
end
|
@@ -312,11 +312,39 @@ module Frank
|
|
312
312
|
|
313
313
|
# copies over the generic project template
|
314
314
|
def self.stub(project)
|
315
|
+
templates_dir = File.join(ENV['HOME'], '.frank_templates')
|
316
|
+
|
315
317
|
puts "\nFrank is...\n - \033[32mCreating\033[0m your project '#{project}'"
|
318
|
+
|
319
|
+
# if user has a ~/.frank_templates folder
|
320
|
+
# provide an interface for choosing template
|
321
|
+
if File.exist? templates_dir
|
322
|
+
templates = %w[default] + Dir[File.join(templates_dir, '**')].map { |d| d.split('/').last }
|
323
|
+
|
324
|
+
puts "\nWhich template would you like to use? "
|
325
|
+
templates.each_with_index { |t, i| puts " #{i + 1}. #{t}" }
|
326
|
+
|
327
|
+
print '> '
|
328
|
+
|
329
|
+
# get input and wait for a valid response
|
330
|
+
trap(:INT) { puts "\nbye"; exit }
|
331
|
+
choice = STDIN.gets.chomp
|
332
|
+
until ( choice.match(/^\d+$/) && templates[choice.to_i - 1] ) || choice == '1'
|
333
|
+
print " `#{choice}' \033[31mis not a valid template choice\033[0m\n> "
|
334
|
+
choice = STDIN.gets.chomp
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
316
338
|
Dir.mkdir project
|
339
|
+
template = templates[choice.to_i - 1]
|
317
340
|
|
318
|
-
puts " - \033[32mCopying\033[0m Frank template"
|
319
|
-
|
341
|
+
puts " - \033[32mCopying\033[0m #{template} Frank template"
|
342
|
+
|
343
|
+
if template == 'default'
|
344
|
+
FileUtils.cp_r( Dir.glob(File.join(LIBDIR, 'template/*')), project )
|
345
|
+
else
|
346
|
+
FileUtils.cp_r( Dir.glob(File.join(templates_dir, "#{template}/*")), project )
|
347
|
+
end
|
320
348
|
|
321
349
|
puts "\n \033[32mCongratulations, '#{project}' is ready to go!\033[0m"
|
322
350
|
rescue Errno::EEXIST
|