heel 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/tasks/config.rb DELETED
@@ -1,103 +0,0 @@
1
- require 'configuration'
2
-
3
- require 'rake'
4
- require 'heel'
5
- require 'heel/configuration'
6
- require 'heel/version'
7
-
8
- require 'tasks/utils'
9
-
10
- #-----------------------------------------------------------------------
11
- # General project configuration
12
- #-----------------------------------------------------------------------
13
- Configuration.for('project') {
14
- name Heel.to_s.downcase
15
- version Heel::VERSION
16
- author "Jeremy Hinegardner"
17
- email "jeremy at hinegardner dot org"
18
- homepage Heel::Configuration::HOMEPAGE
19
- description Utils.section_of("README", "description")
20
- summary description.split(".").first
21
- history "HISTORY"
22
- license "LICENSE"
23
- readme "README"
24
- }
25
-
26
- #-----------------------------------------------------------------------
27
- # Packaging
28
- #-----------------------------------------------------------------------
29
- Configuration.for('packaging') {
30
- # files in the project
31
- proj_conf = Configuration.for('project')
32
- files {
33
- bin FileList["bin/*"]
34
- lib FileList["lib/**/*.rb"]
35
- test FileList["spec/**/*.rb"]
36
- data FileList["data/**/*"]
37
- tasks FileList["tasks/**/*.r{ake,b}"]
38
- rdoc FileList[proj_conf.readme, proj_conf.history,
39
- proj_conf.license] + lib
40
- all bin + lib + test + data + rdoc + tasks
41
- }
42
-
43
- # ways to package the results
44
- formats {
45
- tgz true
46
- zip true
47
- rubygem Configuration::Table.has_key?('rubygem')
48
- }
49
- }
50
-
51
- #-----------------------------------------------------------------------
52
- # Gem packaging
53
- #-----------------------------------------------------------------------
54
- Configuration.for("rubygem") {
55
- spec "gemspec.rb"
56
- Configuration.for('packaging').files.all << spec
57
- }
58
-
59
- #-----------------------------------------------------------------------
60
- # Testing
61
- #-----------------------------------------------------------------------
62
- Configuration.for('test') {
63
- mode "spec"
64
- files Configuration.for("packaging").files.test
65
- options %w[ --format specdoc --color ]
66
- ruby_opts %w[ ]
67
- }
68
-
69
- #-----------------------------------------------------------------------
70
- # Rcov
71
- #-----------------------------------------------------------------------
72
- Configuration.for('rcov') {
73
- output_dir "coverage"
74
- libs %w[ lib ]
75
- rcov_opts %w[ --html ]
76
- ruby_opts %w[ ]
77
- test_files Configuration.for('packaging').files.test
78
-
79
- # hmm... how to configure remote publishing
80
- }
81
-
82
- #-----------------------------------------------------------------------
83
- # Rdoc
84
- #-----------------------------------------------------------------------
85
- Configuration.for('rdoc') {
86
- files Configuration.for('packaging').files.rdoc
87
- main files.first
88
- title Configuration.for('project').name
89
- options %w[ --line-numbers --inline-source ]
90
- output_dir "doc"
91
- }
92
-
93
- #-----------------------------------------------------------------------
94
- # Rubyforge
95
- #-----------------------------------------------------------------------
96
- Configuration.for('rubyforge') {
97
- project "copiousfreetime"
98
- user "jjh"
99
- host "rubyforge.org"
100
- rdoc_location "#{user}@#{host}:/var/www/gforge-projects/copiousfreetime/heel"
101
- }
102
-
103
-
@@ -1,47 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-------------------------------------------------------------------------------
4
- # Distribution and Packaging
5
- #-------------------------------------------------------------------------------
6
- if pkg_config = Configuration.for_if_exist?("packaging") then
7
-
8
- require 'gemspec'
9
- require 'rake/gempackagetask'
10
- require 'rake/contrib/sshpublisher'
11
-
12
- namespace :dist do
13
-
14
- Rake::GemPackageTask.new(Heel::GEM_SPEC) do |pkg|
15
- pkg.need_tar = pkg_config.formats.tgz
16
- pkg.need_zip = pkg_config.formats.zip
17
- end
18
-
19
- desc "Install as a gem"
20
- task :install => [:clobber, :package] do
21
- sh "sudo gem install --local pkg/#{Heel::GEM_SPEC.full_name}.gem"
22
- end
23
-
24
- desc "Uninstall gem"
25
- task :uninstall do
26
- sh "sudo gem uninstall -i #{Heel::GEM_SPEC.name} -x"
27
- end
28
-
29
- desc "dump gemspec"
30
- task :gemspec do
31
- puts Heel::GEM_SPEC.to_ruby
32
- end
33
-
34
- desc "reinstall gem"
35
- task :reinstall => [:uninstall, :repackage, :install]
36
-
37
- desc "distribute copiously"
38
- task :copious => [:package] do
39
- Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
40
- '/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
41
- 'pkg',"#{Heel::GEM_SPEC.full_name}.gem").upload
42
- sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
43
- end
44
-
45
-
46
- end
47
- end
@@ -1,36 +0,0 @@
1
- #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
- #++
5
-
6
- require 'tasks/config'
7
-
8
- #-----------------------------------------------------------------------
9
- # Documentation
10
- #-----------------------------------------------------------------------
11
-
12
- if rdoc_config = Configuration.for_if_exist?('rdoc') then
13
-
14
- namespace :doc do
15
-
16
- require 'rdoc'
17
- require 'rake/rdoctask'
18
-
19
- # generating documentation locally
20
- Rake::RDocTask.new do |rdoc|
21
- rdoc.rdoc_dir = rdoc_config.output_dir
22
- rdoc.options = rdoc_config.options
23
- rdoc.rdoc_files = rdoc_config.files
24
- rdoc.title = rdoc_config.title
25
- rdoc.main = rdoc_config.main
26
- end
27
-
28
- if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
29
- desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
30
- task :deploy => :rerdoc do
31
- sh "rsync -zav --delete #{rdoc_config.output_dir}/ #{rubyforge_config.rdoc_location}"
32
- end
33
- end
34
-
35
- end
36
- end
data/tasks/rspec.rb DELETED
@@ -1,34 +0,0 @@
1
- #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
- #++
5
-
6
- require 'tasks/config'
7
-
8
- #-------------------------------------------------------------------------------
9
- # configuration for running rspec. This shows up as the test:default task
10
- #-------------------------------------------------------------------------------
11
-
12
- if spec_config = Configuration.for_if_exist?('test') then
13
-
14
- namespace :test do
15
-
16
- task :default => :spec
17
-
18
- require 'spec/rake/spectask'
19
- Spec::Rake::SpecTask.new do |r|
20
- r.rcov = spec_config.ruby_opts
21
- r.libs = [ Heel::Configuration.lib_path,
22
- Heel::Configuration.root_dir ]
23
- r.spec_files = spec_config.files
24
- r.spec_opts = spec_config.options
25
-
26
- if rcov_config = Configuration.for_if_exist?('rcov') then
27
- r.rcov = true
28
- r.spec_opts = %w(--format specdoc --color)
29
- r.rcov_dir = rcov_config.output_dir
30
- r.rcov_opts = rcov_config.rcov_opts
31
- end
32
- end
33
- end
34
- end
data/tasks/rubyforge.rb DELETED
@@ -1,67 +0,0 @@
1
- #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
- #++
5
-
6
- require 'tasks/config'
7
-
8
- #-----------------------------------------------------------------------
9
- # Rubyforge additions to the task library
10
- #-----------------------------------------------------------------------
11
- if rf_conf = Configuration.for_if_exist?('rubyforge') then
12
- require 'rubyforge'
13
-
14
- proj_conf = Configuration.for('project')
15
-
16
- namespace :dist do
17
- desc "Release files to rubyforge"
18
- task :rubyforge => [:clean, :package] do
19
-
20
- rubyforge = ::RubyForge.new
21
-
22
- config = {}
23
- config["release_notes"] = proj_conf.description
24
- config["release_changes"] = Utils.release_notes_from( proj_conf.history )[Heel::VERSION]
25
- config["Preformatted"] = true
26
-
27
- rubyforge.configure config
28
-
29
- # make sure this release doesn't already exist
30
- releases = rubyforge.autoconfig['release_ids']
31
- if releases.has_key?(proj_conf.name) and releases[proj_conf.name][Heel::VERSION] then
32
- abort("Release #{Heel::VERSION} already exists! Unable to release.")
33
- end
34
-
35
-
36
- puts "Uploading to rubyforge..."
37
- files = FileList[File.join("pkg","#{proj_conf.name}-#{Heel::VERSION}*.*")].to_a
38
- files.each do |f|
39
- puts " * #{f}"
40
- end
41
-
42
- rubyforge.login
43
- rubyforge.add_release(rf_conf.project, proj_conf.name, Heel::VERSION, *files)
44
-
45
- puts "done."
46
- end
47
- end
48
-
49
- namespace :announce do
50
- desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
51
- task :rubyforge do
52
- info = Utils.announcement
53
-
54
- puts "Subject : #{info['subject']}"
55
- msg = "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}"
56
- puts msg
57
-
58
-
59
- rubyforge = RubyForge.new
60
- rubyforge.configure
61
- rubyforge.login
62
- rubyforge.post_news( rf_conf.project, info[:subject], msg )
63
- puts "Posted to rubyforge"
64
- end
65
-
66
- end
67
- end
data/tasks/utils.rb DELETED
@@ -1,85 +0,0 @@
1
- #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
- #++
5
-
6
- require 'heel/version'
7
-
8
- #-------------------------------------------------------------------------------
9
- # Additions to the Configuration class that are useful
10
- #-------------------------------------------------------------------------------
11
- class Configuration
12
- class << self
13
- def exist?( name )
14
- Configuration::Table.has_key?( name )
15
- end
16
-
17
- def for_if_exist?( name )
18
- if self.exist?( name ) then
19
- self.for( name )
20
- end
21
- end
22
- end
23
- end
24
-
25
- #-------------------------------------------------------------------------------
26
- # some useful utilitiy methods for the tasks
27
- #-------------------------------------------------------------------------------
28
- module Utils
29
- class << self
30
-
31
- # Try to load the given _library_ using the built-in require, but do not
32
- # raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
33
- # successfully loaded; returns +false+ otherwise.
34
- #
35
- def try_require( lib )
36
- require lib
37
- true
38
- rescue LoadError
39
- false
40
- end
41
-
42
- # partition an rdoc file into sections, and return the text of the section
43
- # given.
44
- def section_of(file, section_name)
45
- File.read(file).split(/^(?==)/).each do |section|
46
- lines = section.split("\n")
47
- return lines[1..-1].join("\n").strip if lines.first =~ /#{section_name}/i
48
- end
49
- nil
50
- end
51
-
52
- # Get an array of all the changes in the application for a particular
53
- # release. This is done by looking in the history file and grabbing the
54
- # information for the most recent release. The history file is assumed to
55
- # be in RDoc format and version release are 2nd tier sections separated by
56
- # '== Version X.Y.Z'
57
- #
58
- # returns:: A hash of notes keyed by version number
59
- #
60
- def release_notes_from(history_file)
61
- releases = {}
62
- File.read(history_file).split(/^(?=== Version)/).each do |section|
63
- lines = section.split("\n")
64
- md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
65
- next unless md
66
- releases[md[1]] = lines[1..-1].join("\n").strip
67
- end
68
- return releases
69
- end
70
-
71
- # return a hash of useful information for the latest release
72
- # urls, subject, title, description and latest release notes
73
- #
74
- def announcement
75
- cfg = Configuration.for("project")
76
- {
77
- :subject => "#{cfg.name} #{Heel::VERSION} Released",
78
- :title => "#{cfg.name} version #{Heel::VERSION} has been released.",
79
- :urls => "#{cfg.homepage}",
80
- :description => "#{cfg.description.rstrip}",
81
- :release_notes => Utils.release_notes_from(cfg.history)[Heel::VERSION].rstrip
82
- }
83
- end
84
- end
85
- end # << self