Skip to content

Commit

Permalink
Merge pull request puppetlabs#30 from ghoneycutt/noticket/master/inap…
Browse files Browse the repository at this point in the history
…propriate_whitespace

Removes trailing whitespace
  • Loading branch information
Gary Larizza committed Oct 19, 2012
2 parents 7a08d7f + d4f68c2 commit 755b593
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 45 deletions.
4 changes: 2 additions & 2 deletions README.markdown
Expand Up @@ -11,9 +11,9 @@ This type can be used to describe:
* A working copy checked out from a (remote or local) source, at an
arbitrary revision
* A "blank" working copy not associated with a source (when it makes
sense for the VCS being used)
sense for the VCS being used)
* A "blank" central repository (when the distinction makes sense for the VCS
being used)
being used)

Supported Version Control Systems
---------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/vcsrepo/bzr.rb
Expand Up @@ -26,7 +26,7 @@ def exists?
def destroy
FileUtils.rm_rf(@resource.value(:path))
end

def revision
at_path do
current_revid = bzr('version-info')[/^revision-id:\s+(\S+)/, 1]
Expand Down
11 changes: 5 additions & 6 deletions lib/puppet/provider/vcsrepo/cvs.rb
Expand Up @@ -6,7 +6,7 @@
optional_commands :cvs => 'cvs'
defaultfor :cvs => :exists
has_features :gzip_compression, :reference_tracking, :modules

def create
if !@resource.value(:source)
create_repository(@resource.value(:path))
Expand All @@ -28,12 +28,12 @@ def exists?
def working_copy_exists?
File.directory?(File.join(@resource.value(:path), 'CVS'))
end

def destroy
FileUtils.rm_rf(@resource.value(:path))
end

def latest?
def latest?
debug "Checking for updates because 'ensure => latest'"
at_path do
# We cannot use -P to prune empty dirs, otherwise
Expand All @@ -44,10 +44,10 @@ def latest?
return is_current
end
end

def latest
# CVS does not have a conecpt like commit-IDs or change
# sets, so we can only have the current branch name (or the
# sets, so we can only have the current branch name (or the
# requested one, if that differs) as the "latest" revision.
should = @resource.value(:revision)
current = self.revision
Expand Down Expand Up @@ -117,5 +117,4 @@ def update_owner
set_ownership
end
end

end
4 changes: 2 additions & 2 deletions lib/puppet/provider/vcsrepo/svn.rb
Expand Up @@ -41,7 +41,7 @@ def latest?
end
end
end

def buildargs
args = ['--non-interactive']
if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password)
Expand All @@ -58,7 +58,7 @@ def latest
svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
end
end

def revision
args = buildargs.push('info')
at_path do
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/vcsrepo.rb
Expand Up @@ -21,7 +21,7 @@

feature :ssh_identity,
"The provider supports a configurable SSH identity file"

feature :user,
"The provider can run as a different user"

Expand Down Expand Up @@ -168,7 +168,7 @@ def retrieve
newparam :identity, :required_features => [:ssh_identity] do
desc "SSH identity file"
end

newparam :module, :required_features => [:modules] do
desc "The repository module to manage"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/filesystem_helpers.rb
Expand Up @@ -3,7 +3,7 @@ module FilesystemHelpers
def expects_chdir(path = resource.value(:path))
Dir.expects(:chdir).with(path).at_least_once.yields
end

def expects_mkdir(path = resource.value(:path))
Dir.expects(:mkdir).with(path).at_least_once
end
Expand Down
1 change: 0 additions & 1 deletion spec/support/fixture_helpers.rb
Expand Up @@ -3,5 +3,4 @@ module FixtureHelpers
def fixture(name, ext = '.txt')
File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', name.to_s + ext))
end

end
6 changes: 3 additions & 3 deletions spec/support/provider_example_group.rb
Expand Up @@ -14,7 +14,7 @@ class ProviderExampleGroup < Spec::Example::ExampleGroup

# Build the provider
subject { described_class.new(@resource) }

# Allow access to it via +provider+
alias :provider :subject

Expand Down Expand Up @@ -47,14 +47,14 @@ def self.build_existence_context(*params, &block) #:nodoc:
context("and with a #{text}", {:resource => placeholders}, &block)
end
end

def self.build_value_context(params = {}, &block) #:nodoc:
unless params.empty?
text = params.map { |k, v| "#{k} => #{v.inspect}" }.join(' and with ')
context("and with #{text}", {:resource => params}, &block)
end
end


# Generate a context for a provider operating on a resource without
# a given parameter/property.
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
Expand Up @@ -78,7 +78,7 @@
end
end
end

describe "setting the revision property" do
it "should use 'bzr update -r' with the revision" do
revision = 'somerev'
Expand Down
24 changes: 12 additions & 12 deletions spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
Expand Up @@ -11,24 +11,24 @@
provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source)))
provider.expects(:cvs).with('update', '-r', resource.value(:revision), '.')
provider.create
end
end
end

resource_without :revision do
it "should just execute 'cvs checkout' without a revision" do
provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source)))
provider.create
end
end
end

context "with a compression", :resource => {:compression => '3'} do
it "should just execute 'cvs checkout' without a revision" do
provider.expects(:cvs).with('-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source)))
provider.create
end
end
end
end

context "when a source is not given" do
it "should execute 'cvs init'" do
provider.expects(:cvs).with('-d', resource.value(:path), 'init')
Expand All @@ -51,7 +51,7 @@
provider.exists?
end
end

resource_without :source do
it "should check for the CVSROOT directory" do
File.expects(:directory?).with(File.join(resource.value(:path), 'CVSROOT'))
Expand All @@ -64,7 +64,7 @@
before do
@tag_file = File.join(resource.value(:path), 'CVS', 'Tag')
end

context "when CVS/Tag exists" do
before do
@tag = 'HEAD'
Expand All @@ -75,22 +75,22 @@
provider.revision.should == @tag
end
end

context "when CVS/Tag does not exist" do
before do
File.expects(:exist?).with(@tag_file).returns(false)
end
it "assumes MAIN" do
provider.revision.should == 'MAIN'
provider.revision.should == 'MAIN'
end
end
end

describe "when setting the revision property" do
before do
@tag = 'SOMETAG'
end

it "should use 'cvs update -r'" do
expects_chdir
provider.expects('cvs').with('update', '-r', @tag, '.')
Expand Down
22 changes: 11 additions & 11 deletions spec/unit/puppet/provider/vcsrepo/hg_spec.rb
Expand Up @@ -11,17 +11,17 @@
resource.value(:source),
resource.value(:path))
provider.create
end
end
end

resource_without :revision do
it "should just execute 'hg clone' without a revision" do
provider.expects(:hg).with('clone', resource.value(:source), resource.value(:path))
provider.create
end
end
end
end

context "when a source is not given" do
it "should execute 'hg init'" do
provider.expects(:hg).with('init', resource.value(:path))
Expand All @@ -48,37 +48,37 @@
before do
expects_chdir
end

context "when given a non-SHA as the resource revision" do
before do
provider.expects(:hg).with('parents').returns(fixture(:hg_parents))
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
end

context "when its SHA is not different than the current SHA", :resource => {:revision => '0.6'} do
it "should return the ref" do
provider.revision.should == '0.6'
end
end

context "when its SHA is different than the current SHA", :resource => {:revision => '0.5.3'} do
it "should return the current SHA" do
provider.revision.should == '34e6012c783a'
end
end
end
end
context "when given a SHA as the resource revision" do
before do
provider.expects(:hg).with('parents').returns(fixture(:hg_parents))
end

context "when it is the same as the current SHA", :resource => {:revision => '34e6012c783a'} do
it "should return it" do
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
provider.revision.should == resource.value(:revision)
end
end

context "when it is not the same as the current SHA", :resource => {:revision => 'not-the-same'} do
it "should return the current SHA" do
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
Expand All @@ -87,7 +87,7 @@
end
end
end

describe "setting the revision property" do
before do
@revision = '6aa99e9b3ab1'
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/puppet/provider/vcsrepo/svn_spec.rb
Expand Up @@ -11,15 +11,15 @@
resource.value(:source),
resource.value(:path))
provider.create
end
end
end
resource_without :revision do
it "should just execute 'svn checkout' without a revision" do
provider.expects(:svn).with('checkout',
resource.value(:source),
resource.value(:path))
provider.create
end
end
end
end
resource_without :source do
Expand Down Expand Up @@ -63,7 +63,7 @@
provider.revision.should == '4'
end
end

describe "setting the revision property" do
before do
@revision = '30'
Expand Down

0 comments on commit 755b593

Please sign in to comment.