ascii_binder 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -0
- data/ascii_binder.gemspec +5 -3
- data/bin/asciibinder +53 -44
- data/features/command_help.feature +8 -0
- data/features/command_version.feature +8 -0
- data/features/repo_build.feature +34 -0
- data/features/repo_clean.feature +20 -0
- data/features/repo_clone.feature +22 -0
- data/features/repo_create.feature +13 -0
- data/features/repo_package.feature +15 -0
- data/features/step_definitions/steps.rb +182 -0
- data/features/support/_clone_distro_map.yml +14 -0
- data/features/support/_invalid_distro_map.yml +14 -0
- data/features/support/env.rb +468 -0
- data/features/support/test_distro/.gitignore +9 -0
- data/features/support/test_distro/_distro_map.yml +29 -0
- data/features/support/test_distro/_images/asciibinder-logo-horizontal.png +0 -0
- data/features/support/test_distro/_images/asciibinder_web_logo.svg +125 -0
- data/features/support/test_distro/_images/book_pages_bg.jpg +0 -0
- data/features/support/test_distro/_images/favicon.ico +0 -0
- data/features/support/test_distro/_images/favicon32x32.png +0 -0
- data/features/support/test_distro/_javascripts/.gitkeep +0 -0
- data/features/support/test_distro/_stylesheets/asciibinder.css +568 -0
- data/features/support/test_distro/_templates/_css.html.erb +3 -0
- data/features/support/test_distro/_templates/_nav.html.erb +31 -0
- data/features/support/test_distro/_templates/page.html.erb +92 -0
- data/features/support/test_distro/_topic_map.yml +36 -0
- data/features/support/test_distro/index-main.html +10 -0
- data/features/support/test_distro/index-test.html +10 -0
- data/features/support/test_distro/main_only_topic_group/index.adoc +17 -0
- data/features/support/test_distro/test_only_topic_group/index.adoc +17 -0
- data/features/support/test_distro/welcome/index.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/index.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/main_only_topic.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/test_only_topic.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/wildcard_all.adoc +17 -0
- data/lib/ascii_binder.rb +4 -2
- data/lib/ascii_binder/distro.rb +111 -0
- data/lib/ascii_binder/distro_branch.rb +93 -0
- data/lib/ascii_binder/distro_map.rb +67 -0
- data/lib/ascii_binder/engine.rb +581 -0
- data/lib/ascii_binder/helpers.rb +42 -856
- data/lib/ascii_binder/site.rb +52 -0
- data/lib/ascii_binder/site_info.rb +22 -0
- data/lib/ascii_binder/site_map.rb +24 -0
- data/lib/ascii_binder/topic_entity.rb +255 -0
- data/lib/ascii_binder/topic_map.rb +61 -0
- data/lib/ascii_binder/version.rb +1 -1
- data/templates/_templates/page.html.erb +1 -1
- metadata +118 -14
@@ -0,0 +1,31 @@
|
|
1
|
+
<ul class="nav nav-sidebar">
|
2
|
+
<%- navigation.each.with_index do |topic_group, groupidx| -%>
|
3
|
+
<%- current_group = topic_group[:id] == group_id -%>
|
4
|
+
<li class="nav-header">
|
5
|
+
<a class="" href="#" data-toggle="collapse" data-target="#topicGroup<%= groupidx %>">
|
6
|
+
<span id="tgSpan<%= groupidx %>" class="fa <%= current_group ? 'fa-angle-down' : 'fa-angle-right' %>"></span><%= topic_group[:name] %>
|
7
|
+
</a>
|
8
|
+
<ul id="topicGroup<%= groupidx %>" class="collapse <%= current_group ? 'in' : '' %> list-unstyled">
|
9
|
+
<%- topic_group[:topics].each.with_index do |topic, topicidx| -%>
|
10
|
+
<%- if not topic.has_key?(:topics) -%>
|
11
|
+
<%- current_topic = current_group && (topic[:id] == topic_id) -%>
|
12
|
+
<li><a class="<%= current_topic ? ' active' : '' %>" href="<%= subtopic_shim %><%= topic[:path] %>"><%= topic[:name] %></a></li>
|
13
|
+
<%- else -%>
|
14
|
+
<%- current_subgroup = topic[:id] == subgroup_id -%>
|
15
|
+
<li class="nav-header">
|
16
|
+
<a class="" href="#" data-toggle="collapse" data-target="#topicSubGroup-<%= groupidx %>-<%= topicidx %>">
|
17
|
+
<span id="sgSpan-<%= groupidx %>-<%= topicidx %>" class="fa <%= current_subgroup ? 'fa-caret-down' : 'fa-caret-right' %>"></span> <%= topic[:name] %>
|
18
|
+
</a>
|
19
|
+
<ul id="topicSubGroup-<%= groupidx %>-<%= topicidx %>" class="nav-tertiary list-unstyled collapse<%= current_subgroup ? ' in' : '' %>">
|
20
|
+
<%- topic[:topics].each do |subtopic| -%>
|
21
|
+
<%- current_subtopic = current_group && current_subgroup && (subtopic[:id] == topic_id) %>
|
22
|
+
<li><a class="<%= current_subtopic ? ' active' : '' %>" href="<%= subtopic_shim %><%= subtopic[:path] %>"><%= subtopic[:name] %></a></li>
|
23
|
+
<%- end -%>
|
24
|
+
</ul>
|
25
|
+
</li>
|
26
|
+
<%- end -%>
|
27
|
+
<%- end -%>
|
28
|
+
</ul>
|
29
|
+
</li>
|
30
|
+
<%- end -%>
|
31
|
+
</ul>
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
6
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
7
|
+
<title><%= distro %> <%= version %> | <%= [group_title, subgroup_title, topic_title].compact.join(' | ') %></title>
|
8
|
+
|
9
|
+
<!-- Bootstrap -->
|
10
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
11
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
|
12
|
+
|
13
|
+
<%= render("_templates/_css.html.erb", :css_path => css_path) %>
|
14
|
+
|
15
|
+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
16
|
+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
17
|
+
<!--[if lt IE 9]>
|
18
|
+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
19
|
+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
20
|
+
<![endif]-->
|
21
|
+
|
22
|
+
<link href="<%= File.join(images_path, "favicon32x32.png") %>" rel="shortcut icon" type="text/css">
|
23
|
+
<!--[if IE]><link rel="shortcut icon" href="<%= File.join(images_path, "favicon.ico") %>"><![endif]-->
|
24
|
+
<meta content="AsciiBinder" name="application-name">
|
25
|
+
</head>
|
26
|
+
<body>
|
27
|
+
<div class="navbar navbar-default" role="navigation">
|
28
|
+
<div class="container-fluid">
|
29
|
+
<div class="navbar-header">
|
30
|
+
<a class="navbar-brand" href="http://www.asciibinder.org/"><img alt="AsciiBinder" src="<%= File.join(images_path, "asciibinder-logo-horizontal.png") %>"></a>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<div class="container">
|
35
|
+
<p class="toggle-nav visible-xs pull-left">
|
36
|
+
<button class="btn btn-default btn-sm" type="button" data-toggle="offcanvas">Toggle nav</button>
|
37
|
+
</p>
|
38
|
+
<ol class="breadcrumb">
|
39
|
+
<li class="sitename">
|
40
|
+
<a href="<%= site_home_path %>"><%= site_name %></a>
|
41
|
+
</li>
|
42
|
+
<li class="hidden-xs active">
|
43
|
+
<%= breadcrumb_root %>
|
44
|
+
</li>
|
45
|
+
<li class="hidden-xs active">
|
46
|
+
<%= breadcrumb_group %>
|
47
|
+
</li>
|
48
|
+
<%= breadcrumb_subgroup_block %>
|
49
|
+
<li class="hidden-xs active">
|
50
|
+
<%= breadcrumb_topic %>
|
51
|
+
</li>
|
52
|
+
</ol>
|
53
|
+
<div class="row row-offcanvas row-offcanvas-left">
|
54
|
+
<div class="col-xs-8 col-sm-3 col-md-3 sidebar sidebar-offcanvas">
|
55
|
+
<%= render("_templates/_nav.html.erb", :navigation => navigation, :group_id => group_id, :topic_id => topic_id, :subgroup_id => subgroup_id, :subtopic_shim => subtopic_shim) %>
|
56
|
+
</div>
|
57
|
+
<div class="col-xs-12 col-sm-9 col-md-9 main">
|
58
|
+
<div class="page-header">
|
59
|
+
<h2><%= article_title %></h2>
|
60
|
+
</div>
|
61
|
+
<%= content %>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
66
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
67
|
+
<!-- Latest compiled and minified JavaScript -->
|
68
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
69
|
+
<script type="text/javascript">
|
70
|
+
/*<![CDATA[*/
|
71
|
+
$(document).ready(function() {
|
72
|
+
$("[id^='topicGroup']").on('show.bs.collapse', function (event) {
|
73
|
+
if (!($(event.target).attr('id').match(/^topicSubGroup/))) {
|
74
|
+
$(this).parent().find("[id^='tgSpan']").toggleClass("fa-angle-right fa-angle-down");
|
75
|
+
}
|
76
|
+
});
|
77
|
+
$("[id^='topicGroup']").on('hide.bs.collapse', function (event) {
|
78
|
+
if (!($(event.target).attr('id').match(/^topicSubGroup/))) {
|
79
|
+
$(this).parent().find("[id^='tgSpan']").toggleClass("fa-angle-right fa-angle-down");
|
80
|
+
}
|
81
|
+
});
|
82
|
+
$("[id^='topicSubGroup']").on('show.bs.collapse', function () {
|
83
|
+
$(this).parent().find("[id^='sgSpan']").toggleClass("fa-caret-right fa-caret-down");
|
84
|
+
});
|
85
|
+
$("[id^='topicSubGroup']").on('hide.bs.collapse', function () {
|
86
|
+
$(this).parent().find("[id^='sgSpan']").toggleClass("fa-caret-right fa-caret-down");
|
87
|
+
});
|
88
|
+
});
|
89
|
+
/*]]>*/
|
90
|
+
</script>
|
91
|
+
</body>
|
92
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
Name: AsciiBinder Doc Project
|
3
|
+
Dir: welcome
|
4
|
+
Topics:
|
5
|
+
- Name: Welcome
|
6
|
+
File: index
|
7
|
+
- Name: Subtopics
|
8
|
+
Dir: subtopics
|
9
|
+
Topics:
|
10
|
+
- Name: All Distros
|
11
|
+
File: index
|
12
|
+
- Name: MAIN_ONLY_TOPIC
|
13
|
+
File: main_only_topic
|
14
|
+
Distros: distro_main
|
15
|
+
- Name: TEST_ONLY_TOPIC
|
16
|
+
File: test_only_topic
|
17
|
+
Distros: distro_test
|
18
|
+
- Name: Wilcard All
|
19
|
+
File: wildcard_all
|
20
|
+
Distros: distro_*
|
21
|
+
|
22
|
+
---
|
23
|
+
Name: MAIN_ONLY_TOPIC_GROUP
|
24
|
+
Dir: main_only_topic_group
|
25
|
+
Distros: distro_main
|
26
|
+
Topics:
|
27
|
+
- Name: MAIN_ONLY_WELCOME
|
28
|
+
File: index
|
29
|
+
|
30
|
+
---
|
31
|
+
Name: TEST_ONLY_TOPIC_GROUP
|
32
|
+
Dir: test_only_topic_group
|
33
|
+
Distros: distro_test
|
34
|
+
Topics:
|
35
|
+
- Name: TEST_ONLY_WELCOME
|
36
|
+
File: index
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= {product-title} {product-version} Documentation
|
2
|
+
{product-author}
|
3
|
+
{product-version}
|
4
|
+
:data-uri:
|
5
|
+
:icons:
|
6
|
+
|
7
|
+
DIRECTIVE-TAGGED DOC
|
8
|
+
|
9
|
+
Line 1: This should be visible in all distros
|
10
|
+
|
11
|
+
ifdef::distro_main[]
|
12
|
+
Line 2: This should only be visible in distro_main
|
13
|
+
endif::[]
|
14
|
+
|
15
|
+
ifdef::distro_test[]
|
16
|
+
Line 3: This should only be visible in distro_test
|
17
|
+
endif::[]
|
data/lib/ascii_binder.rb
CHANGED
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'ascii_binder/distro_branch'
|
2
|
+
require 'ascii_binder/helpers'
|
3
|
+
require 'ascii_binder/site'
|
4
|
+
require 'trollop'
|
5
|
+
|
6
|
+
include AsciiBinder::Helpers
|
7
|
+
|
8
|
+
module AsciiBinder
|
9
|
+
class Distro
|
10
|
+
attr_reader :id, :name, :author, :site
|
11
|
+
|
12
|
+
def initialize(distro_map_filepath,distro_key,distro_config)
|
13
|
+
@id = distro_key
|
14
|
+
@name = distro_config['name']
|
15
|
+
@author = distro_config['author']
|
16
|
+
@site = AsciiBinder::Site.new(distro_config)
|
17
|
+
@branch_map = {}
|
18
|
+
distro_config['branches'].each do |branch_name,branch_config|
|
19
|
+
if @branch_map.has_key?(branch_name)
|
20
|
+
Trollop::die "Error parsing #{distro_map_filepath}: distro '#{distro_key}' lists git branch '#{branch_name}' multiple times."
|
21
|
+
end
|
22
|
+
@branch_map[branch_name] = AsciiBinder::DistroBranch.new(branch_name,branch_config,self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def is_valid?
|
27
|
+
validate
|
28
|
+
end
|
29
|
+
|
30
|
+
def errors
|
31
|
+
validate(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
def branch(branch_name)
|
35
|
+
unless @branch_map.has_key?(branch_name)
|
36
|
+
Trollop::die "Distro '#{@id}' does not include branch '#{branch_name}' in the distro map."
|
37
|
+
end
|
38
|
+
@branch_map[branch_name]
|
39
|
+
end
|
40
|
+
|
41
|
+
def branch_ids
|
42
|
+
@branch_map.keys
|
43
|
+
end
|
44
|
+
|
45
|
+
def branches
|
46
|
+
@branch_map.values
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def validate(verbose=false)
|
52
|
+
errors = []
|
53
|
+
unless valid_id?(@id)
|
54
|
+
if verbose
|
55
|
+
errors << "Distro ID '#{@id}' is not a valid string"
|
56
|
+
else
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
unless valid_string?(@name)
|
61
|
+
if verbose
|
62
|
+
errors << "Distro name '#{@name}' for distro '#{@id}' is not a valid string."
|
63
|
+
else
|
64
|
+
return false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
unless valid_string?(@author)
|
68
|
+
if verbose
|
69
|
+
errors << "Distro author '#{@author}' for distro '#{@id}' is not a valid string."
|
70
|
+
else
|
71
|
+
return false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Remaining checks are sub objects. Handle the verbose case first.
|
76
|
+
if verbose
|
77
|
+
site_errors = @site.errors
|
78
|
+
unless site_errors.empty?
|
79
|
+
error_txt = "The site info has errors:\n"
|
80
|
+
site_errors.each do |error|
|
81
|
+
error_txt << " * #{error}\n"
|
82
|
+
end
|
83
|
+
errors << error_txt
|
84
|
+
end
|
85
|
+
all_branch_errors = []
|
86
|
+
@branch_map.values.each do |branch|
|
87
|
+
branch_errors = branch.errors
|
88
|
+
unless branch_errors.empty?
|
89
|
+
all_branch_errors << " * In branch #{branch.id}:\n"
|
90
|
+
branch_errors.each do |error|
|
91
|
+
all_branch_errors << " * #{error}\n"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
unless all_branch_errors.empty?
|
96
|
+
all_branch_errors.unshift("The branch info has errors:")
|
97
|
+
errors.concat(all_branch_errors)
|
98
|
+
end
|
99
|
+
return errors
|
100
|
+
end
|
101
|
+
|
102
|
+
# Still here? Run the non-verbose checks instead.
|
103
|
+
return false unless @site.is_valid?
|
104
|
+
@branch_map.values.each do |branch|
|
105
|
+
return false unless branch.is_valid?
|
106
|
+
end
|
107
|
+
|
108
|
+
return true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'ascii_binder/helpers'
|
2
|
+
|
3
|
+
include AsciiBinder::Helpers
|
4
|
+
|
5
|
+
module AsciiBinder
|
6
|
+
class DistroBranch
|
7
|
+
attr_reader :id, :name, :dir, :distro, :distro_name, :distro_author
|
8
|
+
|
9
|
+
def initialize(branch_name,branch_config,distro)
|
10
|
+
@id = branch_name
|
11
|
+
@name = branch_config['name']
|
12
|
+
@dir = branch_config['dir']
|
13
|
+
@distro = distro
|
14
|
+
@distro_name = distro.name
|
15
|
+
@distro_author = distro.author
|
16
|
+
if branch_config.has_key?('distro-overrides')
|
17
|
+
if branch_config['distro-overrides'].has_key?('name')
|
18
|
+
@distro_name = branch_config['distro-overrides']['name']
|
19
|
+
end
|
20
|
+
if branch_config['distro-overrides'].has_key?('author')
|
21
|
+
@distro_author = branch_config['distro-overrides']['author']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def branch_path
|
27
|
+
@branch_path ||= File.join(preview_dir,@distro.id,@dir)
|
28
|
+
end
|
29
|
+
|
30
|
+
def branch_stylesheet_dir
|
31
|
+
@branch_stylesheet_dir ||= File.join(branch_path,STYLESHEET_DIRNAME)
|
32
|
+
end
|
33
|
+
|
34
|
+
def branch_javascript_dir
|
35
|
+
@branch_javascript_dir ||= File.join(branch_path,JAVASCRIPT_DIRNAME)
|
36
|
+
end
|
37
|
+
|
38
|
+
def branch_image_dir
|
39
|
+
@branch_image_dir ||= File.join(branch_path,IMAGE_DIRNAME)
|
40
|
+
end
|
41
|
+
|
42
|
+
def is_valid?
|
43
|
+
validate
|
44
|
+
end
|
45
|
+
|
46
|
+
def errors
|
47
|
+
validate(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def validate(verbose=true)
|
53
|
+
errors = []
|
54
|
+
unless valid_string?(@id)
|
55
|
+
if verbose
|
56
|
+
errors << "Branch ID '#{@id}' is not a valid string."
|
57
|
+
else
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
unless valid_string?(@name)
|
62
|
+
if verbose
|
63
|
+
errors << "Branch name '#{@name}' for branch ID '#{@id}' is not a valid string."
|
64
|
+
else
|
65
|
+
return false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
unless valid_string?(@dir)
|
69
|
+
if verbose
|
70
|
+
errors << "Branch dir '#{@dir}' for branch ID '#{@id}' is not a valid string."
|
71
|
+
else
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
unless valid_string?(@distro_name)
|
76
|
+
if verbose
|
77
|
+
errors << "Branchwise distro name '#{@distro_name}' for branch ID '#{@id}' is not a valid string."
|
78
|
+
else
|
79
|
+
return false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
unless valid_string?(@distro_author)
|
83
|
+
if verbose
|
84
|
+
errors << "Branchwise distro author '#{@distro_author}' for branch ID '#{@id}' is not a valid string."
|
85
|
+
else
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
return errors if verbose
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|