Permalink
Browse files

Revert "Revert "Merge branch 'ticket/2.7.x/15464_a_gemfile_would_impr…

…ove_contributor_on-boarding' into 2.7.x""

This reverts commit 76ef99b.
  • Loading branch information...
1 parent 1d1a216 commit 54ea4feb40fe4a3e3dad63962e602b6aaa074673 @jeffmccune jeffmccune committed Aug 20, 2012
Showing with 217 additions and 25 deletions.
  1. +4 −0 .noexec.yaml
  2. +1 −1 spec/spec.opts → .rspec
  3. +32 −0 Gemfile
  4. +44 −0 Gemfile.lock
  5. +70 −5 README_DEVELOPER.md
  6. +9 −9 Rakefile
  7. +2 −6 lib/puppet.rb
  8. +1 −1 lib/puppet/face/help/global.erb
  9. +18 −0 lib/puppet/version.rb
  10. +32 −0 puppet.gemspec
  11. +3 −2 tasks/rake/gem.rake
  12. +1 −1 tasks/rake/sign.rake
View
@@ -0,0 +1,4 @@
+---
+exclude:
+ - rake
+ - rspec
@@ -1,4 +1,4 @@
--format
-s
+p
--colour
--backtrace
View
@@ -0,0 +1,32 @@
+source :rubygems
+
+gemspec
+
+group(:development, :test) do
+ gem "facter", "~> 1.6.4", :require => false
+ gem "rack", "~> 1.4.1", :require => false
+ gem "rspec", "~> 2.10.0", :require => false
+ gem "mocha", "~> 0.10.5", :require => false
+end
+
+platforms :mswin, :mingw do
+ # See http://jenkins.puppetlabs.com/ for current Gem listings for the Windows
+ # CI Jobs.
+ gem "sys-admin", "~> 1.5.6", :require => false
+ gem "win32-api", "~> 1.4.8", :require => false
+ gem "win32-dir", "~> 0.3.7", :require => false
+ gem "win32-eventlog", "~> 0.5.3", :require => false
+ gem "win32-process", "~> 0.6.5", :require => false
+ gem "win32-security", "~> 0.1.2", :require => false
+ gem "win32-service", "~> 0.7.2", :require => false
+ gem "win32-taskscheduler", "~> 0.2.2", :require => false
+ gem "win32console", "~> 1.3.2", :require => false
+ gem "windows-api", "~> 0.4.1", :require => false
+ gem "windows-pr", "~> 1.2.1", :require => false
+end
+
+if File.exists? "#{__FILE__}.local"
+ eval(File.read("#{__FILE__}.local"), binding)
+end
+
+# vim:filetype=ruby
View
@@ -0,0 +1,44 @@
+PATH
+ remote: .
+ specs:
+ puppet (2.7.19)
+ facter (~> 1.5)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ facter (1.6.11)
+ metaclass (0.0.1)
+ mocha (0.10.5)
+ metaclass (~> 0.0.1)
+ rack (1.4.1)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.1)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ facter (~> 1.6.4)
+ mocha (~> 0.10.5)
+ puppet!
+ rack (~> 1.4.1)
+ rspec (~> 2.10.0)
+ sys-admin (~> 1.5.6)
+ win32-api (~> 1.4.8)
+ win32-dir (~> 0.3.7)
+ win32-eventlog (~> 0.5.3)
+ win32-process (~> 0.6.5)
+ win32-security (~> 0.1.2)
+ win32-service (~> 0.7.2)
+ win32-taskscheduler (~> 0.2.2)
+ win32console (~> 1.3.2)
+ windows-api (~> 0.4.1)
+ windows-pr (~> 1.2.1)
View
@@ -3,6 +3,55 @@
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 #
+
+Puppet is considered an Application as it relates to the recommendation of
+adding a Gemfile.lock file to the repository and the information published at
+[Clarifying the Roles of the .gemspec and
+Gemfile](http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/)
+
+To install the dependencies run: `bundle install` to install the dependencies.
+
+A checkout of the source repository should be used in a way that provides
+puppet as a gem rather than a simple Ruby library. The parent directory should
+be set along the `GEM_PATH`, preferably before other tools such as RVM that
+manage gemsets using `GEM_PATH`.
+
+For example, Puppet checked out into `/workspace/src/puppet` using `git
+checkout https://github.com/puppetlabs/puppet` in `/workspace/src` can be used
+with the following actions. The trick is to symlink `gems` to `src`.
+
+ $ cd /workspace
+ $ ln -s src gems
+ $ mkdir specifications
+ $ pushd specifications; ln -s ../gems/puppet/puppet.gemspec; popd
+ $ export GEM_PATH="/workspace:${GEM_PATH}"
+ $ gem list puppet
+
+This should list out
+
+ puppet (2.7.19)
+
+## Bundler ##
+
+With a source checkout of Puppet properly setup as a gem, dependencies can be
+installed using [Bundler](http://gembundler.com/)
+
+ $ bundle install
+ Fetching gem metadata from http://rubygems.org/........
+ Using diff-lcs (1.1.3)
+ Installing facter (1.6.11)
+ Using metaclass (0.0.1)
+ Using mocha (0.10.5)
+ Using puppet (2.7.19) from source at /workspace/puppet-2.7.x/src/puppet
+ Using rack (1.4.1)
+ Using rspec-core (2.10.1)
+ Using rspec-expectations (2.10.0)
+ Using rspec-mocks (2.10.1)
+ Using rspec (2.10.0)
+ Using bundler (1.1.5)
+ Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
+
# UTF-8 Handling #
As Ruby 1.9 becomes more commonly used with Puppet, developers should be aware
@@ -89,10 +138,10 @@ Puppet directly from source without using install.rb or copying files around.
## Common Issues ##
* Don't assume file paths start with '/', as that is not a valid path on
- Windows. Use Puppet::Util.absolute_path? to validate that a path is fully
+ Windows. Use Puppet::Util.absolute\_path? to validate that a path is fully
qualified.
- * Use File.expand_path('/tmp') in tests to generate a fully qualified path
+ * Use File.expand\_path('/tmp') in tests to generate a fully qualified path
that is valid on POSIX and Windows. In the latter case, the current working
directory will be used to expand the path.
@@ -108,11 +157,11 @@ Puppet directly from source without using install.rb or copying files around.
IO.open(path, 'rb')
- * Don't assume file paths are separated by ':'. Use File::PATH_SEPARATOR
+ * Don't assume file paths are separated by ':'. Use `File::PATH_SEPARATOR`
instead, which is ':' on POSIX and ';' on Windows.
- * On Windows, File::SEPARATOR is '/', and File::ALT_SEPARATOR is '\'. On
- POSIX systems, File::ALT_SEPARATOR is nil. In general, use '/' as the
+ * On Windows, File::SEPARATOR is '/', and `File::ALT_SEPARATOR` is '\'. On
+ POSIX systems, `File::ALT_SEPARATOR` is nil. In general, use '/' as the
separator as most Windows APIs, e.g. CreateFile, accept both types of
separators.
@@ -123,4 +172,20 @@ Puppet directly from source without using install.rb or copying files around.
* Don't assume 'C' drive. Use environment variables to look these up:
"#{ENV['windir']}/system32/netsh.exe"
+
+# Determining the Puppet Version
+
+If you need to programmatically work with the Puppet version, please use the
+following:
+
+ require 'puppet/version'
+ # Get the version baked into the sourcecode:
+ version = Puppet.version
+ # Set the version (e.g. in a Rakefile based on `git describe`)
+ Puppet.version = '2.3.4'
+
+Please do not monkey patch the constant `Puppet::PUPPETVERSION` or obtain the
+version using the constant. The only supported way to set and get the Puppet
+version is through the accessor methods.
+
EOF
View
@@ -1,5 +1,9 @@
# Rakefile for Puppet -*- ruby -*-
+# We need access to the Puppet.version method
+$LOAD_PATH.unshift(File.expand_path("lib"))
+require 'puppet/version'
+
$LOAD_PATH << File.join(File.dirname(__FILE__), 'tasks')
begin
@@ -18,14 +22,10 @@ require 'rspec'
require "rspec/core/rake_task"
-module Puppet
- %x{which git &> /dev/null}
- if $?.success? and File.exist?('.git')
- # remove the git hash from git describe string
- PUPPETVERSION=%x{git describe}.chomp.gsub('-','.').split('.')[0..3].join('.')
- else
- PUPPETVERSION=File.read('lib/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
- end
+%x{which git &> /dev/null}
+if $?.success? and File.exist?('.git')
+ # remove the git hash from git describe string
+ Puppet.version = %x{git describe}.chomp.gsub('-','.').split('.')[0..3].join('.')
end
Dir['tasks/**/*.rake'].each { |t| load t }
@@ -45,7 +45,7 @@ FILES = FileList[
'spec/**/*'
]
-Rake::PackageTask.new("puppet", Puppet::PUPPETVERSION) do |pkg|
+Rake::PackageTask.new("puppet", Puppet.version) do |pkg|
pkg.package_dir = 'pkg'
pkg.need_tar_gz = true
pkg.package_files = FILES.to_a
View
@@ -1,3 +1,5 @@
+require 'puppet/version'
+
# Try to load rubygems. Hey rubygems, I hate you.
begin
require 'rubygems'
@@ -24,12 +26,6 @@
# it's also a place to find top-level commands like 'debug'
module Puppet
- PUPPETVERSION = '2.7.19'
-
- def Puppet.version
- PUPPETVERSION
- end
-
class << self
include Puppet::Util
attr_reader :features
@@ -16,4 +16,4 @@ Available applications, soon to be ported to Faces:
See 'puppet help <subcommand> <action>' for help on a specific subcommand action.
See 'puppet help <subcommand>' for help on a specific subcommand.
-Puppet v<%= Puppet::PUPPETVERSION %>
+Puppet v<%= Puppet.version %>
View
@@ -0,0 +1,18 @@
+# The version method and constant are isolated in puppet/version.rb so that a
+# simple `require 'puppet/version'` allows a rubygems gemspec or bundler
+# Gemfile to get the Puppet version of the gem install.
+#
+# The version is programatically settable because we want to allow the
+# Raketasks and such to set the version based on the output of `git describe`
+#
+module Puppet
+ PUPPETVERSION = '2.7.19'
+
+ def self.version
+ @puppet_version || PUPPETVERSION
+ end
+
+ def self.version=(version)
+ @puppet_version = version
+ end
+end
View
@@ -0,0 +1,32 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = "puppet"
+ s.version = "2.7.19"
+
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Puppet Labs"]
+ s.date = "2012-08-17"
+ s.description = "Puppet, an automated configuration management tool"
+ s.email = "puppet@puppetlabs.com"
+ s.executables = ["puppet"]
+ s.files = ["bin/puppet"]
+ s.homepage = "http://puppetlabs.com"
+ s.rdoc_options = ["--title", "Puppet - Configuration Management", "--main", "README", "--line-numbers"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = "puppet"
+ s.rubygems_version = "1.8.24"
+ s.summary = "Puppet, an automated configuration management tool"
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<facter>, ["~> 1.5"])
+ else
+ s.add_dependency(%q<facter>, ["~> 1.5"])
+ end
+ else
+ s.add_dependency(%q<facter>, ["~> 1.5"])
+ end
+end
View
@@ -1,4 +1,5 @@
require 'fileutils'
+require 'puppet/version'
GEM_FILES = FileList[
'[A-Z]*',
@@ -26,7 +27,7 @@ spec = Gem::Specification.new do |spec|
spec.name = 'puppet'
spec.files = GEM_FILES.to_a
spec.executables = EXECUTABLES.gsub(/sbin\/|bin\//, '').to_a
- spec.version = Puppet::PUPPETVERSION
+ spec.version = Puppet.version
spec.add_dependency('facter', '~> 1.5')
spec.summary = 'Puppet, an automated configuration management tool'
spec.description = 'Puppet, an automated configuration management tool'
@@ -52,7 +53,7 @@ desc "Create the gem"
task :create_gem => :prepare_gem do
Dir.mkdir("pkg") rescue nil
Gem::Builder.new(spec).build
- FileUtils.move("puppet-#{Puppet::PUPPETVERSION}.gem", "pkg")
+ FileUtils.move("puppet-#{Puppet.version}.gem", "pkg")
SBIN.each do |f|
fn = f.gsub(/sbin\/(.*)/, '\1')
FileUtils.rm_r "bin/" + fn
@@ -1,7 +1,7 @@
desc "Sign to the package with the Puppet Labs release key"
task :sign_packages do
-version = Puppet::PUPPETVERSION
+version = Puppet.version
# Sign package

0 comments on commit 54ea4fe

Please sign in to comment.