corl 0.4.29 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +16 -13
  4. data/VERSION +1 -1
  5. data/bin/corl +21 -1
  6. data/bootstrap/os/ubuntu/00_base.sh +2 -2
  7. data/bootstrap/os/ubuntu/06_puppet.sh +7 -12
  8. data/bootstrap/os/ubuntu/09_nucleon.sh +1 -1
  9. data/bootstrap/os/ubuntu/10_corl.sh +1 -4
  10. data/corl.gemspec +193 -40
  11. data/lib/CORL/builder/identity.rb +68 -0
  12. data/lib/CORL/builder/package.rb +75 -0
  13. data/lib/CORL/configuration/file.rb +5 -5
  14. data/lib/CORL/machine/{aws.rb → AWS.rb} +2 -2
  15. data/lib/CORL/machine/physical.rb +1 -1
  16. data/lib/CORL/machine/rackspace.rb +1 -1
  17. data/lib/CORL/machine/vagrant.rb +2 -2
  18. data/lib/CORL/network/{default.rb → CORL.rb} +1 -1
  19. data/lib/CORL/node/{aws.rb → AWS.rb} +1 -1
  20. data/lib/CORL/node/local.rb +1 -1
  21. data/lib/CORL/node/vagrant.rb +7 -2
  22. data/lib/CORL/provisioner/puppetnode.rb +139 -131
  23. data/lib/core/build.rb +112 -0
  24. data/lib/core/facade.rb +48 -8
  25. data/lib/core/mixin/builder.rb +158 -0
  26. data/lib/core/mixin/lookup.rb +51 -20
  27. data/lib/core/mixin/machine/ssh.rb +16 -4
  28. data/lib/core/plugin/builder.rb +49 -0
  29. data/lib/core/plugin/{action.rb → cloud_action.rb} +22 -16
  30. data/lib/core/plugin/configuration.rb +9 -3
  31. data/lib/core/plugin/fog_machine.rb +3 -3
  32. data/lib/core/plugin/fog_node.rb +1 -1
  33. data/lib/core/plugin/machine.rb +2 -2
  34. data/lib/core/plugin/network.rb +39 -10
  35. data/lib/core/plugin/node.rb +95 -35
  36. data/lib/core/plugin/provisioner.rb +133 -113
  37. data/lib/core/util/puppet/resource.rb +1 -1
  38. data/lib/core/vagrant/actions/delete_cache.rb +7 -1
  39. data/lib/core/vagrant/commands/launcher.rb +2 -2
  40. data/lib/core/vagrant/config.rb +29 -2
  41. data/lib/corl.rb +9 -8
  42. data/lib/facter/corl_config_ready.rb +1 -1
  43. data/lib/facter/vagrant_exists.rb +1 -1
  44. data/lib/nucleon/action/cloud/create.rb +51 -0
  45. data/lib/nucleon/action/cloud/hiera.rb +61 -0
  46. data/lib/{CORL/action → nucleon/action/cloud}/images.rb +11 -2
  47. data/lib/nucleon/action/cloud/inspect.rb +47 -0
  48. data/lib/{CORL/action → nucleon/action/cloud}/machines.rb +11 -2
  49. data/lib/{CORL/action → nucleon/action/cloud}/regions.rb +11 -2
  50. data/lib/{CORL/action → nucleon/action/cloud}/vagrantfile.rb +11 -2
  51. data/lib/{CORL/action/ip.rb → nucleon/action/node/IP.rb} +11 -2
  52. data/lib/{CORL/action/ssh.rb → nucleon/action/node/SSH.rb} +15 -7
  53. data/lib/{CORL/action → nucleon/action/node}/authorize.rb +11 -2
  54. data/lib/{CORL/action → nucleon/action/node}/bootstrap.rb +13 -4
  55. data/lib/nucleon/action/node/build.rb +49 -0
  56. data/lib/{CORL/action → nucleon/action/node}/destroy.rb +14 -5
  57. data/lib/{CORL/action → nucleon/action/node}/exec.rb +11 -2
  58. data/lib/{CORL/action → nucleon/action/node}/facts.rb +12 -3
  59. data/lib/{CORL/action → nucleon/action/node}/image.rb +13 -4
  60. data/lib/nucleon/action/node/keypair.rb +85 -0
  61. data/lib/{CORL/action → nucleon/action/node}/lookup.rb +13 -4
  62. data/lib/{CORL/action → nucleon/action/node}/provision.rb +30 -8
  63. data/lib/{CORL/action → nucleon/action/node}/reboot.rb +13 -4
  64. data/lib/{CORL/action → nucleon/action/node}/revoke.rb +11 -2
  65. data/lib/{CORL/action → nucleon/action/node}/seed.rb +13 -4
  66. data/lib/{CORL/action → nucleon/action/node}/spawn.rb +19 -9
  67. data/lib/{CORL/action → nucleon/action/node}/start.rb +13 -4
  68. data/lib/{CORL/action → nucleon/action/node}/stop.rb +13 -4
  69. data/lib/{CORL → nucleon}/event/puppet.rb +2 -2
  70. data/lib/{CORL → nucleon}/template/environment.rb +2 -2
  71. data/lib/puppet/indirector/corl.rb +7 -4
  72. data/lib/puppet/parser/functions/corl_resources.rb +1 -0
  73. data/lib/puppet/parser/functions/global_array.rb +2 -1
  74. data/lib/puppet/parser/functions/global_hash.rb +2 -1
  75. data/lib/puppet/parser/functions/global_param.rb +2 -1
  76. data/lib/puppet/parser/functions/module_array.rb +2 -1
  77. data/lib/puppet/parser/functions/module_hash.rb +3 -2
  78. data/lib/puppet/parser/functions/module_param.rb +3 -2
  79. data/lib/puppet/parser/functions/render.rb +1 -0
  80. data/locales/en.yml +80 -0
  81. data/rdoc/site/0.4.29/CORL/Action/Authorize.html +485 -0
  82. data/rdoc/site/0.4.29/CORL/Action/Bootstrap.html +546 -0
  83. data/rdoc/site/0.4.29/CORL/Action/Build.html +396 -0
  84. data/rdoc/site/0.4.29/CORL/Action/Destroy.html +515 -0
  85. data/rdoc/site/0.4.29/CORL/Action/Exec.html +472 -0
  86. data/rdoc/site/0.4.29/CORL/Action/Facts.html +398 -0
  87. data/rdoc/site/0.4.29/CORL/Action/Image.html +515 -0
  88. data/rdoc/site/0.4.29/CORL/Action/Images.html +514 -0
  89. data/rdoc/site/0.4.29/CORL/Action/Ip.html +395 -0
  90. data/rdoc/site/0.4.29/CORL/Action/Keypair.html +494 -0
  91. data/rdoc/site/0.4.29/CORL/Action/Lookup.html +474 -0
  92. data/rdoc/site/0.4.29/CORL/Action/Machines.html +509 -0
  93. data/rdoc/site/0.4.29/CORL/Action/Provision.html +456 -0
  94. data/rdoc/site/0.4.29/CORL/Action/Reboot.html +515 -0
  95. data/rdoc/site/0.4.29/CORL/Action/Regions.html +509 -0
  96. data/rdoc/site/0.4.29/CORL/Action/Revoke.html +483 -0
  97. data/rdoc/site/0.4.29/CORL/Action/Seed.html +544 -0
  98. data/rdoc/site/0.4.29/CORL/Action/Spawn.html +616 -0
  99. data/rdoc/site/0.4.29/CORL/Action/Ssh.html +526 -0
  100. data/rdoc/site/0.4.29/CORL/Action/Start.html +515 -0
  101. data/rdoc/site/0.4.29/CORL/Action/Stop.html +515 -0
  102. data/rdoc/site/0.4.29/CORL/Action/Vagrantfile.html +457 -0
  103. data/rdoc/site/0.4.29/CORL/Action.html +360 -0
  104. data/rdoc/site/0.4.29/CORL/Configuration/File.html +1128 -0
  105. data/rdoc/site/0.4.29/CORL/Configuration.html +339 -0
  106. data/rdoc/site/0.4.29/CORL/Errors.html +339 -0
  107. data/rdoc/site/0.4.29/CORL/Event/Puppet.html +673 -0
  108. data/rdoc/site/0.4.29/CORL/Event.html +339 -0
  109. data/rdoc/site/0.4.29/CORL/Facade.html +742 -0
  110. data/rdoc/site/0.4.29/CORL/Machine/Aws.html +733 -0
  111. data/rdoc/site/0.4.29/CORL/Machine/Fog.html +1269 -0
  112. data/rdoc/site/0.4.29/CORL/Machine/Physical.html +1039 -0
  113. data/rdoc/site/0.4.29/CORL/Machine/Rackspace.html +514 -0
  114. data/rdoc/site/0.4.29/CORL/Machine/Vagrant.html +1300 -0
  115. data/rdoc/site/0.4.29/CORL/Machine.html +343 -0
  116. data/rdoc/site/0.4.29/CORL/Mixin/Action/Keypair.html +572 -0
  117. data/rdoc/site/0.4.29/CORL/Mixin/Action.html +339 -0
  118. data/rdoc/site/0.4.29/CORL/Mixin/Lookup.html +954 -0
  119. data/rdoc/site/0.4.29/CORL/Mixin/Machine/SSH.html +643 -0
  120. data/rdoc/site/0.4.29/CORL/Mixin/Machine.html +339 -0
  121. data/rdoc/site/0.4.29/CORL/Mixin/Macro/NetworkSettings.html +464 -0
  122. data/rdoc/site/0.4.29/CORL/Mixin/Macro.html +339 -0
  123. data/rdoc/site/0.4.29/CORL/Mixin.html +342 -0
  124. data/rdoc/site/0.4.29/CORL/Network/Default.html +391 -0
  125. data/rdoc/site/0.4.29/CORL/Network.html +339 -0
  126. data/rdoc/site/0.4.29/CORL/Node/Aws.html +716 -0
  127. data/rdoc/site/0.4.29/CORL/Node/Fog.html +1192 -0
  128. data/rdoc/site/0.4.29/CORL/Node/Local.html +424 -0
  129. data/rdoc/site/0.4.29/CORL/Node/Rackspace.html +709 -0
  130. data/rdoc/site/0.4.29/CORL/Node/Vagrant.html +1451 -0
  131. data/rdoc/site/0.4.29/CORL/Node.html +343 -0
  132. data/rdoc/site/0.4.29/CORL/Plugin/CloudAction.html +810 -0
  133. data/rdoc/site/0.4.29/CORL/Plugin.html +339 -0
  134. data/rdoc/site/0.4.29/CORL/Provisioner/Puppetnode.html +1095 -0
  135. data/rdoc/site/0.4.29/CORL/Provisioner.html +339 -0
  136. data/rdoc/site/0.4.29/CORL/Template/Environment.html +528 -0
  137. data/rdoc/site/0.4.29/CORL/Template.html +339 -0
  138. data/rdoc/site/0.4.29/CORL/Util/Puppet/Resource.html +1038 -0
  139. data/rdoc/site/0.4.29/CORL/Util/Puppet/ResourceGroup.html +920 -0
  140. data/rdoc/site/0.4.29/CORL/Util/Puppet.html +1087 -0
  141. data/rdoc/site/0.4.29/CORL/Util.html +341 -0
  142. data/rdoc/site/0.4.29/CORL/Vagrant/Config.html +896 -0
  143. data/rdoc/site/0.4.29/CORL/Vagrant.html +418 -0
  144. data/rdoc/site/0.4.29/CORL.html +465 -0
  145. data/rdoc/site/0.4.29/Facter/Util/Loader.html +396 -0
  146. data/rdoc/site/0.4.29/Facter/Util.html +339 -0
  147. data/rdoc/site/0.4.29/Facter.html +339 -0
  148. data/rdoc/site/0.4.29/Fog/Compute/AWS/Server.html +423 -0
  149. data/rdoc/site/0.4.29/Fog/Compute/AWS.html +345 -0
  150. data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2/Server.html +408 -0
  151. data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2.html +345 -0
  152. data/rdoc/site/0.4.29/Fog/Compute.html +340 -0
  153. data/rdoc/site/0.4.29/Fog.html +340 -0
  154. data/rdoc/site/0.4.29/Hiera/Backend.html +422 -0
  155. data/rdoc/site/0.4.29/Hiera/Corl_logger.html +449 -0
  156. data/rdoc/site/0.4.29/Hiera.html +346 -0
  157. data/rdoc/site/0.4.29/Nucleon/Config.html +357 -0
  158. data/rdoc/site/0.4.29/Nucleon/Plugin/Base.html +345 -0
  159. data/rdoc/site/0.4.29/Nucleon/Plugin/Configuration.html +1213 -0
  160. data/rdoc/site/0.4.29/Nucleon/Plugin/Machine.html +1279 -0
  161. data/rdoc/site/0.4.29/Nucleon/Plugin/Network.html +1425 -0
  162. data/rdoc/site/0.4.29/Nucleon/Plugin/Node.html +3715 -0
  163. data/rdoc/site/0.4.29/Nucleon/Plugin/Provisioner.html +1297 -0
  164. data/rdoc/site/0.4.29/Nucleon/Plugin.html +344 -0
  165. data/rdoc/site/0.4.29/Nucleon.html +344 -0
  166. data/rdoc/site/0.4.29/Object.html +358 -0
  167. data/rdoc/site/0.4.29/Puppet/DataBinding/Corl.html +345 -0
  168. data/rdoc/site/0.4.29/Puppet/DataBinding.html +338 -0
  169. data/rdoc/site/0.4.29/Puppet/Indirector/Corl.html +454 -0
  170. data/rdoc/site/0.4.29/Puppet/Indirector.html +338 -0
  171. data/rdoc/site/0.4.29/Puppet/Parser/Functions.html +480 -0
  172. data/rdoc/site/0.4.29/Puppet/Parser.html +338 -0
  173. data/rdoc/site/0.4.29/Puppet.html +338 -0
  174. data/rdoc/site/0.4.29/README_rdoc.html +340 -0
  175. data/rdoc/site/0.4.29/Vagrant/Config/Loader.html +399 -0
  176. data/rdoc/site/0.4.29/Vagrant/Config.html +339 -0
  177. data/rdoc/site/0.4.29/Vagrant/Vagrantfile.html +392 -0
  178. data/rdoc/site/0.4.29/Vagrant.html +346 -0
  179. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/DeleteCache.html +396 -0
  180. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/InitKeys.html +408 -0
  181. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/LinkNetwork.html +406 -0
  182. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action.html +341 -0
  183. data/rdoc/site/0.4.29/VagrantPlugins/CORL/BaseAction.html +491 -0
  184. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command/Launcher.html +533 -0
  185. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command.html +339 -0
  186. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config/CORL.html +732 -0
  187. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config.html +339 -0
  188. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Plugin.html +345 -0
  189. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner/CORL.html +536 -0
  190. data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner.html +339 -0
  191. data/rdoc/site/0.4.29/VagrantPlugins/CORL.html +346 -0
  192. data/rdoc/site/0.4.29/VagrantPlugins.html +346 -0
  193. data/rdoc/site/0.4.29/created.rid +96 -0
  194. data/rdoc/site/0.4.29/images/add.png +0 -0
  195. data/rdoc/site/0.4.29/images/brick.png +0 -0
  196. data/rdoc/site/0.4.29/images/brick_link.png +0 -0
  197. data/rdoc/site/0.4.29/images/bug.png +0 -0
  198. data/rdoc/site/0.4.29/images/bullet_black.png +0 -0
  199. data/rdoc/site/0.4.29/images/bullet_toggle_minus.png +0 -0
  200. data/rdoc/site/0.4.29/images/bullet_toggle_plus.png +0 -0
  201. data/rdoc/site/0.4.29/images/date.png +0 -0
  202. data/rdoc/site/0.4.29/images/delete.png +0 -0
  203. data/rdoc/site/0.4.29/images/find.png +0 -0
  204. data/rdoc/site/0.4.29/images/loadingAnimation.gif +0 -0
  205. data/rdoc/site/0.4.29/images/macFFBgHack.png +0 -0
  206. data/rdoc/site/0.4.29/images/package.png +0 -0
  207. data/rdoc/site/0.4.29/images/page_green.png +0 -0
  208. data/rdoc/site/0.4.29/images/page_white_text.png +0 -0
  209. data/rdoc/site/0.4.29/images/page_white_width.png +0 -0
  210. data/rdoc/site/0.4.29/images/plugin.png +0 -0
  211. data/rdoc/site/0.4.29/images/ruby.png +0 -0
  212. data/rdoc/site/0.4.29/images/tag_blue.png +0 -0
  213. data/rdoc/site/0.4.29/images/tag_green.png +0 -0
  214. data/rdoc/site/0.4.29/images/transparent.png +0 -0
  215. data/rdoc/site/0.4.29/images/wrench.png +0 -0
  216. data/rdoc/site/0.4.29/images/wrench_orange.png +0 -0
  217. data/rdoc/site/0.4.29/images/zoom.png +0 -0
  218. data/rdoc/site/0.4.29/index.html +339 -0
  219. data/rdoc/site/0.4.29/js/darkfish.js +155 -0
  220. data/rdoc/site/0.4.29/js/jquery.js +18 -0
  221. data/rdoc/site/0.4.29/js/navigation.js +142 -0
  222. data/rdoc/site/0.4.29/js/search.js +94 -0
  223. data/rdoc/site/0.4.29/js/search_index.js +1 -0
  224. data/rdoc/site/0.4.29/js/searcher.js +228 -0
  225. data/rdoc/site/0.4.29/rdoc.css +543 -0
  226. data/rdoc/site/0.4.29/table_of_contents.html +1561 -0
  227. metadata +192 -45
  228. data/lib/CORL/action/build.rb +0 -22
  229. data/lib/CORL/action/keypair.rb +0 -56
  230. data/lib/core/mod/facter_loader.rb +0 -15
@@ -0,0 +1,1128 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class CORL::Configuration::File - corl 0.4.29</title>
8
+
9
+ <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../../index.html">Home</a>
28
+ <a href="../../table_of_contents.html#classes">Classes</a>
29
+ <a href="../../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/CORL/configuration/file.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link">CORL.plugin_class(:configuration)
63
+
64
+ </nav>
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <nav id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+
71
+ <ul class="link-list">
72
+
73
+ <li><a href="#method-i-attach">#attach</a>
74
+
75
+ <li><a href="#method-i-delete_attachments">#delete_attachments</a>
76
+
77
+ <li><a href="#method-i-fetch_project">#fetch_project</a>
78
+
79
+ <li><a href="#method-i-load">#load</a>
80
+
81
+ <li><a href="#method-i-normalize">#normalize</a>
82
+
83
+ <li><a href="#method-i-remove">#remove</a>
84
+
85
+ <li><a href="#method-i-router">#router</a>
86
+
87
+ <li><a href="#method-i-save">#save</a>
88
+
89
+ <li><a href="#method-i-search">#search</a>
90
+
91
+ <li><a href="#method-i-search_files">#search_files</a>
92
+
93
+ <li><a href="#method-i-select_largest">#select_largest</a>
94
+
95
+ <li><a href="#method-i-separate">#separate</a>
96
+
97
+ <li><a href="#method-i-set_location">#set_location</a>
98
+
99
+ <li><a href="#method-i-update_project">#update_project</a>
100
+
101
+ </ul>
102
+ </nav>
103
+
104
+ </div>
105
+
106
+ <div id="project-metadata">
107
+ <nav id="fileindex-section" class="section project-section">
108
+ <h3 class="section-header">Pages</h3>
109
+
110
+ <ul>
111
+
112
+ <li class="file"><a href="../../README_rdoc.html">README</a>
113
+
114
+ </ul>
115
+ </nav>
116
+
117
+ <nav id="classindex-section" class="section project-section">
118
+ <h3 class="section-header">Class and Module Index</h3>
119
+
120
+ <ul class="link-list">
121
+
122
+ <li><a href="../../CORL.html">CORL</a>
123
+
124
+ <li><a href="../../CORL/Action.html">CORL::Action</a>
125
+
126
+ <li><a href="../../CORL/Action/Authorize.html">CORL::Action::Authorize</a>
127
+
128
+ <li><a href="../../CORL/Action/Bootstrap.html">CORL::Action::Bootstrap</a>
129
+
130
+ <li><a href="../../CORL/Action/Build.html">CORL::Action::Build</a>
131
+
132
+ <li><a href="../../CORL/Action/Destroy.html">CORL::Action::Destroy</a>
133
+
134
+ <li><a href="../../CORL/Action/Exec.html">CORL::Action::Exec</a>
135
+
136
+ <li><a href="../../CORL/Action/Facts.html">CORL::Action::Facts</a>
137
+
138
+ <li><a href="../../CORL/Action/Image.html">CORL::Action::Image</a>
139
+
140
+ <li><a href="../../CORL/Action/Images.html">CORL::Action::Images</a>
141
+
142
+ <li><a href="../../CORL/Action/Ip.html">CORL::Action::Ip</a>
143
+
144
+ <li><a href="../../CORL/Action/Keypair.html">CORL::Action::Keypair</a>
145
+
146
+ <li><a href="../../CORL/Action/Lookup.html">CORL::Action::Lookup</a>
147
+
148
+ <li><a href="../../CORL/Action/Machines.html">CORL::Action::Machines</a>
149
+
150
+ <li><a href="../../CORL/Action/Provision.html">CORL::Action::Provision</a>
151
+
152
+ <li><a href="../../CORL/Action/Reboot.html">CORL::Action::Reboot</a>
153
+
154
+ <li><a href="../../CORL/Action/Regions.html">CORL::Action::Regions</a>
155
+
156
+ <li><a href="../../CORL/Action/Revoke.html">CORL::Action::Revoke</a>
157
+
158
+ <li><a href="../../CORL/Action/Seed.html">CORL::Action::Seed</a>
159
+
160
+ <li><a href="../../CORL/Action/Spawn.html">CORL::Action::Spawn</a>
161
+
162
+ <li><a href="../../CORL/Action/Ssh.html">CORL::Action::Ssh</a>
163
+
164
+ <li><a href="../../CORL/Action/Start.html">CORL::Action::Start</a>
165
+
166
+ <li><a href="../../CORL/Action/Stop.html">CORL::Action::Stop</a>
167
+
168
+ <li><a href="../../CORL/Action/Vagrantfile.html">CORL::Action::Vagrantfile</a>
169
+
170
+ <li><a href="../../CORL/Configuration.html">CORL::Configuration</a>
171
+
172
+ <li><a href="../../CORL/Configuration/File.html">CORL::Configuration::File</a>
173
+
174
+ <li><a href="../../CORL/Errors.html">CORL::Errors</a>
175
+
176
+ <li><a href="../../CORL/Event.html">CORL::Event</a>
177
+
178
+ <li><a href="../../CORL/Event/Puppet.html">CORL::Event::Puppet</a>
179
+
180
+ <li><a href="../../CORL/Facade.html">CORL::Facade</a>
181
+
182
+ <li><a href="../../CORL/Machine.html">CORL::Machine</a>
183
+
184
+ <li><a href="../../CORL/Machine/Aws.html">CORL::Machine::Aws</a>
185
+
186
+ <li><a href="../../CORL/Machine/Fog.html">CORL::Machine::Fog</a>
187
+
188
+ <li><a href="../../CORL/Machine/Physical.html">CORL::Machine::Physical</a>
189
+
190
+ <li><a href="../../CORL/Machine/Rackspace.html">CORL::Machine::Rackspace</a>
191
+
192
+ <li><a href="../../CORL/Machine/Vagrant.html">CORL::Machine::Vagrant</a>
193
+
194
+ <li><a href="../../CORL/Mixin.html">CORL::Mixin</a>
195
+
196
+ <li><a href="../../CORL/Mixin/Action.html">CORL::Mixin::Action</a>
197
+
198
+ <li><a href="../../CORL/Mixin/Action/Keypair.html">CORL::Mixin::Action::Keypair</a>
199
+
200
+ <li><a href="../../CORL/Mixin/Lookup.html">CORL::Mixin::Lookup</a>
201
+
202
+ <li><a href="../../CORL/Mixin/Machine.html">CORL::Mixin::Machine</a>
203
+
204
+ <li><a href="../../CORL/Mixin/Machine/SSH.html">CORL::Mixin::Machine::SSH</a>
205
+
206
+ <li><a href="../../CORL/Mixin/Macro.html">CORL::Mixin::Macro</a>
207
+
208
+ <li><a href="../../CORL/Mixin/Macro/NetworkSettings.html">CORL::Mixin::Macro::NetworkSettings</a>
209
+
210
+ <li><a href="../../CORL/Network.html">CORL::Network</a>
211
+
212
+ <li><a href="../../CORL/Network/Default.html">CORL::Network::Default</a>
213
+
214
+ <li><a href="../../CORL/Node.html">CORL::Node</a>
215
+
216
+ <li><a href="../../CORL/Node/Aws.html">CORL::Node::Aws</a>
217
+
218
+ <li><a href="../../CORL/Node/Fog.html">CORL::Node::Fog</a>
219
+
220
+ <li><a href="../../CORL/Node/Local.html">CORL::Node::Local</a>
221
+
222
+ <li><a href="../../CORL/Node/Rackspace.html">CORL::Node::Rackspace</a>
223
+
224
+ <li><a href="../../CORL/Node/Vagrant.html">CORL::Node::Vagrant</a>
225
+
226
+ <li><a href="../../CORL/Plugin.html">CORL::Plugin</a>
227
+
228
+ <li><a href="../../CORL/Plugin/CloudAction.html">CORL::Plugin::CloudAction</a>
229
+
230
+ <li><a href="../../CORL/Provisioner.html">CORL::Provisioner</a>
231
+
232
+ <li><a href="../../CORL/Provisioner/Puppetnode.html">CORL::Provisioner::Puppetnode</a>
233
+
234
+ <li><a href="../../CORL/Template.html">CORL::Template</a>
235
+
236
+ <li><a href="../../CORL/Template/Environment.html">CORL::Template::Environment</a>
237
+
238
+ <li><a href="../../CORL/Util.html">CORL::Util</a>
239
+
240
+ <li><a href="../../CORL/Util/Puppet.html">CORL::Util::Puppet</a>
241
+
242
+ <li><a href="../../CORL/Util/Puppet/Resource.html">CORL::Util::Puppet::Resource</a>
243
+
244
+ <li><a href="../../CORL/Util/Puppet/ResourceGroup.html">CORL::Util::Puppet::ResourceGroup</a>
245
+
246
+ <li><a href="../../CORL/Vagrant.html">CORL::Vagrant</a>
247
+
248
+ <li><a href="../../CORL/Vagrant/Config.html">CORL::Vagrant::Config</a>
249
+
250
+ <li><a href="../../VagrantPlugins.html">VagrantPlugins</a>
251
+
252
+ <li><a href="../../VagrantPlugins/CORL.html">VagrantPlugins::CORL</a>
253
+
254
+ <li><a href="../../VagrantPlugins/CORL/Action.html">VagrantPlugins::CORL::Action</a>
255
+
256
+ <li><a href="../../VagrantPlugins/CORL/Action/DeleteCache.html">VagrantPlugins::CORL::Action::DeleteCache</a>
257
+
258
+ <li><a href="../../VagrantPlugins/CORL/Action/InitKeys.html">VagrantPlugins::CORL::Action::InitKeys</a>
259
+
260
+ <li><a href="../../VagrantPlugins/CORL/Action/LinkNetwork.html">VagrantPlugins::CORL::Action::LinkNetwork</a>
261
+
262
+ <li><a href="../../VagrantPlugins/CORL/BaseAction.html">VagrantPlugins::CORL::BaseAction</a>
263
+
264
+ <li><a href="../../VagrantPlugins/CORL/Command.html">VagrantPlugins::CORL::Command</a>
265
+
266
+ <li><a href="../../VagrantPlugins/CORL/Command/Launcher.html">VagrantPlugins::CORL::Command::Launcher</a>
267
+
268
+ <li><a href="../../VagrantPlugins/CORL/Config.html">VagrantPlugins::CORL::Config</a>
269
+
270
+ <li><a href="../../VagrantPlugins/CORL/Config/CORL.html">VagrantPlugins::CORL::Config::CORL</a>
271
+
272
+ <li><a href="../../VagrantPlugins/CORL/Plugin.html">VagrantPlugins::CORL::Plugin</a>
273
+
274
+ <li><a href="../../VagrantPlugins/CORL/Provisioner.html">VagrantPlugins::CORL::Provisioner</a>
275
+
276
+ <li><a href="../../VagrantPlugins/CORL/Provisioner/CORL.html">VagrantPlugins::CORL::Provisioner::CORL</a>
277
+
278
+ <li><a href="../../Nucleon.html">Nucleon</a>
279
+
280
+ <li><a href="../../Nucleon/Config.html">Nucleon::Config</a>
281
+
282
+ <li><a href="../../Nucleon/Plugin.html">Nucleon::Plugin</a>
283
+
284
+ <li><a href="../../Nucleon/Plugin/Base.html">Nucleon::Plugin::Base</a>
285
+
286
+ <li><a href="../../Nucleon/Plugin/Configuration.html">Nucleon::Plugin::Configuration</a>
287
+
288
+ <li><a href="../../Nucleon/Plugin/Machine.html">Nucleon::Plugin::Machine</a>
289
+
290
+ <li><a href="../../Nucleon/Plugin/Network.html">Nucleon::Plugin::Network</a>
291
+
292
+ <li><a href="../../Nucleon/Plugin/Node.html">Nucleon::Plugin::Node</a>
293
+
294
+ <li><a href="../../Nucleon/Plugin/Provisioner.html">Nucleon::Plugin::Provisioner</a>
295
+
296
+ <li><a href="../../Puppet.html">Puppet</a>
297
+
298
+ <li><a href="../../Puppet/DataBinding.html">Puppet::DataBinding</a>
299
+
300
+ <li><a href="../../Puppet/DataBinding/Corl.html">Puppet::DataBinding::Corl</a>
301
+
302
+ <li><a href="../../Puppet/Indirector.html">Puppet::Indirector</a>
303
+
304
+ <li><a href="../../Puppet/Indirector/Corl.html">Puppet::Indirector::Corl</a>
305
+
306
+ <li><a href="../../Puppet/Parser.html">Puppet::Parser</a>
307
+
308
+ <li><a href="../../Puppet/Parser/Functions.html">Puppet::Parser::Functions</a>
309
+
310
+ <li><a href="../../Fog.html">Fog</a>
311
+
312
+ <li><a href="../../Fog/Compute.html">Fog::Compute</a>
313
+
314
+ <li><a href="../../Fog/Compute/AWS.html">Fog::Compute::AWS</a>
315
+
316
+ <li><a href="../../Fog/Compute/AWS/Server.html">Fog::Compute::AWS::Server</a>
317
+
318
+ <li><a href="../../Fog/Compute/RackspaceV2.html">Fog::Compute::RackspaceV2</a>
319
+
320
+ <li><a href="../../Fog/Compute/RackspaceV2/Server.html">Fog::Compute::RackspaceV2::Server</a>
321
+
322
+ <li><a href="../../Vagrant.html">Vagrant</a>
323
+
324
+ <li><a href="../../Vagrant/Config.html">Vagrant::Config</a>
325
+
326
+ <li><a href="../../Vagrant/Config/Loader.html">Vagrant::Config::Loader</a>
327
+
328
+ <li><a href="../../Vagrant/Vagrantfile.html">Vagrant::Vagrantfile</a>
329
+
330
+ <li><a href="../../Facter.html">Facter</a>
331
+
332
+ <li><a href="../../Facter/Util.html">Facter::Util</a>
333
+
334
+ <li><a href="../../Facter/Util/Loader.html">Facter::Util::Loader</a>
335
+
336
+ <li><a href="../../Hiera.html">Hiera</a>
337
+
338
+ <li><a href="../../Hiera/Backend.html">Hiera::Backend</a>
339
+
340
+ <li><a href="../../Hiera/Corl_logger.html">Hiera::Corl_logger</a>
341
+
342
+ <li><a href="../../Object.html">Object</a>
343
+
344
+ </ul>
345
+ </nav>
346
+
347
+ </div>
348
+ </nav>
349
+
350
+ <div id="documentation">
351
+ <h1 class="class">class CORL::Configuration::File</h1>
352
+
353
+ <div id="description" class="description">
354
+
355
+ </div><!-- description -->
356
+
357
+
358
+
359
+
360
+ <section id="5Buntitled-5D" class="documentation-section">
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+ <!-- Methods -->
370
+
371
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
372
+ <h3 class="section-header">Public Instance Methods</h3>
373
+
374
+
375
+ <div id="method-i-attach" class="method-detail ">
376
+
377
+ <div class="method-heading">
378
+ <span class="method-name">attach</span><span
379
+ class="method-args">(type, name, data, options = {})</span>
380
+ <span class="method-click-advice">click to toggle source</span>
381
+ </div>
382
+
383
+
384
+ <div class="method-description">
385
+
386
+
387
+
388
+
389
+
390
+ <div class="method-source-code" id="attach-source">
391
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 229</span>
392
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">attach</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span> = {})
393
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_config</span><span class="ruby-operator">|</span>
394
+ <span class="ruby-identifier">attach_path</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">filename</span>([ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span> ])
395
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
396
+
397
+ <span class="ruby-keyword">begin</span>
398
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">attach_path</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">attach_path</span>)
399
+
400
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">error</span>
401
+ <span class="ruby-identifier">alert</span>(<span class="ruby-identifier">error</span>.<span class="ruby-identifier">message</span>)
402
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
403
+ <span class="ruby-keyword">end</span>
404
+
405
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span>
406
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">method_config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:type</span>, <span class="ruby-value">:source</span>)
407
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:source</span>
408
+ <span class="ruby-identifier">new_file</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">local_path</span>(<span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">filename</span>([ <span class="ruby-identifier">attach_path</span>, <span class="ruby-identifier">name</span> ]))
409
+
410
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Attaching source data (length: #{data.length}) to configuration at #{attach_path}&quot;</span>)
411
+ <span class="ruby-identifier">success</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">new_file</span>, <span class="ruby-identifier">data</span>)
412
+
413
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:file</span>
414
+ <span class="ruby-identifier">file</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">data</span>)
415
+ <span class="ruby-identifier">attach_ext</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file</span>)
416
+ <span class="ruby-identifier">new_file</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">local_path</span>(<span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">filename</span>([ <span class="ruby-identifier">attach_path</span>, <span class="ruby-node">&quot;#{name}-#{attach_ext}&quot;</span> ]))
417
+
418
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Attaching file #{file} to configuration at #{attach_path}&quot;</span>)
419
+
420
+ <span class="ruby-keyword">begin</span>
421
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">attach_path</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">attach_path</span>)
422
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">new_file</span>)
423
+
424
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">error</span>
425
+ <span class="ruby-identifier">alert</span>(<span class="ruby-identifier">error</span>.<span class="ruby-identifier">message</span>)
426
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
427
+ <span class="ruby-keyword">end</span>
428
+ <span class="ruby-keyword">end</span>
429
+ <span class="ruby-keyword">end</span>
430
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">autosave</span>
431
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Attaching data to project as #{new_file}&quot;</span>)
432
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">new_file</span>, <span class="ruby-identifier">method_config</span>)
433
+ <span class="ruby-keyword">end</span>
434
+ <span class="ruby-identifier">success</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">new_file</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
435
+ <span class="ruby-keyword">end</span>
436
+ <span class="ruby-keyword">end</span></pre>
437
+ </div><!-- attach-source -->
438
+
439
+ </div>
440
+
441
+
442
+
443
+
444
+ </div><!-- attach-method -->
445
+
446
+
447
+ <div id="method-i-delete_attachments" class="method-detail ">
448
+
449
+ <div class="method-heading">
450
+ <span class="method-name">delete_attachments</span><span
451
+ class="method-args">(ids, options = {})</span>
452
+ <span class="method-click-advice">click to toggle source</span>
453
+ </div>
454
+
455
+
456
+ <div class="method-description">
457
+
458
+
459
+
460
+
461
+
462
+ <div class="method-source-code" id="delete_attachments-source">
463
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 277</span>
464
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_attachments</span>(<span class="ruby-identifier">ids</span>, <span class="ruby-identifier">options</span> = {})
465
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_config</span><span class="ruby-operator">|</span>
466
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
467
+ <span class="ruby-identifier">files</span> = []
468
+
469
+ <span class="ruby-identifier">array</span>(<span class="ruby-identifier">ids</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
470
+ <span class="ruby-identifier">file</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>)
471
+
472
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file</span>)
473
+ <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span>
474
+ <span class="ruby-keyword">else</span>
475
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
476
+ <span class="ruby-keyword">end</span>
477
+ <span class="ruby-keyword">end</span>
478
+
479
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">autosave</span>
480
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Removing attached data from project as #{files.join(&#39;, &#39;)}&quot;</span>)
481
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">files</span>, <span class="ruby-identifier">method_config</span>)
482
+ <span class="ruby-keyword">end</span>
483
+ <span class="ruby-identifier">success</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">files</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
484
+ <span class="ruby-keyword">end</span>
485
+ <span class="ruby-keyword">end</span></pre>
486
+ </div><!-- delete_attachments-source -->
487
+
488
+ </div>
489
+
490
+
491
+
492
+
493
+ </div><!-- delete_attachments-method -->
494
+
495
+
496
+ <div id="method-i-load" class="method-detail ">
497
+
498
+ <div class="method-heading">
499
+ <span class="method-name">load</span><span
500
+ class="method-args">(options = {})</span>
501
+ <span class="method-click-advice">click to toggle source</span>
502
+ </div>
503
+
504
+
505
+ <div class="method-description">
506
+
507
+
508
+
509
+
510
+
511
+ <div class="method-source-code" id="load-source">
512
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 39</span>
513
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">options</span> = {})
514
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_config</span>, <span class="ruby-identifier">properties</span><span class="ruby-operator">|</span>
515
+
516
+ <span class="ruby-identifier">generate_routes</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">file_properties</span>, <span class="ruby-identifier">parents</span> = []<span class="ruby-operator">|</span>
517
+ <span class="ruby-identifier">file_properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
518
+ <span class="ruby-identifier">keys</span> = [ <span class="ruby-identifier">parents</span>, <span class="ruby-identifier">name</span> ].<span class="ruby-identifier">flatten</span>
519
+
520
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
521
+ <span class="ruby-identifier">generate_routes</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">keys</span>)
522
+ <span class="ruby-keyword">else</span>
523
+ <span class="ruby-identifier">router</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">keys</span>, <span class="ruby-identifier">config_name</span>)
524
+ <span class="ruby-keyword">end</span>
525
+ <span class="ruby-keyword">end</span>
526
+ <span class="ruby-keyword">end</span>
527
+
528
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">fetch_project</span>(<span class="ruby-identifier">method_config</span>)
529
+ <span class="ruby-identifier">search</span>.<span class="ruby-identifier">export</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
530
+ <span class="ruby-identifier">provider</span> = <span class="ruby-identifier">info</span>[<span class="ruby-value">:provider</span>]
531
+ <span class="ruby-identifier">file</span> = <span class="ruby-identifier">info</span>[<span class="ruby-value">:file</span>]
532
+
533
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Loading #{provider} translated source configuration from #{file}&quot;</span>)
534
+
535
+ <span class="ruby-identifier">parser</span> = <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">translator</span>(<span class="ruby-identifier">method_config</span>, <span class="ruby-identifier">provider</span>)
536
+ <span class="ruby-identifier">raw</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
537
+
538
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">parser</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">raw</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">empty?</span>
539
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Source configuration file contents: #{raw}&quot;</span>)
540
+ <span class="ruby-identifier">parse_properties</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">raw</span>)
541
+
542
+ <span class="ruby-identifier">generate_routes</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">parse_properties</span>)
543
+ <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">import</span>(<span class="ruby-identifier">parse_properties</span>)
544
+ <span class="ruby-keyword">end</span>
545
+ <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">remove_plugin</span>(<span class="ruby-identifier">parser</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">parser</span>
546
+ <span class="ruby-keyword">end</span>
547
+ <span class="ruby-keyword">end</span>
548
+ <span class="ruby-keyword">end</span>
549
+ <span class="ruby-keyword">end</span></pre>
550
+ </div><!-- load-source -->
551
+
552
+ </div>
553
+
554
+
555
+
556
+
557
+ </div><!-- load-method -->
558
+
559
+
560
+ <div id="method-i-normalize" class="method-detail ">
561
+
562
+ <div class="method-heading">
563
+ <span class="method-name">normalize</span><span
564
+ class="method-args">(reload)</span>
565
+ <span class="method-click-advice">click to toggle source</span>
566
+ </div>
567
+
568
+
569
+ <div class="method-description">
570
+
571
+
572
+
573
+
574
+
575
+ <div class="method-source-code" id="normalize-source">
576
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 9</span>
577
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">normalize</span>(<span class="ruby-identifier">reload</span>)
578
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span>
579
+ <span class="ruby-identifier">_set</span>(<span class="ruby-value">:search</span>, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>)
580
+ <span class="ruby-identifier">_set</span>(<span class="ruby-value">:router</span>, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>)
581
+ <span class="ruby-keyword">end</span>
582
+ <span class="ruby-keyword">end</span></pre>
583
+ </div><!-- normalize-source -->
584
+
585
+ </div>
586
+
587
+
588
+
589
+
590
+ </div><!-- normalize-method -->
591
+
592
+
593
+ <div id="method-i-remove" class="method-detail ">
594
+
595
+ <div class="method-heading">
596
+ <span class="method-name">remove</span><span
597
+ class="method-args">(options = {})</span>
598
+ <span class="method-click-advice">click to toggle source</span>
599
+ </div>
600
+
601
+
602
+ <div class="method-description">
603
+
604
+
605
+
606
+
607
+
608
+ <div class="method-source-code" id="remove-source">
609
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 214</span>
610
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">options</span> = {})
611
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_config</span><span class="ruby-operator">|</span>
612
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
613
+ <span class="ruby-identifier">config_files</span> = []
614
+ <span class="ruby-identifier">search</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
615
+ <span class="ruby-identifier">config_files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">:file</span>]
616
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">:file</span>])
617
+ <span class="ruby-keyword">end</span>
618
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">config_files</span>, <span class="ruby-identifier">method_config</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span>
619
+ <span class="ruby-identifier">success</span>
620
+ <span class="ruby-keyword">end</span>
621
+ <span class="ruby-keyword">end</span></pre>
622
+ </div><!-- remove-source -->
623
+
624
+ </div>
625
+
626
+
627
+
628
+
629
+ </div><!-- remove-method -->
630
+
631
+
632
+ <div id="method-i-router" class="method-detail ">
633
+
634
+ <div class="method-heading">
635
+ <span class="method-name">router</span><span
636
+ class="method-args">()</span>
637
+ <span class="method-click-advice">click to toggle source</span>
638
+ </div>
639
+
640
+
641
+ <div class="method-description">
642
+
643
+
644
+
645
+
646
+
647
+ <div class="method-source-code" id="router-source">
648
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 25</span>
649
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">router</span>
650
+ <span class="ruby-identifier">_get</span>(<span class="ruby-value">:router</span>)
651
+ <span class="ruby-keyword">end</span></pre>
652
+ </div><!-- router-source -->
653
+
654
+ </div>
655
+
656
+
657
+
658
+
659
+ </div><!-- router-method -->
660
+
661
+
662
+ <div id="method-i-save" class="method-detail ">
663
+
664
+ <div class="method-heading">
665
+ <span class="method-name">save</span><span
666
+ class="method-args">(options = {})</span>
667
+ <span class="method-click-advice">click to toggle source</span>
668
+ </div>
669
+
670
+
671
+ <div class="method-description">
672
+
673
+
674
+
675
+
676
+
677
+ <div class="method-source-code" id="save-source">
678
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 161</span>
679
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">options</span> = {})
680
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_config</span><span class="ruby-operator">|</span>
681
+ <span class="ruby-identifier">config_files</span> = []
682
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
683
+ <span class="ruby-identifier">deleted_keys</span> = <span class="ruby-identifier">search</span>.<span class="ruby-identifier">export</span>.<span class="ruby-identifier">keys</span>
684
+
685
+ <span class="ruby-identifier">separate</span>.<span class="ruby-identifier">export</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">router_data</span><span class="ruby-operator">|</span>
686
+ <span class="ruby-identifier">info</span> = <span class="ruby-identifier">search</span>[<span class="ruby-identifier">config_name</span>]
687
+ <span class="ruby-identifier">provider</span> = <span class="ruby-identifier">info</span>[<span class="ruby-value">:provider</span>]
688
+ <span class="ruby-identifier">file</span> = <span class="ruby-identifier">info</span>[<span class="ruby-value">:file</span>]
689
+ <span class="ruby-identifier">file_dir</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>)
690
+ <span class="ruby-identifier">deleted_keys</span> = <span class="ruby-identifier">deleted_keys</span> <span class="ruby-operator">-</span> [ <span class="ruby-identifier">config_name</span> ]
691
+
692
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">file_dir</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_dir</span>)
693
+
694
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">renderer</span> = <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">translator</span>(<span class="ruby-identifier">method_config</span>, <span class="ruby-identifier">provider</span>)
695
+ <span class="ruby-identifier">rendering</span> = <span class="ruby-identifier">renderer</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">router_data</span>)
696
+
697
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">rendering</span>)
698
+ <span class="ruby-identifier">config_files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">config_name</span>
699
+ <span class="ruby-keyword">else</span>
700
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
701
+ <span class="ruby-keyword">end</span>
702
+ <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">remove_plugin</span>(<span class="ruby-identifier">renderer</span>)
703
+ <span class="ruby-keyword">else</span>
704
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
705
+ <span class="ruby-keyword">end</span>
706
+ <span class="ruby-keyword">break</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">success</span>
707
+ <span class="ruby-keyword">end</span>
708
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span>
709
+ <span class="ruby-comment"># Check for removals</span>
710
+ <span class="ruby-identifier">deleted_keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span><span class="ruby-operator">|</span>
711
+ <span class="ruby-identifier">info</span> = <span class="ruby-identifier">search</span>[<span class="ruby-identifier">config_name</span>]
712
+
713
+ <span class="ruby-identifier">search</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">config_name</span>)
714
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_f</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">:file</span>])
715
+
716
+ <span class="ruby-identifier">config_files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">config_name</span>
717
+ <span class="ruby-keyword">end</span>
718
+ <span class="ruby-keyword">end</span>
719
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">config_files</span>.<span class="ruby-identifier">empty?</span>
720
+ <span class="ruby-comment"># Commit changes</span>
721
+ <span class="ruby-identifier">commit_files</span> = [ <span class="ruby-identifier">config_files</span>, <span class="ruby-identifier">method_config</span>.<span class="ruby-identifier">get_array</span>(<span class="ruby-value">:files</span>) ].<span class="ruby-identifier">flatten</span>
722
+
723
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Source configuration rendering: #{rendering}&quot;</span>)
724
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">commit_files</span>, <span class="ruby-identifier">method_config</span>)
725
+ <span class="ruby-keyword">end</span>
726
+ <span class="ruby-identifier">success</span>
727
+ <span class="ruby-keyword">end</span>
728
+ <span class="ruby-keyword">end</span></pre>
729
+ </div><!-- save-source -->
730
+
731
+ </div>
732
+
733
+
734
+
735
+
736
+ </div><!-- save-method -->
737
+
738
+
739
+ <div id="method-i-search" class="method-detail ">
740
+
741
+ <div class="method-heading">
742
+ <span class="method-name">search</span><span
743
+ class="method-args">()</span>
744
+ <span class="method-click-advice">click to toggle source</span>
745
+ </div>
746
+
747
+
748
+ <div class="method-description">
749
+
750
+
751
+
752
+
753
+
754
+ <div class="method-source-code" id="search-source">
755
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 19</span>
756
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">search</span>
757
+ <span class="ruby-identifier">_get</span>(<span class="ruby-value">:search</span>)
758
+ <span class="ruby-keyword">end</span></pre>
759
+ </div><!-- search-source -->
760
+
761
+ </div>
762
+
763
+
764
+
765
+
766
+ </div><!-- search-method -->
767
+
768
+
769
+ <div id="method-i-set_location" class="method-detail ">
770
+
771
+ <div class="method-heading">
772
+ <span class="method-name">set_location</span><span
773
+ class="method-args">(directory)</span>
774
+ <span class="method-click-advice">click to toggle source</span>
775
+ </div>
776
+
777
+
778
+ <div class="method-description">
779
+
780
+
781
+
782
+
783
+
784
+ <div class="method-source-code" id="set_location-source">
785
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 31</span>
786
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">set_location</span>(<span class="ruby-identifier">directory</span>)
787
+ <span class="ruby-keyword">super</span>
788
+ <span class="ruby-identifier">search_files</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">directory</span>
789
+ <span class="ruby-keyword">end</span></pre>
790
+ </div><!-- set_location-source -->
791
+
792
+ </div>
793
+
794
+
795
+
796
+
797
+ </div><!-- set_location-method -->
798
+
799
+
800
+ </section><!-- public-instance-method-details -->
801
+
802
+ <section id="protected-instance-5Buntitled-5D-method-details" class="method-section section">
803
+ <h3 class="section-header">Protected Instance Methods</h3>
804
+
805
+
806
+ <div id="method-i-fetch_project" class="method-detail ">
807
+
808
+ <div class="method-heading">
809
+ <span class="method-name">fetch_project</span><span
810
+ class="method-args">(options = {})</span>
811
+ <span class="method-click-advice">click to toggle source</span>
812
+ </div>
813
+
814
+
815
+ <div class="method-description">
816
+
817
+
818
+
819
+
820
+
821
+ <div class="method-source-code" id="fetch_project-source">
822
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 351</span>
823
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_project</span>(<span class="ruby-identifier">options</span> = {})
824
+ <span class="ruby-identifier">config</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">ensure</span>(<span class="ruby-identifier">options</span>)
825
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
826
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">remote</span> = <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:remote</span>, <span class="ruby-keyword">nil</span>)
827
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Pulling configuration updates from remote #{remote}&quot;</span>)
828
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">pull</span>(<span class="ruby-identifier">remote</span>, <span class="ruby-identifier">config</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:pull</span>, <span class="ruby-keyword">true</span>)
829
+ <span class="ruby-keyword">end</span>
830
+ <span class="ruby-identifier">success</span>
831
+ <span class="ruby-keyword">end</span></pre>
832
+ </div><!-- fetch_project-source -->
833
+
834
+ </div>
835
+
836
+
837
+
838
+
839
+ </div><!-- fetch_project-method -->
840
+
841
+
842
+ <div id="method-i-search_files" class="method-detail ">
843
+
844
+ <div class="method-heading">
845
+ <span class="method-name">search_files</span><span
846
+ class="method-args">()</span>
847
+ <span class="method-click-advice">click to toggle source</span>
848
+ </div>
849
+
850
+
851
+ <div class="method-description">
852
+
853
+
854
+
855
+
856
+
857
+ <div class="method-source-code" id="search_files-source">
858
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 303</span>
859
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">search_files</span>
860
+
861
+ <span class="ruby-identifier">add_search_file</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">provider</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
862
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file</span>)
863
+ <span class="ruby-identifier">search</span>[<span class="ruby-identifier">config_name</span>] = {
864
+ <span class="ruby-value">:provider</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">provider</span>,
865
+ <span class="ruby-value">:info</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">info</span>,
866
+ <span class="ruby-value">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">file</span>
867
+ }
868
+ <span class="ruby-keyword">else</span>
869
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Configuration file #{file} does not exist&quot;</span>)
870
+ <span class="ruby-keyword">end</span>
871
+ <span class="ruby-keyword">end</span>
872
+
873
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span>.<span class="ruby-identifier">empty?</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>)
874
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-string">&quot;Clearing configuration file information&quot;</span>)
875
+ <span class="ruby-identifier">search</span>.<span class="ruby-identifier">clear</span>
876
+ <span class="ruby-keyword">else</span>
877
+ <span class="ruby-identifier">translators</span> = <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">loaded_plugins</span>(<span class="ruby-value">:translator</span>)
878
+ <span class="ruby-identifier">file_bases</span> = [ <span class="ruby-string">&quot;corl&quot;</span>, <span class="ruby-identifier">extension_collect</span>(<span class="ruby-value">:base</span>) ].<span class="ruby-identifier">flatten</span>
879
+
880
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">localize</span> <span class="ruby-keyword">do</span>
881
+ <span class="ruby-identifier">translators</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">provider</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
882
+ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;nodes&#39;</span>, <span class="ruby-string">&#39;**&#39;</span>, <span class="ruby-node">&quot;*.#{provider}&quot;</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
883
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-identifier">file</span>
884
+ <span class="ruby-identifier">file</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">file</span>)
885
+
886
+ <span class="ruby-identifier">add_search_file</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">provider</span>, <span class="ruby-identifier">info</span>)
887
+ <span class="ruby-keyword">end</span>
888
+ <span class="ruby-keyword">end</span>
889
+ <span class="ruby-keyword">end</span>
890
+
891
+ <span class="ruby-identifier">translators</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">provider</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
892
+ <span class="ruby-identifier">file_bases</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_base</span><span class="ruby-operator">|</span>
893
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-node">&quot;#{file_base}.#{provider}&quot;</span>
894
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Disk</span>.<span class="ruby-identifier">filename</span>([ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">config_name</span> ])
895
+
896
+ <span class="ruby-identifier">add_search_file</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">provider</span>, <span class="ruby-identifier">info</span>)
897
+ <span class="ruby-keyword">end</span>
898
+ <span class="ruby-keyword">end</span>
899
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Setting configuration file information to #{search.inspect}&quot;</span>)
900
+ <span class="ruby-keyword">end</span>
901
+ <span class="ruby-identifier">load</span>(<span class="ruby-identifier">_export</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">autoload</span>
902
+ <span class="ruby-keyword">end</span></pre>
903
+ </div><!-- search_files-source -->
904
+
905
+ </div>
906
+
907
+
908
+
909
+
910
+ </div><!-- search_files-method -->
911
+
912
+
913
+ <div id="method-i-select_largest" class="method-detail ">
914
+
915
+ <div class="method-heading">
916
+ <span class="method-name">select_largest</span><span
917
+ class="method-args">(router)</span>
918
+ <span class="method-click-advice">click to toggle source</span>
919
+ </div>
920
+
921
+
922
+ <div class="method-description">
923
+
924
+
925
+
926
+
927
+
928
+ <div class="method-source-code" id="select_largest-source">
929
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 385</span>
930
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">select_largest</span>(<span class="ruby-identifier">router</span>)
931
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">router</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">router</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
932
+
933
+ <span class="ruby-identifier">config_map</span> = {}
934
+
935
+ <span class="ruby-identifier">count_config_names</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
936
+ <span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">export</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">CORL</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>)
937
+ <span class="ruby-identifier">data</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
938
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
939
+ <span class="ruby-identifier">count_config_names</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>)
940
+ <span class="ruby-keyword">else</span>
941
+ <span class="ruby-identifier">config_map</span>[<span class="ruby-identifier">value</span>] = <span class="ruby-value">0</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">config_map</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">value</span>)
942
+ <span class="ruby-identifier">config_map</span>[<span class="ruby-identifier">value</span>] = <span class="ruby-identifier">config_map</span>[<span class="ruby-identifier">value</span>] <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
943
+ <span class="ruby-keyword">end</span>
944
+ <span class="ruby-keyword">end</span>
945
+ <span class="ruby-keyword">end</span>
946
+
947
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-keyword">nil</span>
948
+ <span class="ruby-identifier">config_weight</span> = <span class="ruby-keyword">nil</span>
949
+
950
+ <span class="ruby-identifier">count_config_names</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">router</span>)
951
+ <span class="ruby-identifier">config_map</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">weight</span><span class="ruby-operator">|</span>
952
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">config_name</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">weight</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">config_weight</span>
953
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-identifier">name</span>
954
+ <span class="ruby-identifier">config_weight</span> = <span class="ruby-identifier">weight</span>
955
+ <span class="ruby-keyword">end</span>
956
+ <span class="ruby-keyword">end</span>
957
+ <span class="ruby-identifier">config_name</span>
958
+ <span class="ruby-keyword">end</span></pre>
959
+ </div><!-- select_largest-source -->
960
+
961
+ </div>
962
+
963
+
964
+
965
+
966
+ </div><!-- select_largest-method -->
967
+
968
+
969
+ <div id="method-i-separate" class="method-detail ">
970
+
971
+ <div class="method-heading">
972
+ <span class="method-name">separate</span><span
973
+ class="method-args">()</span>
974
+ <span class="method-click-advice">click to toggle source</span>
975
+ </div>
976
+
977
+
978
+ <div class="method-description">
979
+
980
+ <p><a href="http://key...">properties</a> = values</p>
981
+
982
+ <p>to</p>
983
+
984
+ <p><a href="http://config_name">file_data</a>[key…] = config</p>
985
+
986
+
987
+
988
+ <div class="method-source-code" id="separate-source">
989
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 85</span>
990
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">separate</span>
991
+ <span class="ruby-identifier">file_data</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>
992
+ <span class="ruby-identifier">default_provider</span> = <span class="ruby-constant">CORL</span>.<span class="ruby-identifier">type_default</span>(<span class="ruby-value">:translator</span>)
993
+
994
+ <span class="ruby-identifier">split_config</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">properties</span>, <span class="ruby-identifier">local_router</span>, <span class="ruby-identifier">parents</span> = []<span class="ruby-operator">|</span>
995
+ <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
996
+ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-value">:nodes</span>
997
+
998
+ <span class="ruby-identifier">keys</span> = [ <span class="ruby-identifier">parents</span>, <span class="ruby-identifier">name</span> ].<span class="ruby-identifier">flatten</span>
999
+
1000
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
1001
+ <span class="ruby-comment"># Nested configurations</span>
1002
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">local_router</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">local_router</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
1003
+ <span class="ruby-comment"># Router and configuration values are nested</span>
1004
+ <span class="ruby-identifier">split_config</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">local_router</span>[<span class="ruby-identifier">name</span>], <span class="ruby-identifier">keys</span>)
1005
+ <span class="ruby-keyword">else</span>
1006
+ <span class="ruby-comment"># Just configuration values are nested</span>
1007
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">local_router</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
1008
+ <span class="ruby-comment"># We are down to a config_name router. Inherit on down the line</span>
1009
+ <span class="ruby-identifier">split_config</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">local_router</span>, <span class="ruby-identifier">keys</span>)
1010
+ <span class="ruby-keyword">else</span>
1011
+ <span class="ruby-comment"># Never encountered before</span>
1012
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-keyword">nil</span>
1013
+
1014
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-identifier">select_largest</span>(<span class="ruby-identifier">router</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">parents</span>)) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">empty?</span>
1015
+ <span class="ruby-identifier">split_config</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">keys</span>)
1016
+ <span class="ruby-keyword">end</span>
1017
+ <span class="ruby-keyword">end</span>
1018
+ <span class="ruby-keyword">else</span>
1019
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">local_router</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
1020
+ <span class="ruby-comment"># Router is a config_name string</span>
1021
+ <span class="ruby-identifier">file_data</span>.<span class="ruby-identifier">set</span>([ <span class="ruby-identifier">local_router</span>, <span class="ruby-identifier">keys</span> ].<span class="ruby-identifier">flatten</span>, <span class="ruby-identifier">value</span>)
1022
+
1023
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">local_router</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
1024
+ <span class="ruby-comment"># Router is a hash with sub options we have to pick from</span>
1025
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-identifier">select_largest</span>(<span class="ruby-identifier">local_router</span>)
1026
+ <span class="ruby-identifier">file_data</span>.<span class="ruby-identifier">set</span>([ <span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">keys</span> ].<span class="ruby-identifier">flatten</span>, <span class="ruby-identifier">value</span>)
1027
+ <span class="ruby-keyword">else</span>
1028
+ <span class="ruby-comment"># Router is non existent</span>
1029
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">config_name</span> = <span class="ruby-identifier">select_largest</span>(<span class="ruby-identifier">router</span>.<span class="ruby-identifier">export</span>)
1030
+ <span class="ruby-comment"># Pick largest router from top level</span>
1031
+ <span class="ruby-identifier">file_data</span>.<span class="ruby-identifier">set</span>([ <span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">keys</span> ].<span class="ruby-identifier">flatten</span>, <span class="ruby-identifier">value</span>)
1032
+ <span class="ruby-keyword">else</span>
1033
+ <span class="ruby-comment"># Resort to sane defaults</span>
1034
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-node">&quot;corl.#{default_provider}&quot;</span>
1035
+ <span class="ruby-identifier">file_data</span>.<span class="ruby-identifier">set</span>([ <span class="ruby-identifier">config_name</span>, <span class="ruby-identifier">keys</span> ].<span class="ruby-identifier">flatten</span>, <span class="ruby-identifier">value</span>)
1036
+ <span class="ruby-keyword">end</span>
1037
+ <span class="ruby-keyword">end</span>
1038
+ <span class="ruby-keyword">end</span>
1039
+ <span class="ruby-keyword">end</span>
1040
+ <span class="ruby-keyword">end</span>
1041
+
1042
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:nodes</span>, <span class="ruby-keyword">false</span>)
1043
+ <span class="ruby-identifier">config</span>[<span class="ruby-value">:nodes</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">provider</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
1044
+ <span class="ruby-identifier">data</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
1045
+ <span class="ruby-identifier">config_name</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;nodes&#39;</span>, <span class="ruby-identifier">provider</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-node">&quot;#{name}.#{default_provider}&quot;</span>)
1046
+ <span class="ruby-identifier">file_data</span>.<span class="ruby-identifier">set</span>([ <span class="ruby-identifier">config_name</span>, <span class="ruby-value">:nodes</span>, <span class="ruby-identifier">provider</span>, <span class="ruby-identifier">name</span> ], <span class="ruby-identifier">info</span>)
1047
+
1048
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">search</span>[<span class="ruby-identifier">config_name</span>]
1049
+ <span class="ruby-identifier">search</span>[<span class="ruby-identifier">config_name</span>] = {
1050
+ <span class="ruby-value">:provider</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">default_provider</span>,
1051
+ <span class="ruby-value">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">config_name</span>)
1052
+ }
1053
+ <span class="ruby-keyword">end</span>
1054
+ <span class="ruby-keyword">end</span>
1055
+ <span class="ruby-keyword">end</span>
1056
+ <span class="ruby-keyword">end</span>
1057
+
1058
+ <span class="ruby-comment"># Whew! Glad that&#39;s over...</span>
1059
+ <span class="ruby-identifier">split_config</span>.<span class="ruby-identifier">call</span>(<span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span>.<span class="ruby-identifier">subset</span>(<span class="ruby-identifier">config</span>.<span class="ruby-identifier">export</span>, <span class="ruby-identifier">config</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> [ <span class="ruby-value">:nodes</span> ]), <span class="ruby-identifier">router</span>.<span class="ruby-identifier">export</span>)
1060
+ <span class="ruby-identifier">file_data</span>
1061
+ <span class="ruby-keyword">end</span></pre>
1062
+ </div><!-- separate-source -->
1063
+
1064
+ </div>
1065
+
1066
+
1067
+
1068
+
1069
+ </div><!-- separate-method -->
1070
+
1071
+
1072
+ <div id="method-i-update_project" class="method-detail ">
1073
+
1074
+ <div class="method-heading">
1075
+ <span class="method-name">update_project</span><span
1076
+ class="method-args">(files = [], options = {})</span>
1077
+ <span class="method-click-advice">click to toggle source</span>
1078
+ </div>
1079
+
1080
+
1081
+ <div class="method-description">
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+ <div class="method-source-code" id="update_project-source">
1088
+ <pre><span class="ruby-comment"># File lib/CORL/configuration/file.rb, line 364</span>
1089
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">files</span> = [], <span class="ruby-identifier">options</span> = {})
1090
+ <span class="ruby-identifier">config</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">ensure</span>(<span class="ruby-identifier">options</span>)
1091
+ <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
1092
+
1093
+ <span class="ruby-identifier">commit_files</span> = <span class="ruby-string">&#39;.&#39;</span>
1094
+ <span class="ruby-identifier">commit_files</span> = <span class="ruby-identifier">array</span>(<span class="ruby-identifier">files</span>).<span class="ruby-identifier">flatten</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">files</span>.<span class="ruby-identifier">empty?</span>
1095
+
1096
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-string">&quot;Committing changes to configuration files&quot;</span>)
1097
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">commit_files</span>, <span class="ruby-identifier">config</span>)
1098
+
1099
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">remote</span> = <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:remote</span>, <span class="ruby-keyword">nil</span>)
1100
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Pushing configuration updates to remote #{remote}&quot;</span>)
1101
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">pull</span>(<span class="ruby-identifier">remote</span>, <span class="ruby-identifier">config</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:pull</span>, <span class="ruby-keyword">true</span>)
1102
+ <span class="ruby-identifier">success</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">remote</span>, <span class="ruby-identifier">config</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">get</span>(<span class="ruby-value">:push</span>, <span class="ruby-keyword">true</span>)
1103
+ <span class="ruby-keyword">end</span>
1104
+ <span class="ruby-identifier">success</span>
1105
+ <span class="ruby-keyword">end</span></pre>
1106
+ </div><!-- update_project-source -->
1107
+
1108
+ </div>
1109
+
1110
+
1111
+
1112
+
1113
+ </div><!-- update_project-method -->
1114
+
1115
+
1116
+ </section><!-- protected-instance-method-details -->
1117
+
1118
+ </section><!-- 5Buntitled-5D -->
1119
+
1120
+ </div><!-- documentation -->
1121
+
1122
+
1123
+ <footer id="validator-badges">
1124
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
1125
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
1126
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
1127
+ </footer>
1128
+