Issue #1638 has been updated by jamtur01.

Affected version set to 0.24.6

Sample rake task I am going to steal:

<pre>
  namespace :git do
    desc "Create a changelog (doc/changelog.html and doc/changelog.xml) based 
on your git commits."
    task :changelog do
      require 'time'
      require 'rexml/document'
 
      DOC_DIR = "#{Dir.pwd}/doc"
 
      # Create commit messages xml as part of the documentation in doc/
      xml_body=`git log --pretty=format:'<commit 
id="%H">%n<date>%aD</date>%n<author><![CDATA[%an]]></author><author-email><![CDATA[%ae]]></author-email>%n<subject><![CDATA[%s]]></subject><msg>%n<![CDATA[%n%b%n]]>%n</msg>%n</commit>'`
      xml = "<?xml version=\"1.0\"?>\n<commits 
created=\"#{Time.now.iso8601}\">\n#{xml_body}\n</commits>"
 
      mkdir(DOC_DIR) unless File.directory?(DOC_DIR)
 
      File.open(File.join(DOC_DIR, "changelog.xml"), 'w') do |f|
        f << xml
      end
 
      HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => 
'&lt;' }
  
      def html_escape(s)
        s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
      end
 
      # Create a changelog html in public/
      doc = REXML::Document.new(xml)
      html = "<h1>Changelog - #{doc.root.attributes['created']}</h1>\n\n"
      doc.elements.each('commits/commit') do |ci|
        date = ci.elements["date"].text
        author = ci.elements["author"].text
        subject = ci.elements["subject"].text
        msg = ci.elements["msg"].cdatas
        html << "<div class=\"commit\" id=\"#{ci.attributes['id']}\">\n"
        html << "<span class=\"date\">Date: #{date}</span>\n"
        html << "<span class=\"author\">Author: #{html_escape(author)}</span>\n"
        html << "<h2>#{html_escape(subject)}</h2>\n"
        html << "<pre class=\"msg\">#{html_escape(msg)}</pre>\n"
        html << "</div>\n"
      end
 
      File.open(File.join(DOC_DIR, "changelog.html"), 'w') do |f|
        f << File.open(File.join("tasks", 
"changelog.tmpl")).read.gsub(/@html@/, html)
      end
 
      # Changelog commiten
      `git add #{DOC_DIR}/changelog.html #{DOC_DIR}/changelog.xml`
      `git commit -m "Update changelog"`
    end
    
  end # end namespace git
</pre>
----------------------------------------
Refactor #1638: Generate CHANGELOG file at release time to minimize conflicts 
when merging (and save extra typing)
http://projects.reductivelabs.com/issues/show/1638

Author: tmz
Status: Accepted
Priority: Normal
Assigned to: jamtur01
Category: plumbing
Target version: unplanned
Affected version: 0.24.6


As 
"discussed":http://groups.google.com/group/puppet-dev/msg/3bd474abe7558e65?hl=en
 on puppet-dev[1], generating the CHANGELOG at release time instead of editing 
it along with each commit should help minimize the frequent conflicts it causes 
when merging and applying patches.  The thread linked below has a few ideas for 
how to achieve this, but help on integrating this with puppet's release process 
is still needed.  I'd be happy to try and help with this, though I don't know 
my way around the puppet release process and rake much (yet).

Here's a short example of one way to achieve this that I suggested in the 
puppet-dev thread:

<pre>
> Say we update CHANGELOG only at release time, then the previous
> release tag would be in the first line and could be used.  Some
> pseudo/sh code as an example:
>
> # somewhere in the bowels of the puppet release process...
> # ...in a galaxy far, far away...
> #
> # have this passed in to the Rakefile or pulled from a version string
> # in the source somewhere?
> cur_rel=0.24.6
> prev_rel=$(head -1 CHANGELOG)
>
> # update the CHANGELOG
> echo $cur_rel > CHANGELOG.tmp
> git log --pretty=format:'    %s%n' $prev_rel..$cur_rel >> CHANGELOG.tmp
> echo "" >> CHANGELOG.tmp
> cat CHANGELOG>> CHANGELOG.tmp
> mv CHANGELOG.tmp CHANGELOG 
</pre>

According to 
"DevelopmentLifecycle":http://reductivelabs.com/trac/puppet/wiki/DevelopmentLifecycle#building-releases
 the release we'd be building is passed into rake as REL, so that answers my 
question about how to determine the release.

The DevelopmentLifecycle page also says that the rake command needs to be run 
on laeg.  Is there a (documented) way for me to test this locally so I can see 
about whipping up a patch?

[1] http://groups.google.com/group/puppet-dev/msg/3bd474abe7558e65?hl=en


----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to