Skip to content

Commit

Permalink
(doc) Create a quickstart guide to get people going
Browse files Browse the repository at this point in the history
The README_DEVELOPER document has become too long for many new
contributors to quickly get going. The setup instructions were hidding
far down inside the file and provided to many caveats for a quick setup.
This splits out that information, streamlines it to take an opinionated
stance on how to setup a development environment, and start the process
of creating a set of documents tightly tied to the puppet codebase.

This new docs area should be used for documents about developing on the
puppet codebase, documentation of internal architecture, and other
developer and development focussed documents.

This also moves the acceptance test documents to this new location.
  • Loading branch information
zaphod42 committed Feb 6, 2014
1 parent 6f24451 commit fe16ed6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 48 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ If you need to run Puppet from source as a tester or developer,
Developing and Contributioning
------

Please see our [Contribution Documents](CONTRIBUTING.md)
and our [Developer Documentation](README_DEVELOPER.md).
We'd love to get contributions from you! For a quick guide to getting your
system setup for developing take a look at our [Quickstart
Guide](docs/quickstart.md). Once you are up and running, take a look at the
[Contribution Documents](CONTRIBUTING.md) to see how to get your changes merged
in.

For more complete docs on developing with puppet you can take a look at the
rest of the [developer documents](docs/index.md).

License
-------
Expand Down
48 changes: 2 additions & 46 deletions README_DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This file is intended to provide a place for developers and contributors to
document what other developers need to know about changes made to Puppet.

### Dependencies

# Internal Structures

## Two Types of Catalog
Expand Down Expand Up @@ -128,52 +130,6 @@ sure and track down the problem is to wrap the File.open method like so:
The settings catalog is populated by the `Puppet::Util::Settings#to\_catalog`
method.

# Ruby Dependencies #

To install the dependencies run:

$ bundle install --path .bundle/gems/

Once this is done, you can interact with puppet through bundler using `bundle
exec <command>` which will ensure that `<command>` is executed in the context
of puppet's dependencies.

For example to run the specs:

$ bundle exec rake spec

To run puppet itself (for a resource lookup say):

$ bundle exec puppet resource host localhost

which should return something like:

host { 'localhost':
ensure => 'present',
ip => '127.0.0.1',
target => '/etc/hosts',
}

# Running Tests #

Puppet Labs projects use a common convention of using Rake to run unit tests.
The tests can be run with the following rake task:

bundle exec rake spec

This allows the Rakefile to set up the environment beforehand if needed. This
method is how the unit tests are run in [Jenkins](https://jenkins.puppetlabs.com).

Under the hood Puppet's tests use `rspec`. To run all of them, you can directly
use 'rspec':

bundle exec rspec

To run a single file's worth of tests (much faster!), give the filename, and use
the nested format to see the descriptions:

bundle exec rspec spec/unit/ssl/host_spec.rb --format nested

## Testing dependency version requirements

Puppet is only compatible with certain versions of RSpec and Mocha. If you are
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Puppet Developer Documentation

Setting up and running tests

* [Quickstart Guide](quickstart.md)
* [Running acceptance tests](acceptance_tests.md)
61 changes: 61 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Quick Start to Developing on Puppet

Before diving into the code, you should first take the time to make sure you
have an environment where you can run puppet as a developer. In a nutshell you
need: the puppet codebase, ruby versions, and dependencies. Once you've got all
of that in place you can make sure that you have a working development system
by running the puppet spec tests.

## The Puppet Codebase

In order to contribute to puppet you'll need to have a github account. Once you
have your account, fork the puppetlabs/puppet repo, and clone it onto your
local machine. The [github docs have a good
explanation](https://help.github.com/articles/fork-a-repo) of how to do all of
this.

## Ruby versions

Puppet needs to work across a variety of ruby versions. At a minimum you need
to try any changes you make on both ruby 1.8.7 and ruby 1.9.3. Ruby 2.0.0 and
2.1.0 are also supported, but they have small enough differences from 1.9.3
that they are not as important to always check while developing.

Popular ways of making sure you have access to the various versions of ruby are
to use either [rbenv](https://github.com/sstephenson/rbenv) or
[rvm](http://rvm.io/). You can read up on the linked sites for how to get them
installed on your system.

## Dependencies

Make sure you have [bundler](http://bundler.io/) installed. This should be as
simple as:

$ gem install bundler

Now you can get all of the dependencies using:

$ bundle install --path .bundle/gems/

Once this is done, you can interact with puppet through bundler using `bundle
exec <command>` which will ensure that `<command>` is executed in the context
of puppet's dependencies.

For example to run the specs:

$ bundle exec rake spec

To run puppet itself (for a resource lookup say):

$ bundle exec puppet resource host localhost

## Running Spec Tests

Puppet Labs projects use a common convention of using Rake to run unit tests.
The tests can be run with the following rake task:

bundle exec rake spec

To run a single file's worth of tests (much faster!), give the filename:

bundle exec rake spec TEST=spec/unit/ssl/host_spec.rb

0 comments on commit fe16ed6

Please sign in to comment.