Skip to content

Commit

Permalink
Fixed marklogic-community#441: allowed saving commit info in src
Browse files Browse the repository at this point in the history
  • Loading branch information
grtjn committed Jul 8, 2015
1 parent aefee7f commit 6afb16c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,26 @@ def deploy_src
load_css_as_binary = @properties['ml.load-css-as-binary']
folders_to_ignore = @properties['ml.ignore-folders']

if @properties['ml.save-commit-info'] == 'true'

if File.exists? ".svn"
svn_info_file = File.new("#{xquery_dir}/svn-info.xml", "w")
svn_info_file.puts(`svn info --xml`)
svn_info_file.close
@logger.info "Saved commit info as #{xquery_dir}/svn-info.xml"

elsif File.exists? ".git"
git_info_file = File.new("#{xquery_dir}/git-info.xml", "w")
git_info_file.puts(`git log -1 --pretty=format:"<entry><id>%H</id><author>%an</author><date>%ai</date><subject>%s</subject><body>%b</body></entry>"`)
git_info_file.close
@logger.info "Saved commit info as #{xquery_dir}/git-info.xml"

else
@logger.warn "Only SVN and GIT supported for save-commit-info"
end

end

modules_databases.each do |dest_db|
if dest_db == "filesystem"
logger.info "Skipping deployment of src to #{dest_db}.."
Expand Down
3 changes: 3 additions & 0 deletions deploy/sample/build.sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,6 @@ mlcp-vmargs=-Xmx512m

# folder to ignore when deploying into modules database
#ignore-folders=.*/src/(node_modules|.tmp)/.*

# enable the following to save and upload svn/git commit info upon deploy modules
save-commit-info=false

0 comments on commit 6afb16c

Please sign in to comment.