Class: HoeLike

Inherits:
Object
  • Object
show all
Defined in:
lib/s4t-utils/hoelike.rb

Overview

HoeLike is intended to be used with the Hoe gem. It adds some Rake tasks.

  • slow: Runs tests whose filenames are ‘*-slowtests.rb’

  • fast: Runs all tests, skipping slow tests.

  • upload_pages: copy website pages up to Rubyforge

  • export_and_upload_pages: upload_pages without any garbage or .svn files lying around.

  • tag_release: Make a Subversion tag called rel-X.Y.Z. Release number is gotten from lib/name/version.rb.

  • export: export entire project to pristine temp directory.

  • release_everything: Release code, rdoc, and website to rubyforge.

Instance Method Summary collapse

Constructor Details

#initialize(keys) ⇒ HoeLike

Returns a new instance of HoeLike.



40
41
42
43
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
# File 'lib/s4t-utils/hoelike.rb', line 40

def initialize(keys)
  @keys = keys
  project = pull(:project)
  this_release = pull(:this_release)
   = pull(:login)
  web_site_root = pull(:web_site_root)
  export_root = pull(:export_root)
  
  root = "svn+ssh://#{}/var/svn/#{project}"
  project_exports = "#{export_root}/#{project}"
  
  desc "Run fast tests."
  task 'fast' do
    S4tUtils.run_particular_tests('test', 'fast')
  end
  
  desc "Run slow tests."
  task 'slow' do
    S4tUtils.run_particular_tests('test', 'slow')
  end
  
  desc "Upload all the web pages (as part of release)"
  task 'upload_pages' do | task |
    assert_in(project_exports, task.name)
    exec = "scp -r #{web_site_root}/* #{}:/var/www/gforge-projects/#{project}/"
    puts exec
    system(exec)
  end
  
  desc "Upload all the web pages (not as part of release)"
  task 'export_and_upload_pages' => 'export' do | task |
    Dir.chdir(project_exports) do
      exec = "scp -r #{web_site_root}/* #{}:/var/www/gforge-projects/#{project}/"
      puts exec
      system(exec)
    end
  end

  desc "Tag release with current version."
  task 'tag_release' do
    from = "#{root}/trunk"
    to = "#{root}/tags/rel-#{this_release}"
    message = "Release #{this_release}"
    exec = "svn copy -m '#{message}' #{from} #{to}"
    puts exec
    system(exec)
  end
  
  desc "Export to #{project_exports}"
  task 'export' do 
    Dir.chdir(export_root) do
      rm_rf project
      exec = "svn export #{root}/trunk #{project}"
      puts exec
      system exec
    end
  end
  

  desc "Complete release of everything - asks for confirmation after steps"
  # Because in Ruby 1.8.6, Rake doesn't notice subtask failures, so it
  # won't stop for us.
  task 'release_everything' do  
    confirmed_step 'check_manifest'
    confirmed_step 'export'
    Dir.chdir(project_exports) do
      puts "Working in #{Dir.pwd}"
      confirmed_step 'test'
      confirmed_step 'upload_pages'
      confirmed_step 'publish_docs'
      ENV['VERSION'] = this_release
      confirmed_step 'release'
    end
    confirmed_step 'tag_release'
  end

end