ascii_binder_gabriel_rh 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/Dockerfile +19 -0
  4. data/Gemfile +3 -0
  5. data/Guardfile +3 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.adoc +21 -0
  8. data/README.md +1 -0
  9. data/Rakefile +1 -0
  10. data/ascii_binder_gabriel_rh.gemspec +41 -0
  11. data/bin/ascii_binder_gabriel_rh +1 -0
  12. data/bin/asciibinder_gabriel_rh +350 -0
  13. data/features/command_help.feature +8 -0
  14. data/features/command_version.feature +8 -0
  15. data/features/repo_build.feature +39 -0
  16. data/features/repo_clean.feature +20 -0
  17. data/features/repo_clone.feature +22 -0
  18. data/features/repo_create.feature +13 -0
  19. data/features/repo_package.feature +15 -0
  20. data/features/step_definitions/steps.rb +189 -0
  21. data/features/support/_clone_distro_map.yml +14 -0
  22. data/features/support/_invalid_alias_topic_map.yml +50 -0
  23. data/features/support/_invalid_distro_map.yml +14 -0
  24. data/features/support/env.rb +518 -0
  25. data/features/support/test_distro/.gitignore +9 -0
  26. data/features/support/test_distro/_distro_map.yml +29 -0
  27. data/features/support/test_distro/_images/asciibinder-logo-horizontal.png +0 -0
  28. data/features/support/test_distro/_images/asciibinder_web_logo.svg +125 -0
  29. data/features/support/test_distro/_images/book_pages_bg.jpg +0 -0
  30. data/features/support/test_distro/_images/favicon.ico +0 -0
  31. data/features/support/test_distro/_images/favicon32x32.png +0 -0
  32. data/features/support/test_distro/_javascripts/.gitkeep +0 -0
  33. data/features/support/test_distro/_stylesheets/asciibinder.css +568 -0
  34. data/features/support/test_distro/_templates/_css.html.erb +3 -0
  35. data/features/support/test_distro/_templates/_nav.html.erb +31 -0
  36. data/features/support/test_distro/_templates/page.html.erb +92 -0
  37. data/features/support/test_distro/_topic_map.yml +50 -0
  38. data/features/support/test_distro/index-main.html +10 -0
  39. data/features/support/test_distro/index-test.html +10 -0
  40. data/features/support/test_distro/main_only_topic_group/index.adoc +17 -0
  41. data/features/support/test_distro/test_only_topic_group/index.adoc +17 -0
  42. data/features/support/test_distro/welcome/aliased.adoc +9 -0
  43. data/features/support/test_distro/welcome/index.adoc +17 -0
  44. data/features/support/test_distro/welcome/subtopics/index.adoc +17 -0
  45. data/features/support/test_distro/welcome/subtopics/main_only_topic.adoc +17 -0
  46. data/features/support/test_distro/welcome/subtopics/test_only_topic.adoc +17 -0
  47. data/features/support/test_distro/welcome/subtopics/wildcard_all.adoc +17 -0
  48. data/lib/ascii_binder_gabriel_rh/distro.rb +111 -0
  49. data/lib/ascii_binder_gabriel_rh/distro_branch.rb +97 -0
  50. data/lib/ascii_binder_gabriel_rh/distro_map.rb +67 -0
  51. data/lib/ascii_binder_gabriel_rh/engine.rb +690 -0
  52. data/lib/ascii_binder_gabriel_rh/helpers.rb +172 -0
  53. data/lib/ascii_binder_gabriel_rh/site.rb +52 -0
  54. data/lib/ascii_binder_gabriel_rh/site_info.rb +22 -0
  55. data/lib/ascii_binder_gabriel_rh/site_map.rb +24 -0
  56. data/lib/ascii_binder_gabriel_rh/tasks/guards.rb +15 -0
  57. data/lib/ascii_binder_gabriel_rh/tasks/tasks.rb +41 -0
  58. data/lib/ascii_binder_gabriel_rh/template_renderer.rb +29 -0
  59. data/lib/ascii_binder_gabriel_rh/topic_entity.rb +324 -0
  60. data/lib/ascii_binder_gabriel_rh/topic_map.rb +112 -0
  61. data/lib/ascii_binder_gabriel_rh/version.rb +3 -0
  62. data/lib/ascii_binder_gabriel_rh.rb +5 -0
  63. data/templates/.gitignore +9 -0
  64. data/templates/LICENSE.txt +4 -0
  65. data/templates/README.adoc +11 -0
  66. data/templates/_distro_map.yml +11 -0
  67. data/templates/_images/asciibinder-logo-horizontal.png +0 -0
  68. data/templates/_images/asciibinder_web_logo.svg +125 -0
  69. data/templates/_images/book_pages_bg.jpg +0 -0
  70. data/templates/_images/favicon.ico +0 -0
  71. data/templates/_images/favicon32x32.png +0 -0
  72. data/templates/_javascripts/.gitkeep +0 -0
  73. data/templates/_javascripts/bootstrap-offcanvas.js +6 -0
  74. data/templates/_stylesheets/asciibinder.css +568 -0
  75. data/templates/_templates/_breadcrumb.html.erb +14 -0
  76. data/templates/_templates/_css.html.erb +3 -0
  77. data/templates/_templates/_nav.html.erb +14 -0
  78. data/templates/_templates/_title.html.erb +8 -0
  79. data/templates/_templates/page.html.erb +88 -0
  80. data/templates/_topic_map.yml +29 -0
  81. data/templates/index-main.html +89 -0
  82. data/templates/welcome/index.adoc +14 -0
  83. metadata +423 -0
@@ -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="AsciiBinderGabrielRH" 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="AsciiBinderGabrielRH" 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,50 @@
1
+ ---
2
+ Name: AsciiBinderGabrielRH Doc Project
3
+ Dir: welcome
4
+ Topics:
5
+ - Name: Welcome
6
+ File: index
7
+ - Name: Aliased Topic
8
+ File: aliased
9
+ - Name: Subtopics
10
+ Dir: subtopics
11
+ Topics:
12
+ - Name: All Distros
13
+ File: index
14
+ - Name: MAIN_ONLY_TOPIC
15
+ File: main_only_topic
16
+ Distros: distro_main
17
+ - Name: TEST_ONLY_TOPIC
18
+ File: test_only_topic
19
+ Distros: distro_test
20
+ - Name: Wilcard All
21
+ File: wildcard_all
22
+ Distros: distro_*
23
+
24
+ ---
25
+ Name: MAIN_ONLY_TOPIC_GROUP
26
+ Dir: main_only_topic_group
27
+ Distros: distro_main
28
+ Topics:
29
+ - Name: MAIN_ONLY_WELCOME
30
+ File: index
31
+
32
+ ---
33
+ Name: TEST_ONLY_TOPIC_GROUP
34
+ Dir: test_only_topic_group
35
+ Distros: distro_test
36
+ Topics:
37
+ - Name: TEST_ONLY_WELCOME
38
+ File: index
39
+
40
+ ---
41
+ Name: ALIASES_GROUP
42
+ Dir: aliases
43
+ Topics:
44
+ - Name: Alias to Aliased
45
+ File: a_to_a
46
+ Alias: welcome/aliased
47
+ - Name: Alias to External
48
+ File: a_to_e
49
+ Alias: https://redhat.com/
50
+
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>INDEX MAIN</title>
6
+ </head>
7
+ <body>
8
+ INDEX MAIN
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>INDEX TEST</title>
6
+ </head>
7
+ <body>
8
+ INDEX TEST
9
+ </body>
10
+ </html>
@@ -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,9 @@
1
+ = Aliased Topic
2
+ {product-author}
3
+ {product-version}
4
+ :data-uri:
5
+ :icons:
6
+
7
+ This topic exercises topic _aliasing_, which enables authors to manage page redirects without having to fiddle with web server settings.
8
+
9
+ This behavior borrows directly from the same-named concept supported by the link:https://gohugo.io[hugo] blog generator.
@@ -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,111 @@
1
+ require 'ascii_binder_gabriel_rh/distro_branch'
2
+ require 'ascii_binder_gabriel_rh/helpers'
3
+ require 'ascii_binder_gabriel_rh/site'
4
+ require 'trollop'
5
+
6
+ include AsciiBinderGabrielRH::Helpers
7
+
8
+ module AsciiBinderGabrielRH
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 = AsciiBinderGabrielRH::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] = AsciiBinderGabrielRH::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,97 @@
1
+ require 'ascii_binder_gabriel_rh/helpers'
2
+
3
+ include AsciiBinderGabrielRH::Helpers
4
+
5
+ module AsciiBinderGabrielRH
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_url_base
31
+ @branch_url_base ||= File.join('/',@dir)
32
+ end
33
+
34
+ def branch_stylesheet_dir
35
+ @branch_stylesheet_dir ||= File.join(branch_path,STYLESHEET_DIRNAME)
36
+ end
37
+
38
+ def branch_javascript_dir
39
+ @branch_javascript_dir ||= File.join(branch_path,JAVASCRIPT_DIRNAME)
40
+ end
41
+
42
+ def branch_image_dir
43
+ @branch_image_dir ||= File.join(branch_path,IMAGE_DIRNAME)
44
+ end
45
+
46
+ def is_valid?
47
+ validate
48
+ end
49
+
50
+ def errors
51
+ validate(true)
52
+ end
53
+
54
+ private
55
+
56
+ def validate(verbose=true)
57
+ errors = []
58
+ unless valid_string?(@id)
59
+ if verbose
60
+ errors << "Branch ID '#{@id}' is not a valid string."
61
+ else
62
+ return false
63
+ end
64
+ end
65
+ unless valid_string?(@name)
66
+ if verbose
67
+ errors << "Branch name '#{@name}' for branch ID '#{@id}' is not a valid string."
68
+ else
69
+ return false
70
+ end
71
+ end
72
+ unless valid_string?(@dir)
73
+ if verbose
74
+ errors << "Branch dir '#{@dir}' for branch ID '#{@id}' is not a valid string."
75
+ else
76
+ return false
77
+ end
78
+ end
79
+ unless valid_string?(@distro_name)
80
+ if verbose
81
+ errors << "Branchwise distro name '#{@distro_name}' for branch ID '#{@id}' is not a valid string."
82
+ else
83
+ return false
84
+ end
85
+ end
86
+ unless valid_string?(@distro_author)
87
+ if verbose
88
+ errors << "Branchwise distro author '#{@distro_author}' for branch ID '#{@id}' is not a valid string."
89
+ else
90
+ return false
91
+ end
92
+ end
93
+ return errors if verbose
94
+ return true
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,67 @@
1
+ require 'ascii_binder_gabriel_rh/distro'
2
+ require 'trollop'
3
+ require 'yaml'
4
+
5
+ module AsciiBinderGabrielRH
6
+ class DistroMap
7
+ def initialize(distro_map_filepath)
8
+ @distro_yaml = YAML.load_file(distro_map_filepath)
9
+ @distro_map = {}
10
+ @distro_yaml.each do |distro_key,distro_config|
11
+ if @distro_map.has_key?(distro_key)
12
+ Trollop::die "Error parsing '#{distro_map_filepath}': distro key '#{distro_key}' is used more than once."
13
+ end
14
+ distro = AsciiBinderGabrielRH::Distro.new(distro_map_filepath,distro_key,distro_config)
15
+ @distro_map[distro_key] = distro
16
+ end
17
+ end
18
+
19
+ def get_distro(distro_key)
20
+ unless @distro_map.has_key?(distro_key)
21
+ Trollop::die "Distro key '#{distro_key}' does not exist"
22
+ end
23
+ @distro_map[distro_key]
24
+ end
25
+
26
+ def include_distro_key?(distro_key)
27
+ @distro_map.has_key?(distro_key)
28
+ end
29
+
30
+ def distro_keys
31
+ @distro_map.keys
32
+ end
33
+
34
+ def distros
35
+ @distro_map.values
36
+ end
37
+
38
+ def distro_branches(distro_key='')
39
+ if distro_key == ''
40
+ branch_list = []
41
+ distros.each do |distro|
42
+ branch_list.concat(distro.branch_ids)
43
+ end
44
+ return branch_list.uniq
45
+ else
46
+ return get_distro(distro_key).branch_ids
47
+ end
48
+ end
49
+
50
+ def is_valid?
51
+ @distro_map.values.each do |distro|
52
+ next if distro.is_valid?
53
+ return false
54
+ end
55
+ return true
56
+ end
57
+
58
+ def errors
59
+ errors = []
60
+ @distro_map.values.each do |distro|
61
+ next if distro.is_valid?
62
+ errors << distro.errors
63
+ end
64
+ return errors
65
+ end
66
+ end
67
+ end