Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
This changes the API in a new implementation in a file called file_.rb
The intent is that it should replace the implemntation in File,
or perhaps directly in a Puppet::FileSystem class.
|
|
- All previous File and FileTest calls to exist? or exists? go through
the new FileSystem::File abstraction so that the implementation can
later be swapped for a Windows specific one to support symlinks
|
|
RDoc 2+ has an RDoc::ClassModule.add_comment(comment,location) method
which is the preferred method of setting comments for a class. RDoc
shipping with Ruby 1.9 seems to fall back to using the @comment, which
is how rdoc1 handled this, but Ruby 2.0's rdoc seems to be stricter and
requires use of add_comment.
This patch overrides the add_comment method in our PuppetModule,
PuppetClass, PuppetNode code objects with a version compatible with
either rdoc1 or 2. It also tests for module level README comments being
incorporated.
|
|
There were a number of rdoc1 features (tracking of included, required
modules, realized virtual resources, all resources when :document_all
setting is true, and global variables) which had not been functioning
due to the parser wrapping statements in
Puppet::Parser::AST::BlockExpression instances now rather than
Puppet::Parser::AST::Array instances.
This is now fixed so that these areas are documented when using rdoc1.
Only included classes is documented in rdoc2, however. Documenting the
remaining elements would require writing a new renderer.
|
|
We were lacking any comprehensive testing of the interaction between
puppet doc and rdoc. This integration test checks either the rdoc1 or
rdoc2 output (depending on which version of rdoc is present on the
system) for all of the basic module constructs we are documenting:
modules, classes, defined types, nodes, and plugin facts, types and
functions. It tests both site manifests and modules.
|
|
Without this patch Ruby 1.9 is still complaining loudly about trying to
parse the spec files. The previous attempt to clean up this problem in
edc3ddf works for Ruby 1.8 but not 1.9.
I'd prefer to remove the shebang lines entirely, but doing so will cause
encoding errors in Ruby 1.9. This patch strives for a happy middle
ground of convincing Ruby it is actually working with Ruby while not
confusing it to think it should exec() to rspec.
This patch is the result of the following command run against the source
tree:
find spec -type f -print0 | \
xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
|
|
Without this patch some spec files are using `ruby -S rspec` and others
are using `rspec`.
We should standardize on a single form of the interpreter used for spec
files.
`ruby -S rspec` is the best choice because it correctly informs editors
such as Vim with Syntastic that the file is a Ruby file rather than an
Rspec file.
|
|
Update the documentation and code to fail cleanly when a supported version of
RDoc is not available.
This does not yet tackle loading an RDoc version specific implementation of
the process, only a clean failure when we can't cope. In future this should
be replaced by some dynamic loading process based on the supported RDoc
version, if we retain the tool.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
By running:
rspec spec --tag ~@fails_on_ruby_1.9.2
We can now just run the specs that pass under Ruby 1.9. Obviously in
the long term we want to have all the specs passing, but until then we
need notification when we regress. From now on new code will be
required to pass under Ruby 1.9, and Jenkins will give us email
notification if it doesn't or if we break something that was already
working.
Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
We now use a shebang of: #!/usr/bin/env rspec
This enables the direct execution of spec tests again, which was lost earlier
during the transition to more directly using the rspec2 runtime environment.
|
|
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we
can just stop. As a side-effect we can now avoid a whole pile of stupid things
to try and include the spec_helper.rb file...
...and then we can stop protecting spec_helper from evaluating twice, since we
now require it with a consistent name. Yay.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
Running the specs under Ruby 1.9 didn't work using the lambda to recurse
down directories to find the spec_helper. Standardizing the way to find
spec_helper like the rest of specs seemed like the way to go.
Here's the command line perl I used to make the change:
perl -p -i -e "s/Dir.chdir.*lambda.*spec_helper.*$/require
File.expand_path(File.dirname(__FILE__) + '\/..\/..\/spec_helper')/"
`find spec -name "*_spec.rb"`
Then I fixed the number of dots for files that weren't two levels from
the spec dir and whose tests failed.
Reviewed-by: Nick Lewis <nick@puppetlabs.com>
|
|
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
|
|
Some spec files like active_record.rb had names that would confuse the
load path and get loaded instead of the intended implentation when the
spec was run from the same directory as the file.
Author: Matt Robinson <matt@puppetlabs.com>
Date: Fri Jun 11 15:29:33 2010 -0700
|