Module: Hoe::Deveiate
- Defined in:
- lib/hoe/deveiate.rb
Overview
A collection of Rake tasks and utility functions I use to maintain my Open Source projects.
Constant Summary
- VERSION =
Library version constant
'0.0.1'- REVISION =
Version-control revision constant
%q$Revision: eb077ae7ff6c $
Instance Attribute Summary (collapse)
-
- (Object) email_to
readonly
Returns the value of attribute email_to.
Instance Method Summary (collapse)
-
- (Object) define_deveiate_tasks
Add tasks.
-
- (Object) initialize_deveiate
Set up defaults.
Instance Attribute Details
- (Object) email_to (readonly)
Returns the value of attribute email_to
40 41 42 |
# File 'lib/hoe/deveiate.rb', line 40 def email_to @email_to end |
Instance Method Details
- (Object) define_deveiate_tasks
Add tasks
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/hoe/deveiate.rb', line 44 def define_deveiate_tasks # Rebuild the ChangeLog immediately before release task :prerelease => 'ChangeLog' # Ensure the specs pass before checking in task 'hg:precheckin' => :spec ### Task: prerelease desc "Append the package build number to package versions" task :pre do rev = get_numeric_rev() trace "Current rev is: %p" % [ rev ] hoespec.spec.version.version << "pre#{rev}" Rake::Task[:gem].clear Gem::PackageTask.new( hoespec.spec ) do |pkg| pkg.need_zip = true pkg.need_tar = true end end ### Make the ChangeLog update if the repo has changed since it was last built file '.hg/branch' file 'ChangeLog' => '.hg/branch' do |task| $stderr.puts "Updating the changelog..." content = make_changelog() File.open( task.name, 'w', 0644 ) do |fh| fh.print( content ) end end # Announcement tasks, mostly stolen from hoe-seattlerb task :announce => :send_email desc "Send a release announcement to: %p" % [ @email_to ] task :send_email do abort "no email config in your ~/.hoerc" unless defined?( @email_config ) @email_from = @email_config['from'] ||= "%s <%s>" % self.developer.first = generate_email( :full ) say "About to send this:" say( ) if agree( "Okay to send it? " ) require 'socket' require 'net/smtp' require 'etc' username = ask( "Email username: " ) do |q| q.default = Etc.getlogin # default to the current user end password = ask( "Email password: " ) do |q| q.echo = '*' # Hide the password end say "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}" smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT ) smtp.set_debug_output( $stderr ) smtp.esmtp = true smtp.enable_starttls helo = Socket.gethostname smtp.start( helo, username, password, :plain ) do |smtp| smtp.( , self.email_from, *self.email_to ) end else abort "Okay, aborting." end end end |
- (Object) initialize_deveiate
Set up defaults
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hoe/deveiate.rb', line 26 def initialize_deveiate self. = true @email_to = [] with_config do |config, _| self.spec_extras[:signing_key] = config['signing_key_file'] or abort "no signing key ('signing_key_file') configured." @email_config = config['email'] @email_to = Array( @email_config['to'] ) end end |