bunchr 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README.md +148 -116
  2. data/bunchr.gemspec +1 -1
  3. data/lib/bunchr/version.rb +1 -1
  4. data/lib/bunchr.rb +2 -0
  5. data/pkg/bunchr-0.1.1/README.md +355 -0
  6. data/pkg/bunchr-0.1.1/Rakefile +9 -0
  7. data/pkg/bunchr-0.1.1/TODO +7 -0
  8. data/pkg/bunchr-0.1.1/bunchr.gemspec +34 -0
  9. data/pkg/bunchr-0.1.1/doc/Bunchr/Logger.html +201 -0
  10. data/pkg/bunchr-0.1.1/doc/Bunchr/Ohai.html +201 -0
  11. data/pkg/bunchr-0.1.1/doc/Bunchr/Packages.html +1840 -0
  12. data/pkg/bunchr-0.1.1/doc/Bunchr/Software.html +1727 -0
  13. data/pkg/bunchr-0.1.1/doc/Bunchr/Utils.html +334 -0
  14. data/pkg/bunchr-0.1.1/doc/Bunchr.html +124 -0
  15. data/pkg/bunchr-0.1.1/doc/_index.html +181 -0
  16. data/pkg/bunchr-0.1.1/doc/class_list.html +47 -0
  17. data/pkg/bunchr-0.1.1/doc/css/common.css +1 -0
  18. data/pkg/bunchr-0.1.1/doc/css/full_list.css +55 -0
  19. data/pkg/bunchr-0.1.1/doc/css/style.css +322 -0
  20. data/pkg/bunchr-0.1.1/doc/file.README.html +376 -0
  21. data/pkg/bunchr-0.1.1/doc/file_list.html +49 -0
  22. data/pkg/bunchr-0.1.1/doc/frames.html +13 -0
  23. data/pkg/bunchr-0.1.1/doc/index.html +376 -0
  24. data/pkg/bunchr-0.1.1/doc/js/app.js +205 -0
  25. data/pkg/bunchr-0.1.1/doc/js/full_list.js +173 -0
  26. data/pkg/bunchr-0.1.1/doc/js/jquery.js +16 -0
  27. data/pkg/bunchr-0.1.1/doc/method_list.html +438 -0
  28. data/pkg/bunchr-0.1.1/doc/top-level-namespace.html +105 -0
  29. data/pkg/bunchr-0.1.1/example_recipes/autoconf.rake +18 -0
  30. data/pkg/bunchr-0.1.1/example_recipes/libyaml.rake +18 -0
  31. data/pkg/bunchr-0.1.1/example_recipes/openssl.rake +54 -0
  32. data/pkg/bunchr-0.1.1/example_recipes/ruby.rake +38 -0
  33. data/pkg/bunchr-0.1.1/example_recipes/sensu.rake +18 -0
  34. data/pkg/bunchr-0.1.1/example_recipes/sensu_bin_stubs.rake +17 -0
  35. data/pkg/bunchr-0.1.1/example_recipes/sensu_configs.rake +30 -0
  36. data/pkg/bunchr-0.1.1/example_recipes/sensu_dashboard.rake +17 -0
  37. data/pkg/bunchr-0.1.1/example_recipes/zlib.rake +32 -0
  38. data/pkg/bunchr-0.1.1/lib/bunchr/logger.rb +18 -0
  39. data/pkg/bunchr-0.1.1/lib/bunchr/ohai.rb +18 -0
  40. data/pkg/bunchr-0.1.1/lib/bunchr/packages.rb +176 -0
  41. data/pkg/bunchr-0.1.1/lib/bunchr/software.rb +164 -0
  42. data/pkg/bunchr-0.1.1/lib/bunchr/utils.rb +36 -0
  43. data/pkg/bunchr-0.1.1/lib/bunchr/version.rb +3 -0
  44. data/pkg/bunchr-0.1.1/lib/bunchr.rb +44 -0
  45. data/pkg/bunchr-0.1.1.gem +0 -0
  46. metadata +123 -62
@@ -0,0 +1,376 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.7.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: README</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'><h1>Bunchr</h1>
58
+
59
+ <h2>Overview</h2>
60
+
61
+ <p>Bunchr is a Rake/Ruby-based DSL for building and bundling complex software
62
+ projects into various package formats, ie: RPM, DEB, etc (packaging performed
63
+ by <a href="https://github.com/jordansissel/fpm">fpm</a>.</p>
64
+
65
+ <p>Originally developed to create &quot;omnibus&quot; style packages that include an entire
66
+ ruby stack along with one or more gems, but useful for general compilation and
67
+ packaging as well.</p>
68
+
69
+ <p>It is typically intended to be used in conjunction with <a href="http://vagrantup.com">Vagrant</a>
70
+ but can be used without Vagrant as well.</p>
71
+
72
+ <h2>History</h2>
73
+
74
+ <p>Bunchr was conceived as a tool to help the <a href="https://github.com/sensu">Sensu</a>
75
+ monitoring project find a better way to create packages that would be as
76
+ easy as possible to deploy on a variety of platforms with minimal friction and
77
+ with little or no knowledge about the idiosyncrasies of the Ruby universe
78
+ (version incompatibilities, gem conflicts, etc). This was particularly desirable
79
+ for Sensu because one of the components is an agent that will be installed
80
+ on most or all servers in an infrastructure. Thus, the package should be easy
81
+ to install and should not interfere with any other Ruby apps or scripts on the
82
+ server.</p>
83
+
84
+ <p>About the time the Sensu project was discussing a new packaging approach,
85
+ (Adam Jacob) from <a href="http://opscode.com/">Opscode/Chef</a> took notice and suggested
86
+ a slightly different approach that achieved the same goals. The approach was
87
+ called &#39;omnibus&#39; and was already in use at Opscode to produce a simple and
88
+ uniform installer for Chef.</p>
89
+
90
+ <p>Opscode was using a Clojure-based tool at the time called <a href="https://github.com/opscode/omnibus">omnibus</a>
91
+ and were working on a Ruby-based version of omnibus as well.</p>
92
+
93
+ <p>However, the Ruby based Omnibus was not available at the time, so Bunchr was
94
+ created and it re-implements many of the concepts of the Clojure-based Omnibus
95
+ but on top of Ruby / Rake with a few differences.</p>
96
+
97
+ <h2>Installation</h2>
98
+
99
+ <pre class="code ruby"><code><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_bunchr'>bunchr</span>
100
+ </code></pre>
101
+
102
+ <h2>DSL Overview</h2>
103
+
104
+ <p>A typical Bunchr project is comprised of one or more <code>Bunchr::Software</code> objects
105
+ and a single <code>Bunchr::Packages</code> object. Define these all in a <code>Rakefile</code> or
106
+ separate them into files.</p>
107
+
108
+ <p><code>Software</code> objects are responsible for downloading, building, and installing
109
+ a single software component, such as <code>zlib</code> or <code>ruby</code>. <code>Software</code> objects
110
+ support platform-specific compilation options by making Ohai data available
111
+ for decision making.</p>
112
+
113
+ <p><code>Packages</code> objects are used to combine <code>Software</code> objects into a single package.
114
+ It will automatically try to generate any packages supported by the current
115
+ platform, for example, RPMs will be built if the platform supports it, DEB
116
+ will be built if the platform supports it.</p>
117
+
118
+ <p>The goal is to be able to use a single code base to build <em>and</em> package a
119
+ project on multiple platforms.</p>
120
+
121
+ <p>Currently supported package types:</p>
122
+
123
+ <ul>
124
+ <li>tar.gz</li>
125
+ <li>.deb</li>
126
+ <li>.rpm</li>
127
+ </ul>
128
+
129
+ <h3>Software DSL</h3>
130
+
131
+ <ul>
132
+ <li>Example software recipes: <a href="https://github.com/joemiller/bunchr/tree/master/example_recipes">https://github.com/joemiller/bunchr/tree/master/example_recipes</a></li>
133
+ </ul>
134
+
135
+ <p>Example recipe for building and installing <code>ruby</code>:</p>
136
+
137
+ <pre class="code ruby"><code><span class='const'>Bunchr</span><span class='op'>::</span><span class='const'>Software</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
138
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ruby</span><span class='tstring_end'>'</span></span>
139
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.9.3-p125</span><span class='tstring_end'>'</span></span>
140
+
141
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_depends_on'>depends_on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>autoconf</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
142
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_depends_on'>depends_on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>zlib</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
143
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_depends_on'>depends_on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>openssl</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
144
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_depends_on'>depends_on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>libyaml</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
145
+
146
+ <span class='id identifier rubyid_install_prefix'>install_prefix</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Bunchr</span><span class='period'>.</span><span class='id identifier rubyid_install_dir'>install_dir</span><span class='rbrace'>}</span><span class='tstring_content'>/embedded</span><span class='tstring_end'>&quot;</span></span>
147
+
148
+ <span class='id identifier rubyid_os'>os</span> <span class='op'>=</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_ohai'>ohai</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>os</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
149
+ <span class='id identifier rubyid_arch'>arch</span> <span class='op'>=</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_ohai'>ohai</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>kernel</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>machine</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
150
+
151
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_download_commands'>download_commands</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz</span><span class='tstring_end'>&quot;</span></span>
152
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_download_commands'>download_commands</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>tar xfvz ruby-1.9.3-p125.tar.gz</span><span class='tstring_end'>&quot;</span></span>
153
+
154
+ <span class='kw'>if</span> <span class='id identifier rubyid_os'>os</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>darwin</span><span class='tstring_end'>'</span></span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_arch'>arch</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x86_64</span><span class='tstring_end'>'</span></span>
155
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>LDFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-arch x86_64 -R</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
156
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>CFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-arch x86_64 -m64 -L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
157
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_os'>os</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>linux</span><span class='tstring_end'>'</span></span>
158
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>LDFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-Wl,-rpath </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
159
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>CFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
160
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_os'>os</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>solaris2</span><span class='tstring_end'>'</span></span>
161
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>LDFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-R</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
162
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_environment'>build_environment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>CFLAGS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/lib -I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'>/include</span><span class='tstring_end'>&quot;</span></span>
163
+ <span class='kw'>end</span>
164
+
165
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_commands'>build_commands</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>./configure --prefix=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'> \
166
+ --with-opt-dir=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_install_prefix'>install_prefix</span><span class='rbrace'>}</span><span class='tstring_content'> \
167
+ --enable-shared \
168
+ --disable-install-doc</span><span class='tstring_end'>&quot;</span></span>
169
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_build_commands'>build_commands</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>make</span><span class='tstring_end'>&quot;</span></span>
170
+
171
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_install_commands'>install_commands</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>make install</span><span class='tstring_end'>&quot;</span></span>
172
+
173
+ <span class='const'>CLEAN</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_install_prefix'>install_prefix</span>
174
+ <span class='kw'>end</span>
175
+ </code></pre>
176
+
177
+ <ul>
178
+ <li><p><code>t.name</code> - Required. Name of the software component.</p></li>
179
+ <li><p><code>t.version</code> - Optional. Version of the software component.</p></li>
180
+ <li><p><code>t.depends_on(name)</code> - Optional. This is used to tell Bunchr that other
181
+ <code>Software</code> components should be built before this one.</p></li>
182
+ <li><p><code>t.ohai</code> - This provides access to the <code>Bunchr::Ohai</code> object which contains
183
+ Ohai data about the system. By default, only the <code>platform</code> and <code>os</code> plugins
184
+ are loaded. Since you have direct access to the Ohai object, other plugins
185
+ can be loaded by calling <code>t.ohai.require_plugin</code></p></li>
186
+ <li><p><code>t.download_commands</code> - An array of shell commands used to download and
187
+ uncompress the source. You could also do a <code>git clone ..</code> here. These commands
188
+ are executed in the <code>download_dir</code> which is as <code>#{Bunchr.build_dir}/#{t.name}</code>.
189
+ The <code>download_dir</code> cannot be changed.</p></li>
190
+ <li><p><code>t.build_commands</code> - An array of shell commands used to compile the downloaded
191
+ source. These commands are executed in the directory defined by
192
+ <code>t.work_dir</code> which will be automatically determined from:
193
+ 1) <code>#{download_dir}/#{t.name}-#{t.version}</code> (common for most tarballs), or
194
+ 2) <code>#{download_dir}/#{t.name}</code> (if no <code>t.version</code> set), or
195
+ 3) explicitly set by calling <code>t.work_dir = &#39;/some/absolute/path&#39;</code></p></li>
196
+ <li><p><code>t.install_commands</code> - An array of shell commands used to download and
197
+ uncompress the source. You could also do a <code>git clone ..</code> here. These commands
198
+ are executed in <code>t.work_dir</code> directory.</p></li>
199
+ <li><p><code>CLEAN</code> - Optional. This is an array of files and directories that should be deleted
200
+ when <code>rake clean</code> is executed.</p></li>
201
+ </ul>
202
+
203
+ <p><code>download_commands</code>, <code>build_commands</code>, and <code>install_commands</code> are all optional,
204
+ but unless one of them contains some commands your <code>Software</code> object won&#39;t be
205
+ doing anything useful.</p>
206
+
207
+ <p>If any of <code>download_commands</code>, <code>build_commands</code>, or <code>install_commands</code> exit
208
+ with a non-zero status, the entire Bunchr process will stop
209
+ and print any STDOUT or STDERR from the failed command to the Logger.</p>
210
+
211
+ <p>Bunchr will keep track of what has succeeded so that you can restart a failed
212
+ build after fixing an error. This can save quite a bit of time during package
213
+ development, but you should consider doing a full <code>rake clean</code> before building
214
+ any official packages.</p>
215
+
216
+ <p>All tasks created by a <code>Bunchr::Software</code> object are prefixed into the
217
+ <code>software:</code> namespace. To see the generated tasks:</p>
218
+
219
+ <pre class="code ruby"><code>$ rake -T software:ruby
220
+ rake software:ruby # Download, build, and install ruby 1.9.3-p125
221
+ rake software:ruby:build # Build ruby 1.9.3-p125
222
+ rake software:ruby:download # Download ruby 1.9.3-p125
223
+ rake software:ruby:install # Install ruby 1.9.3-p125
224
+ </code></pre>
225
+
226
+ <p><code>Software</code> recipes can be defined directly in the Rakefile or they can
227
+ be separated into individual files and loaded via <code>Bunchr.load_recipes(files)</code>.</p>
228
+
229
+ <h3>Packages DSL</h3>
230
+
231
+ <p>A project will typically only contain a single <code>Bunchr::Packages</code> object which
232
+ is essentially a wrapper around <code>fpm</code> to create a single package. The Ohai
233
+ <code>platform</code> data will be used to determined what type of packages can be built
234
+ on the current system. Typically you would run the same Bunchr code on a
235
+ Debian based box to build the .deb, and a Redhat based box to build the .rpm.</p>
236
+
237
+ <p>Example <code>Rakefile</code>:</p>
238
+
239
+ <pre class="code ruby"><code><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bunchr</span><span class='tstring_end'>'</span></span>
240
+
241
+ <span class='const'>Bunchr</span><span class='period'>.</span><span class='id identifier rubyid_build_dir'>build_dir</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/tmp/build</span><span class='tstring_end'>'</span></span>
242
+ <span class='const'>Bunchr</span><span class='period'>.</span><span class='id identifier rubyid_install_dir'>install_dir</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/opt/sensu</span><span class='tstring_end'>'</span></span>
243
+
244
+ <span class='const'>Bunchr</span><span class='period'>.</span><span class='id identifier rubyid_load_recipes'>load_recipes</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>recipes/**/*.rake</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
245
+
246
+ <span class='const'>Bunchr</span><span class='op'>::</span><span class='const'>Packages</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
247
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sensu</span><span class='tstring_end'>'</span></span>
248
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SENSU_VERSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.9.5</span><span class='tstring_end'>'</span></span>
249
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_iteration'>iteration</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>BUILD_NUMBER</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1</span><span class='tstring_end'>'</span></span>
250
+
251
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_category'>category</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Monitoring</span><span class='tstring_end'>'</span></span>
252
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_license'>license</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>MIT License</span><span class='tstring_end'>'</span></span>
253
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_vendor'>vendor</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Sonian Inc.</span><span class='tstring_end'>'</span></span>
254
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://github.com/sonian/sensu</span><span class='tstring_end'>'</span></span>
255
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_description'>description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>A monitoring framework that aims to be simple, malleable, and scalable. Publish/subscribe model.</span><span class='tstring_end'>'</span></span>
256
+
257
+ <span class='kw'>case</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_ohai'>ohai</span><span class='period'>.</span><span class='id identifier rubyid_platform_family'>platform_family</span>
258
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>debian</span><span class='tstring_end'>'</span></span>
259
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:after_install</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/deb/postinst</span><span class='tstring_end'>'</span></span>
260
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:before_remove</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/deb/prerm</span><span class='tstring_end'>'</span></span>
261
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:after_remove</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/deb/postrm</span><span class='tstring_end'>'</span></span>
262
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rhel</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fedora</span><span class='tstring_end'>'</span></span>
263
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:before_install</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/rpm/pre</span><span class='tstring_end'>'</span></span>
264
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:after_install</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/rpm/post</span><span class='tstring_end'>'</span></span>
265
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_scripts'>scripts</span><span class='lbracket'>[</span><span class='symbol'>:before_remove</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pkg_scripts/rpm/preun</span><span class='tstring_end'>'</span></span>
266
+ <span class='kw'>end</span>
267
+
268
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_include_software'>include_software</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ruby</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
269
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_include_software'>include_software</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sensu</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
270
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_include_software'>include_software</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sensu_dashboard</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
271
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_include_software'>include_software</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sensu_configs</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
272
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_include_software'>include_software</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sensu_bin_stubs</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
273
+
274
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='const'>Bunchr</span><span class='period'>.</span><span class='id identifier rubyid_install_dir'>install_dir</span> <span class='comment'># /opt/sensu
275
+ </span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/usr/share/sensu</span><span class='tstring_end'>'</span></span>
276
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/var/log/sensu</span><span class='tstring_end'>'</span></span>
277
+
278
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/etc/init.d/sensu-api</span><span class='tstring_end'>'</span></span>
279
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/etc/init.d/sensu-client</span><span class='tstring_end'>'</span></span>
280
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/etc/init.d/sensu-server</span><span class='tstring_end'>'</span></span>
281
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/etc/init.d/sensu-dashboard</span><span class='tstring_end'>'</span></span>
282
+
283
+ <span class='comment'># need to enumerate config files for fpm
284
+ </span> <span class='comment'># these are installed from recipe/sensu_configs.rake
285
+ </span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/sensu/handlers/default</span><span class='tstring_end'>&quot;</span></span>
286
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/sensu/conf.d/client.json</span><span class='tstring_end'>&quot;</span></span>
287
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/sensu/conf.d/checks.json</span><span class='tstring_end'>&quot;</span></span>
288
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/sensu/conf.d/handlers.json</span><span class='tstring_end'>&quot;</span></span>
289
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/sensu/config.json</span><span class='tstring_end'>&quot;</span></span>
290
+
291
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_config_files'>config_files</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/etc/logrotate.d/sensu</span><span class='tstring_end'>'</span></span>
292
+ <span class='kw'>end</span>
293
+
294
+ <span class='comment'># default task executed when `rake` is run with no args.
295
+ </span><span class='id identifier rubyid_task'>task</span> <span class='symbol'>:default</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>packages:sensu</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
296
+ </code></pre>
297
+
298
+ <p>Let&#39;s break it all down:</p>
299
+
300
+ <ul>
301
+ <li><p><code>Bunchr.build_dir</code> - Required. This variable is available to all
302
+ <code>Bunchr::Software</code> recipes specifying a temporary directory used for
303
+ downloading and compiling.</p></li>
304
+ <li><p><code>Bunchr.install_dir</code> - Required. This variable is available to all
305
+ <code>Bunchr::Software</code> recipes. It will typically be the base directory
306
+ where all software is installed.</p></li>
307
+ </ul>
308
+
309
+ <p>The following variables are passed directly to <code>fpm</code>:</p>
310
+
311
+ <ul>
312
+ <li><p><code>t.name</code>, <code>t.version</code>, <code>t.iteration</code> - Required.
313
+ Used by <code>fpm</code> to construct the package names, ie:
314
+ <code>name-version-iteration-arch.rpm</code></p></li>
315
+ <li><p><code>t.arch</code> - Optional. Can be used to override the default detected
316
+ architecture, eg: <code>all</code> or <code>noarch</code>.</p></li>
317
+ <li><p><code>t.category</code>, <code>t.license</code>, <code>t.vendor</code>, <code>t.url</code>, <code>t.description</code> -
318
+ Optional. Package metadata.</p></li>
319
+ <li><p><code>t.include_software(name)</code> - Optional. This is used to tell Bunchr what
320
+ <code>Software</code> components should be built and installed before creating
321
+ packages.</p></li>
322
+ <li><p><code>t.scripts</code> - Optional. A hash with keys: <code>:after_install</code>, <code>:before_install</code>,
323
+ <code>:after_remove</code>, and <code>:before_remove</code>. These specified script files will
324
+ be included with the packages.</p></li>
325
+ <li><p><code>t.files</code> - Required. An array of files and directories to include.</p></li>
326
+ <li><p><code>t.config_files</code> - Optional. An array of files that will be marked as
327
+ configuration files (if supported by the underlying package type).</p></li>
328
+ </ul>
329
+
330
+ <p>NOTE: you must specify individual files, not directories.</p>
331
+
332
+ <p>All tasks created by a <code>Bunchr::Packages</code> object are prefixed into the
333
+ <code>packages:</code> namespace. To see the generated tasks:</p>
334
+
335
+ <pre class="code ruby"><code>$ rake -T packages
336
+ rake packages:sensu # Create bunchr packages for sensu 0.9.5-1
337
+ rake packages:sensu:build # Build all packages: sensu-0.9.5-1-x86_64
338
+ rake packages:sensu:build_deb # Build deb: sensu-0.9.5-1-x86_64
339
+ rake packages:sensu:build_rpm # Build RPM: sensu-0.9.5-1-x86_64
340
+ rake packages:sensu:build_tarball # Build tarball: sensu-0.9.5-1-x86_64.tar.gz
341
+ </code></pre>
342
+
343
+ <p>The main task is <code>packages:#{name}</code>. Exec this task to create all relevant
344
+ packages.</p>
345
+
346
+ <h2>Integration with Vagrant</h2>
347
+
348
+ <ul>
349
+ <li>TODO. maybe link to sensu-bunchr here.</li>
350
+ </ul>
351
+
352
+ <h2>Other Examples</h2>
353
+
354
+ <ul>
355
+ <li>TODO. maybe link to sensu-bunchr here, or a complete example of fpm</li>
356
+ </ul>
357
+
358
+ <h2>Author</h2>
359
+
360
+ <ul>
361
+ <li><a href="https://twitter.com/miller_joe">Joe Miller</a> - <a href="http://joemiller.me">http://joemiller.me</a> / <a href="https://github.com/joemiller">https://github.com/joemiller</a></li>
362
+ </ul>
363
+
364
+ <h2>Licensing</h2>
365
+
366
+ <p>todo, apache</p>
367
+ </div></div>
368
+
369
+ <div id="footer">
370
+ Generated on Wed Apr 18 17:18:48 2012 by
371
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
372
+ 0.7.5 (ruby-1.9.2).
373
+ </div>
374
+
375
+ </body>
376
+ </html>