tasks/toolbelt.rb in quandl-0.3.7 vs tasks/toolbelt.rb in quandl-0.4.0

- old
+ new

@@ -13,10 +13,14 @@ def resource_path @resource_path ||= File.join(root_path, "dist/resources/") end + def pkg_releases_path + @pkg_releases_path ||= File.join( build_path, 'releases' ) + end + def release_path @release_path ||= File.join(tarball_path, "quandl-command" ) end def pkg_path @@ -44,16 +48,16 @@ end def trace? Rake.application.options.trace == true end - + end attr_accessor :args, :options, :block - delegate :root_path, :ruby_pkg_path, :pkg_path, :tmp_path, :build_path, :tarball_path, :release_path, :resource_path, :trace?, to: :class + delegate :root_path, :ruby_pkg_path, :pkg_path, :tmp_path, :build_path, :tarball_path, :pkg_releases_path, :release_path, :resource_path, :trace?, to: :class def initialize(*args, &block) self.options = OpenStruct.new(args.extract_options!) self.args = args self.block = block @@ -69,9 +73,29 @@ puts "args: #{args}, options: #{options}" if trace? call ensure run_callbacks(:ensure) end + end + + def timestamp + @timestamp ||= (Time.now.getutc.to_f * 10000).to_i.to_s.gsub('.','') + end + + def git_short_reference + @git_short_reference ||= git_reference[0..7] + end + + def git_reference + @git_reference ||= `git rev-parse HEAD`.strip.rstrip + end + + def git_branch + @git_branch ||= `git rev-parse --abbrev-ref HEAD`.strip.rstrip + end + + def prerelease_information + "(#{git_branch.split('/').first}/#{git_short_reference})" unless git_branch == 'master' end def revision @revision ||= options.revision.to_s.gsub("/","-") || "master" end \ No newline at end of file