rump 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,118 @@
1
+ Rump
2
+ ====
3
+
4
+ Rump helps you run Puppet locally against a Git checkout.
5
+
6
+ Rump encourages a Puppet workflow where you quickly + iteratively develop your
7
+ Puppet manifests on a single machine, then push your changes up to a repository
8
+ to deploy to the rest of your infrastructure.
9
+
10
+ This workflow also complements a Capistrano or MCollective-style deployment,
11
+ where you remotely instruct Rump to check out a copy of the latest manifests
12
+ and run them.
13
+
14
+ Rump also has the ability to freeze Puppet in to the manifests repository,
15
+ letting you quickly test different versions of Puppet without waiting for
16
+ packages to appear, and reducing the dependencies on a system to run Puppet
17
+ down to just Ruby and git.
18
+
19
+ Installing
20
+ ----------
21
+
22
+ $ gem install rump
23
+
24
+ Using Rump
25
+ ----------
26
+
27
+ Make sure you check out the [man pages](rump/blob/master/man/rump.1.ronn).
28
+
29
+ Check out your repository of Puppet manifests:
30
+
31
+ $ rump clone git@github.com:me_at_example_dot_org/puppet.git
32
+
33
+ You'll want to set up a `~/.gitconfig` in your home directory so you know who's
34
+ making changes:
35
+
36
+ [user]
37
+ name = My Name
38
+ email = me@example.org
39
+
40
+ [push]
41
+ default = matching
42
+
43
+ When you make changes, run Puppet through Rump:
44
+
45
+ $ sudo rump go
46
+
47
+ You can append options you'd normally pass to the `puppet` command at the end
48
+ of `rump go`:
49
+
50
+ $ sudo rump go --verbose --debug --noop
51
+
52
+ There's nothing stopping you from running Rump against different checkouts/branches
53
+ of manifests. This is especially powerful when developing locally with the following
54
+ workflow:
55
+
56
+ 1. `rump clone git@github.com:me_at_example_dot_org/puppet.git`
57
+ 2. `rump go`
58
+ 3. `cd puppet && git checkout -b new_feature`
59
+ 4. Make your changes &amp;&amp; `rump go --noop` to see what will change.
60
+ 5. Apply the changes with `rump go`
61
+ 6. *Iterate until everything's working*
62
+ 7. `git checkout master && git merge new_feature`
63
+ 8. `git push`
64
+
65
+ Freezing Puppet
66
+ ---------------
67
+
68
+ If you are using Git, you can freeze Puppet into your project as a submodule. This
69
+ gives you a whole bunch of advantages:
70
+
71
+ * You only need Ruby installed on your system to run Puppet
72
+ * A checkout of your manifests also gives you Puppet
73
+ * Bind your manifests to a particular version of Puppet
74
+ * Test your manifests against new versions of Puppet in a separate branch
75
+ * Manage upgrades of Puppet outside your operating system's release cycle
76
+
77
+ You can freeze Puppet very easily:
78
+
79
+ $ rump freeze
80
+
81
+ This will freeze Puppet + Facter under `vendor/`. Alternatively, you can point
82
+ the freezer at any Git repository (local or remote).
83
+
84
+ When you run `rump go`, it checks whether you have frozen Puppet + Facter, and
85
+ runs the frozen Puppet if available.
86
+
87
+ You can also freeze in arbitrary Git repos:
88
+
89
+ $ rump freeze moonshine git://github.com/railsmachine/moonshine.git
90
+
91
+ These will automatically be added to the load path when you run `rump go`
92
+
93
+ Testing Rump
94
+ ------------
95
+
96
+ There's a suite of Cucumber tests to fully exercise Rump in `features/`:
97
+
98
+ $ cucumber features/
99
+
100
+ The scenarios are tagged with `@offline` and `@online`, depending on whether
101
+ the test requires internet connectivity. Run all but `@online` tests with:
102
+
103
+ $ cucumber --tags ~@online features/
104
+
105
+ Quirks
106
+ ------
107
+
108
+ 1. Puppet's fileserver (`source => "puppet:///..."` on File resources) doesn't
109
+ behave as expected on Puppet < 2.6. If you are using Puppet < 2.6, all files
110
+ need to be templates.
111
+
112
+ 2. Manifests need to be in modules so Puppet can pick them up correctly.
113
+
114
+ License
115
+ -------
116
+
117
+ Copyright Rails Machine LLC 2010-2011, released under the LGPL. See
118
+ [LICENSE](rump/blob/master/LICENSE) for more info.
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "rump"
5
+ gemspec.summary = "Rump helps you run Puppet locally against a Git checkout."
6
+ gemspec.description = "Rump helps you run Puppet locally against a Git checkout. This is great for locally iterating your Puppet manifests very quickly, then pushng them up to a repository somewhere else to share the changes."
7
+ gemspec.email = "ops@railsmachine.com"
8
+ gemspec.homepage = "http://github.com/railsmachine/rump"
9
+ gemspec.authors = ["Lindsay Holmwood"]
10
+ gemspec.add_dependency 'thor', '0.13.4'
11
+ end
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: gem install jeweler"
14
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'rump'
5
+ rescue LoadError
6
+ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ require 'rump'
8
+ end
9
+
10
+ if ARGV.any? {|arg| arg =~ /help|--help|-h/}
11
+ root = Pathname.new(File.dirname(__FILE__)).parent.expand_path
12
+ command = "man #{root + 'man' + 'rump.1'}"
13
+ exec(command)
14
+ end
15
+
16
+ command = ARGV.first
17
+ arguments = ARGV[1..-1]
18
+
19
+ Rump.new.invoke(command, arguments)
@@ -0,0 +1,179 @@
1
+ Feature: Rump
2
+ To iterate quickly
3
+ When writing and running
4
+ Puppet manifests
5
+ A user
6
+ Should have a helper tool
7
+ To smooth things out
8
+
9
+ @offline
10
+ Scenario: Cloning a repository
11
+ Given I am working in "/tmp"
12
+ And I have an empty git repository named "master-puppet"
13
+ And there is no "clone-puppet" repository
14
+ When I run "rump clone master-puppet clone-puppet"
15
+ Then I should have a git repository at "clone-puppet"
16
+
17
+ @offline
18
+ Scenario: Doing a puppet run
19
+ Given I am working in "/tmp"
20
+ And I have a simple Puppet repository named "foobar"
21
+ And there is no "simple-puppet" repository
22
+ And there is no "/tmp/checkout" file
23
+ And "puppet" is on my path
24
+ When I run "rump clone foobar simple-puppet"
25
+ Given I am working in "/tmp/simple-puppet"
26
+ When I run "rump go"
27
+ Then I should see a file at "/tmp/checkout"
28
+
29
+ @offline
30
+ Scenario: Initialising a safe repo
31
+ Given I am working in "/tmp"
32
+ And there is no "safe-puppet" repository
33
+ And there is no "/tmp/checkout" file
34
+ When I run "rump init safe-puppet"
35
+ Then I should have a git repository at "safe-puppet"
36
+
37
+ @offline
38
+ Scenario: Verifying author name
39
+ Given I am working in "/tmp"
40
+ And there is no "safe-puppet" repository
41
+ And there is no "/tmp/checkout" file
42
+ When I run "rump init safe-puppet"
43
+ Then I should have a git repository at "safe-puppet"
44
+ Given I am working in "/tmp/safe-puppet"
45
+ When I touch "/tmp/safe-puppet/random"
46
+ When I run "git add ."
47
+ Then running "GIT_AUTHOR_NAME=root git commit -m 'created random' ." should fail
48
+
49
+ @offline
50
+ Scenario: Verifying author email
51
+ Given I am working in "/tmp"
52
+ And there is no "safe-puppet" repository
53
+ And there is no "/tmp/checkout" file
54
+ When I run "rump init safe-puppet"
55
+ Then I should have a git repository at "safe-puppet"
56
+ Given I am working in "/tmp/safe-puppet"
57
+ When I touch "/tmp/safe-puppet/random"
58
+ When I run "git add ."
59
+ Then running "GIT_AUTHOR_EMAIL=me@$(hostname) git commit -m 'created random' ." should fail
60
+
61
+ @offline
62
+ Scenario: Setting author email
63
+ Given I am working in "/tmp"
64
+ And there is no "whoami-email-puppet" repository
65
+ And there is no "/tmp/checkout" file
66
+ When I run "rump init whoami-email-puppet"
67
+ Then I should have a git repository at "whoami-email-puppet"
68
+ Given I am working in "/tmp/whoami-email-puppet"
69
+ When I run "rump whoami 'Spoons McDoom <spoons@mcdoom.com>'"
70
+ When I touch "/tmp/whoami-email-puppet/random"
71
+ When I run "git add ."
72
+ Then running "GIT_AUTHOR_EMAIL=$(git config user.email) git commit -m 'created random' ." should succeed
73
+
74
+ @offline
75
+ Scenario: Setting author name
76
+ Given I am working in "/tmp"
77
+ And there is no "whoami-name-puppet" repository
78
+ And there is no "/tmp/checkout" file
79
+ When I run "rump init whoami-name-puppet"
80
+ Then I should have a git repository at "whoami-name-puppet"
81
+ Given I am working in "/tmp/whoami-name-puppet"
82
+ When I run "rump whoami 'Spoons McDoom <spoons@mcdoom.com>'"
83
+ When I touch "/tmp/whoami-name-puppet/random"
84
+ When I run "git add ."
85
+ Then running "GIT_AUTHOR_NAME=$(git config user.name) git commit -m 'created random' ." should succeed
86
+
87
+ @offline
88
+ Scenario: Getting author name and email
89
+ Given I am working in "/tmp"
90
+ And there is no "whoami-getter-puppet" repository
91
+ And there is no "/tmp/checkout" file
92
+ When I run "rump init whoami-getter-puppet"
93
+ Then I should have a git repository at "whoami-getter-puppet"
94
+ Given I am working in "/tmp/whoami-getter-puppet"
95
+ When I run "rump whoami 'Spoons McDoom <spoons@mcdoom.com>'"
96
+ Then running "rump whoami" should output "Spoons McDoom <spoons@mcdoom.com>"
97
+
98
+ @online
99
+ Scenario: Freezing Puppet + Facter as submodules
100
+ Given I am working in "/tmp"
101
+ And I have a simple Puppet repository named "foobar"
102
+ And there is no "simple-puppet" repository
103
+ And there is no "/tmp/checkout" file
104
+ When I run "rump clone foobar simple-puppet"
105
+ Given I am working in "/tmp/simple-puppet"
106
+ When I run "rump freeze"
107
+ And I run "rump go"
108
+ Then I should see a file at "/tmp/checkout"
109
+
110
+ @online
111
+ Scenario: Automatically initialising frozen submodules on clone
112
+ Given I am working in "/tmp"
113
+ And I have a simple Puppet repository named "foobar"
114
+ And there is no "simple-puppet" repository
115
+ And there is no "frozen-puppet" repository
116
+ When I run "rump clone foobar simple-puppet"
117
+ Given I am working in "/tmp/simple-puppet"
118
+ When I run "rump freeze"
119
+ And I run "git add ."
120
+ And I run "git commit -m 'frozen puppet + facter' ."
121
+ Given I am working in "/tmp"
122
+ When I run "rump clone simple-puppet frozen-puppet"
123
+ Then I should see a directory at "/tmp/frozen-puppet/vendor/facter"
124
+ Then I should see a directory at "/tmp/frozen-puppet/vendor/puppet"
125
+
126
+ @online
127
+ Scenario: Freezing a specific submodule
128
+ Given I am working in "/tmp"
129
+ And I have a simple Puppet repository named "foobar"
130
+ And there is no "simple-puppet" repository
131
+ And there is no "/tmp/checkout" file
132
+ When I run "rump clone foobar simple-puppet"
133
+ Given I am working in "/tmp/simple-puppet"
134
+ When I run "rump freeze facter git://github.com/puppetlabs/facter.git"
135
+ And I run "rump freeze puppet git://github.com/puppetlabs/puppet.git"
136
+ And I run "rump go"
137
+ Then I should see a file at "/tmp/checkout"
138
+
139
+ @online
140
+ Scenario: Freezing a specific submodule at a specific release
141
+ Given I am working in "/tmp"
142
+ And I have a simple Puppet repository named "foobar"
143
+ And there is no "tagged-puppet" repository
144
+ And there is no "/tmp/checkout" file
145
+ When I run "rump clone foobar tagged-puppet"
146
+ Given I am working in "/tmp/tagged-puppet"
147
+ When I run "rump freeze facter git://github.com/puppetlabs/facter.git --release=1.5.7"
148
+ And I run "rump freeze puppet git://github.com/puppetlabs/puppet.git --release=0.25.4"
149
+ And I run "rump go"
150
+ Then I should see a file at "/tmp/checkout"
151
+
152
+ @online
153
+ Scenario: Freezing and running Puppet 2.6
154
+ Given I am working in "/tmp"
155
+ And I have a simple Puppet 2.6 repository named "foobar"
156
+ And there is no "tagged-puppet" repository
157
+ And there is no "/tmp/checkout" file
158
+ When I run "rump clone foobar tagged-puppet"
159
+ Given I am working in "/tmp/tagged-puppet"
160
+ When I run "rump freeze facter git://github.com/puppetlabs/facter.git --release=1.5.8"
161
+ And I run "rump freeze puppet git://github.com/puppetlabs/puppet.git --release=2.6.4"
162
+ And I run "rump go"
163
+ Then I should see a file at "/tmp/checkout"
164
+
165
+ @offline
166
+ Scenario: Generating project scaffolding
167
+ Given I am working in "/tmp/"
168
+ When I run "rump scaffold my-new-project"
169
+ Given I am working in "/tmp/my-new-project"
170
+ Then I should see the following directories:
171
+ | directory |
172
+ | /tmp/my-new-project |
173
+ | /tmp/my-new-project/manifests |
174
+ | /tmp/my-new-project/modules |
175
+ | /tmp/my-new-project/vendor |
176
+ And I should see a file at "/tmp/my-new-project/README"
177
+
178
+
179
+