moka 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +20 -0
- data/Manifest +48 -0
- data/README.rdoc +9 -0
- data/Rakefile +17 -0
- data/bin/moka +21 -0
- data/lib/commands.rb +54 -0
- data/lib/commands/compile.rb +77 -0
- data/lib/commands/delete.rb +47 -0
- data/lib/commands/group/delete.rb +59 -0
- data/lib/commands/group/group_generator.rb +115 -0
- data/lib/commands/group/inspect.rb +40 -0
- data/lib/commands/group/new.rb +2 -0
- data/lib/commands/group/template/groupdir/variables.yml +1 -0
- data/lib/commands/inspect.rb +55 -0
- data/lib/commands/lib/compiler.rb +114 -0
- data/lib/commands/lib/helpers.rb +156 -0
- data/lib/commands/lib/lipsum_constants.rb +159 -0
- data/lib/commands/lib/lipsum_helpers.rb +56 -0
- data/lib/commands/lib/page_scope.rb +29 -0
- data/lib/commands/lib/partials_inclusion.rb +42 -0
- data/lib/commands/lib/site_tree.rb +274 -0
- data/lib/commands/lib/string_inflectors.rb +13 -0
- data/lib/commands/lib/utilities.rb +45 -0
- data/lib/commands/new.rb +64 -0
- data/lib/commands/order_groups.rb +115 -0
- data/lib/commands/order_pages.rb +128 -0
- data/lib/commands/page/delete.rb +47 -0
- data/lib/commands/page/inspect.rb +35 -0
- data/lib/commands/page/new.rb +2 -0
- data/lib/commands/page/page_generator.rb +130 -0
- data/lib/commands/page/template/pagedir/variables.yml +1 -0
- data/lib/commands/server.rb +125 -0
- data/lib/commands/site/inspect.rb +28 -0
- data/lib/commands/site/new.rb +10 -0
- data/lib/commands/site/site_generator.rb +93 -0
- data/lib/commands/site/template/manifest.yml +4 -0
- data/lib/commands/site/template/project/lib/helpers.rb +1 -0
- data/lib/commands/site/template/project/site/content.erb +14 -0
- data/lib/commands/site/template/project/site/header.erb +7 -0
- data/lib/commands/site/template/project/site/layout.erb +20 -0
- data/lib/commands/site/template/project/site/navigation.erb +7 -0
- data/lib/commands/site/template/project/site/variables.yml +1 -0
- data/lib/commands/site/template/project/styles/style.sass +74 -0
- data/lib/commands/site/template/script/config/boot.rb +5 -0
- data/lib/commands/site/template/script/moka +4 -0
- data/lib/script_moka_loader.rb +14 -0
- data/lib/version.rb +10 -0
- data/moka.gemspec +39 -0
- metadata +182 -0
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Luca Ongaro
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
LICENSE.txt
|
2
|
+
Manifest
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
bin/moka
|
6
|
+
lib/commands.rb
|
7
|
+
lib/commands/compile.rb
|
8
|
+
lib/commands/delete.rb
|
9
|
+
lib/commands/group/delete.rb
|
10
|
+
lib/commands/group/group_generator.rb
|
11
|
+
lib/commands/group/inspect.rb
|
12
|
+
lib/commands/group/new.rb
|
13
|
+
lib/commands/group/template/groupdir/variables.yml
|
14
|
+
lib/commands/inspect.rb
|
15
|
+
lib/commands/lib/compiler.rb
|
16
|
+
lib/commands/lib/helpers.rb
|
17
|
+
lib/commands/lib/lipsum_constants.rb
|
18
|
+
lib/commands/lib/lipsum_helpers.rb
|
19
|
+
lib/commands/lib/page_scope.rb
|
20
|
+
lib/commands/lib/partials_inclusion.rb
|
21
|
+
lib/commands/lib/site_tree.rb
|
22
|
+
lib/commands/lib/string_inflectors.rb
|
23
|
+
lib/commands/lib/utilities.rb
|
24
|
+
lib/commands/new.rb
|
25
|
+
lib/commands/order_groups.rb
|
26
|
+
lib/commands/order_pages.rb
|
27
|
+
lib/commands/page/delete.rb
|
28
|
+
lib/commands/page/inspect.rb
|
29
|
+
lib/commands/page/new.rb
|
30
|
+
lib/commands/page/page_generator.rb
|
31
|
+
lib/commands/page/template/pagedir/variables.yml
|
32
|
+
lib/commands/server.rb
|
33
|
+
lib/commands/site/inspect.rb
|
34
|
+
lib/commands/site/new.rb
|
35
|
+
lib/commands/site/site_generator.rb
|
36
|
+
lib/commands/site/template/manifest.yml
|
37
|
+
lib/commands/site/template/project/lib/helpers.rb
|
38
|
+
lib/commands/site/template/project/site/content.erb
|
39
|
+
lib/commands/site/template/project/site/header.erb
|
40
|
+
lib/commands/site/template/project/site/layout.erb
|
41
|
+
lib/commands/site/template/project/site/navigation.erb
|
42
|
+
lib/commands/site/template/project/site/variables.yml
|
43
|
+
lib/commands/site/template/project/styles/style.sass
|
44
|
+
lib/commands/site/template/script/config/boot.rb
|
45
|
+
lib/commands/site/template/script/moka
|
46
|
+
lib/script_moka_loader.rb
|
47
|
+
lib/version.rb
|
48
|
+
moka.gemspec
|
data/README.rdoc
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== Welcome to Moka
|
2
|
+
|
3
|
+
Moka is a damn simple framework designed to build static websites like portfolios, showcases, minisites, HTML mockups, etc. Moka setup takes a single command, and it provides a hierarchical template system and some hyper-convenient helper functions so you never have to write more code than necessary. The result of your work is compiled to plain HTML, CSS and Javascript, so you just have to upload it to your server. Plus, don't forget the Lipsum helper functions to generate dummy text with a single line of code during development or in HTML mockups.
|
4
|
+
|
5
|
+
A taste of Moka coolness:
|
6
|
+
- Don't Repeat Yourself
|
7
|
+
- Convention Over Configuration
|
8
|
+
- Start your creative work from instant zero!
|
9
|
+
- Minimum overhead efforts (configuration, setup, learning, etc.)
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('moka', '0.1.1') do |p|
|
6
|
+
p.summary = "An damn simple static website framework."
|
7
|
+
p.description = "Moka is a damn simple framework designed to build static websites like portfolios, showcases, minisites, HTML mockups, etc. Moka setup takes a single command, and it provides a hierarchical template system and some hyper-convenient helper functions so you never have to write more code than necessary. The result of your work is compiled to plain HTML, CSS and Javascript, so you just have to upload it to your server. Plus, don't forget the Lipsum helper functions to generate dummy text with a single line of code during development or in HTML mockups."
|
8
|
+
p.url = "https://github.com/DukeLeNoir/Moka"
|
9
|
+
p.author = "Luca Ongaro"
|
10
|
+
p.email = "mail@lucaongaro.eu"
|
11
|
+
p.install_message= "Welcome aboard Moka. You'll love it!"
|
12
|
+
p.ignore_pattern = ["TODOs"]
|
13
|
+
p.runtime_dependencies = ["thor", "haml"]
|
14
|
+
p.development_dependencies = []
|
15
|
+
end
|
16
|
+
|
17
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/bin/moka
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "script_moka_loader"
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Moka::ScriptMokaLoader.exec_script_moka!
|
7
|
+
|
8
|
+
# If called from within a moka app the following code isn't executed
|
9
|
+
|
10
|
+
if %w(-v --version).include? ARGV.first
|
11
|
+
puts "Moka #{Moka::VERSION::STRING}"
|
12
|
+
exit(0)
|
13
|
+
end
|
14
|
+
|
15
|
+
if ARGV.first != "new" and ARGV.first != "n"
|
16
|
+
ARGV[0] = "--help"
|
17
|
+
else
|
18
|
+
ARGV.shift
|
19
|
+
end
|
20
|
+
|
21
|
+
require "commands/new"
|
data/lib/commands.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
ARGV << '--help' if ARGV.empty?
|
2
|
+
|
3
|
+
aliases = {
|
4
|
+
"n" => "new",
|
5
|
+
"i" => "inspect",
|
6
|
+
"d" => "delete",
|
7
|
+
"s" => "server",
|
8
|
+
"op" => "order_pages",
|
9
|
+
"og" => "order_groups",
|
10
|
+
"c" => "compile"
|
11
|
+
}
|
12
|
+
|
13
|
+
command = ARGV.shift
|
14
|
+
command = aliases[command] || command
|
15
|
+
|
16
|
+
case command
|
17
|
+
when 'new'
|
18
|
+
require "commands/new"
|
19
|
+
|
20
|
+
when 'inspect'
|
21
|
+
require 'commands/inspect'
|
22
|
+
|
23
|
+
when 'delete'
|
24
|
+
require "commands/delete"
|
25
|
+
|
26
|
+
when 'order_groups'
|
27
|
+
require "commands/order_groups"
|
28
|
+
|
29
|
+
when 'order_pages'
|
30
|
+
require "commands/order_pages"
|
31
|
+
|
32
|
+
when 'server'
|
33
|
+
require 'commands/server'
|
34
|
+
|
35
|
+
when 'compile'
|
36
|
+
require 'commands/compile'
|
37
|
+
|
38
|
+
else
|
39
|
+
puts "Error: Command not recognized" unless %w(-h --help).include?(command)
|
40
|
+
puts <<-EOT
|
41
|
+
Usage: moka COMMAND [ARGS]
|
42
|
+
|
43
|
+
The most common moka commands are:
|
44
|
+
new Generate a new site, page or group (short-cut alias: "n")
|
45
|
+
inspect Inspect site, a group or a page (short-cut alias: "i")
|
46
|
+
delete Delete a group or page (short-cut alias "d")
|
47
|
+
compile Compile the project into html and css (short-cut alias "c")
|
48
|
+
server Start a development server (short-cut alias "s")
|
49
|
+
order_pages Start a utility to change pages ordering (short-cut alias "op")
|
50
|
+
order_groups Start a utility to change groups ordering (short-cut alias "og")
|
51
|
+
|
52
|
+
All commands can be run with -h for more information.
|
53
|
+
EOT
|
54
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "fileutils"
|
5
|
+
require 'getoptlong'
|
6
|
+
require File.expand_path('lib/utilities', File.dirname(__FILE__))
|
7
|
+
require File.expand_path('lib/compiler', File.dirname(__FILE__))
|
8
|
+
|
9
|
+
opts = GetoptLong.new(
|
10
|
+
[ '--help', '-h', GetoptLong::NO_ARGUMENT ]
|
11
|
+
)
|
12
|
+
|
13
|
+
opts.each do |opt, arg|
|
14
|
+
case opt
|
15
|
+
when '--help'
|
16
|
+
puts <<-EOT
|
17
|
+
|
18
|
+
Usage:
|
19
|
+
|
20
|
+
moka compile [page1] [page2] ...
|
21
|
+
|
22
|
+
Examples:
|
23
|
+
moka compile index about othergroup:contacts
|
24
|
+
compile pages 'index' and 'about' belonging to group 'root' and page 'contacts' belonging to group 'othergroup'
|
25
|
+
|
26
|
+
moka compile
|
27
|
+
compile all pages
|
28
|
+
EOT
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
compiler = Moka::Compiler.new
|
34
|
+
|
35
|
+
manifest = YAML.load_file(File.expand_path("manifest.yml", MOKA_ROOT))
|
36
|
+
|
37
|
+
puts ""
|
38
|
+
|
39
|
+
if ARGV.size < 1
|
40
|
+
# compile all pages
|
41
|
+
manifest["site"].each do |group, pages|
|
42
|
+
if pages.is_a? Hash
|
43
|
+
pages.each do |page, page_vars|
|
44
|
+
if page_vars.is_a? Hash
|
45
|
+
compiler.compile! group, page, manifest
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
else
|
51
|
+
# compile only pages passed as command line arguments
|
52
|
+
to_compile = {}
|
53
|
+
|
54
|
+
ARGV.each do |arg|
|
55
|
+
# parse arg to support syntax groupname:pagename
|
56
|
+
tc_page_name, tc_group = Moka::Utilities.parse_grouppage(arg)
|
57
|
+
if to_compile[tc_group].nil?
|
58
|
+
to_compile[tc_group] = [tc_page_name]
|
59
|
+
else
|
60
|
+
to_compile[tc_group] << tc_page_name
|
61
|
+
end
|
62
|
+
end
|
63
|
+
# compile each page to be compiled
|
64
|
+
to_compile.each do |group, pages|
|
65
|
+
pages.each do |page|
|
66
|
+
unless manifest["site"][group].nil? or manifest["site"][group][page].nil?
|
67
|
+
compiler.compile! group, page, manifest
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# compile sass stylesheets
|
74
|
+
puts ""
|
75
|
+
puts "compiling stylesheets..."
|
76
|
+
compiler.compile_styles!
|
77
|
+
puts ""
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'getoptlong'
|
4
|
+
|
5
|
+
opts = GetoptLong.new(
|
6
|
+
[ '--help', '-h', GetoptLong::NO_ARGUMENT ]
|
7
|
+
)
|
8
|
+
|
9
|
+
opts.each do |opt, arg|
|
10
|
+
case opt
|
11
|
+
when '--help'
|
12
|
+
puts <<-EOT
|
13
|
+
|
14
|
+
Usage:
|
15
|
+
|
16
|
+
moka delete page group_name:page_name
|
17
|
+
|
18
|
+
or
|
19
|
+
|
20
|
+
moka delete group group_name
|
21
|
+
|
22
|
+
Examples:
|
23
|
+
|
24
|
+
moka delete page mypage
|
25
|
+
delete page 'mypage' in group 'root' also eliminating, if existing, the compiled version in the compiled directory
|
26
|
+
|
27
|
+
moka delete page mygroup:mypage
|
28
|
+
delete page 'mypage' in group 'mygroup'
|
29
|
+
|
30
|
+
moka delete group mygroup
|
31
|
+
delete group 'mygroup' and all its pages
|
32
|
+
EOT
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
thing_to_be_deleted = ARGV.shift
|
38
|
+
|
39
|
+
case thing_to_be_deleted
|
40
|
+
when 'page', 'p'
|
41
|
+
require File.expand_path('page/delete', File.dirname(__FILE__))
|
42
|
+
when 'group', 'g'
|
43
|
+
require File.expand_path('group/delete', File.dirname(__FILE__))
|
44
|
+
else
|
45
|
+
puts "ERROR: invalid option #{thing_to_be_deleted}. Valid options are 'page' and 'group'."
|
46
|
+
exit
|
47
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "fileutils"
|
3
|
+
require File.expand_path('../lib/utilities', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
opts = GetoptLong.new(
|
6
|
+
[ '--help', '-h', GetoptLong::NO_ARGUMENT ]
|
7
|
+
)
|
8
|
+
|
9
|
+
opts.each do |opt, arg|
|
10
|
+
case opt
|
11
|
+
when '--help'
|
12
|
+
RDoc::usage
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if ARGV.first.nil?
|
17
|
+
puts "you need to specify a group name."
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
group = ARGV.first
|
22
|
+
|
23
|
+
paths = []
|
24
|
+
manifest = YAML.load_file(File.expand_path("manifest.yml", MOKA_ROOT))
|
25
|
+
|
26
|
+
unless manifest["site"][group].nil?
|
27
|
+
unless manifest["site"][group].is_a? Hash
|
28
|
+
puts "ERROR: '#{group}' is a variable, not a group"
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
manifest["site"][group].each do |page, page_vars|
|
32
|
+
if page_vars.is_a? Hash
|
33
|
+
paths << page_vars["path"] unless page_vars["path"].nil?
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
puts "ERROR: cannot find any group named '#{group}'"
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
manifest["site"].delete group
|
42
|
+
|
43
|
+
f = File.open( File.expand_path('manifest.yml', MOKA_ROOT), 'w' ) do |out|
|
44
|
+
YAML.dump( manifest, out )
|
45
|
+
end
|
46
|
+
|
47
|
+
FileUtils.rm_r(File.expand_path("project/site/#{group}", MOKA_ROOT))
|
48
|
+
paths.each do |path|
|
49
|
+
if File.exists? File.expand_path("compiled/"+path, MOKA_ROOT)
|
50
|
+
FileUtils.rm(File.expand_path("compiled/"+path, MOKA_ROOT))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if File.exists? File.expand_path("compiled/#{group}", MOKA_ROOT)
|
54
|
+
FileUtils.rm_r(File.expand_path("compiled/#{group}", MOKA_ROOT))
|
55
|
+
end
|
56
|
+
|
57
|
+
puts ""
|
58
|
+
puts "Removed group '#{group}' and all its pages"
|
59
|
+
puts ""
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "thor"
|
3
|
+
require "thor/group"
|
4
|
+
|
5
|
+
module Moka
|
6
|
+
module Generators
|
7
|
+
class MokaGroupGenerator < Thor::Group
|
8
|
+
require "yaml"
|
9
|
+
require File.expand_path('../lib/utilities', File.dirname(__FILE__))
|
10
|
+
require File.expand_path('../lib/site_tree', File.dirname(__FILE__))
|
11
|
+
|
12
|
+
include Thor::Actions
|
13
|
+
include Moka::SiteTree
|
14
|
+
|
15
|
+
argument :name
|
16
|
+
class_option :template, :type => :string, :aliases => "-t"
|
17
|
+
class_option :vars, :aliases => %w(-v), :type => :hash
|
18
|
+
|
19
|
+
def self.source_root
|
20
|
+
File.expand_path('template/', File.dirname(__FILE__))
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_manifest
|
24
|
+
@manifest = YAML.load_file(File.expand_path("manifest.yml", MOKA_ROOT))
|
25
|
+
@site = SiteNode.new("site", @manifest["site"])
|
26
|
+
end
|
27
|
+
|
28
|
+
def verify_if_group_exists
|
29
|
+
@group = name
|
30
|
+
unless @site.find_group(@group).nil?
|
31
|
+
say_status "ERROR:", "group '#{@group}' already exists!", :red
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def update_manifest
|
37
|
+
unless options[:template].nil?
|
38
|
+
@template_group = options[:template]
|
39
|
+
if @site.find_group(@template_group).nil?
|
40
|
+
say_status "ERROR:", "cannot find group '#{@template_group}'", :red
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
template_manifest = Moka::Utilities.deepcopy(@manifest["site"][@template_group])
|
44
|
+
@site.find_group(@template_group).pages.each do |page|
|
45
|
+
template_manifest[page.name]["path"] = File.join "#{@group}", "#{page.name}.#{@site.respond_to?(:default_extension) ? @site.default_extension : "html"}"
|
46
|
+
end
|
47
|
+
else
|
48
|
+
template_manifest = {}
|
49
|
+
end
|
50
|
+
@group_params = {"order" => Time.new.utc.to_i}
|
51
|
+
@manifest["site"][@group] = template_manifest.merge @group_params
|
52
|
+
# dump manifest
|
53
|
+
f = File.open( File.expand_path('manifest.yml', MOKA_ROOT), 'w' ) do |out|
|
54
|
+
YAML.dump( @manifest, out )
|
55
|
+
end
|
56
|
+
say_status "update", "manifest.yml", :green
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_group_dir_and_files
|
60
|
+
unless options[:template].nil?
|
61
|
+
directory(File.expand_path("project/site/#{@template_group}", MOKA_ROOT), File.expand_path("project/site/#{@group}", MOKA_ROOT))
|
62
|
+
else
|
63
|
+
directory("groupdir", File.expand_path("project/site/#{@group}", MOKA_ROOT))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def delete_variables_using_reserved_name
|
68
|
+
unless options[:vars].nil?
|
69
|
+
options[:vars].each do |var_name, var_value|
|
70
|
+
if Moka::SiteTree::RESERVED_NAMES.include? var_name.to_s
|
71
|
+
say_status "WARNING:", "variable '#{var_name}' is a reserved word, and will not be set as a variable", :yellow
|
72
|
+
end
|
73
|
+
end
|
74
|
+
options[:vars].delete_if {|var_name, var_value| Moka::SiteTree::RESERVED_NAMES.include? var_name.to_s }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def dump_variables
|
79
|
+
if File.exists? File.expand_path("project/site/#{@group}/variables.yml", MOKA_ROOT)
|
80
|
+
@group_variables = YAML.load_file(File.expand_path("project/site/#{@group}/variables.yml", MOKA_ROOT))
|
81
|
+
else
|
82
|
+
@group_variables = {}
|
83
|
+
end
|
84
|
+
unless options[:vars].nil?
|
85
|
+
@group_variables.merge! options[:vars]
|
86
|
+
f = File.open( File.expand_path("project/site/#{@group}/variables.yml", MOKA_ROOT), 'w' ) do |out|
|
87
|
+
YAML.dump( @group_variables, out )
|
88
|
+
end
|
89
|
+
say_status "update", "project/site/#{@group}/variables.yml", :green
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def notify_about_creation
|
94
|
+
say ""
|
95
|
+
if options[:template].nil?
|
96
|
+
say "Generated group #{@group}"
|
97
|
+
else
|
98
|
+
say "Generated group #{@group} using group #{@template_group} as a template"
|
99
|
+
end
|
100
|
+
say ""
|
101
|
+
say " Group Parameters:"
|
102
|
+
@group_params.each do |param_name, param_value|
|
103
|
+
say " #{param_name} = #{param_value}"
|
104
|
+
end
|
105
|
+
|
106
|
+
say ""
|
107
|
+
say " Group Variables:"
|
108
|
+
@group_variables.each do |var_name, var_value|
|
109
|
+
puts " #{var_name} = #{var_value}"
|
110
|
+
end
|
111
|
+
say ""
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|