rabal 0.2.3 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{CHANGES → HISTORY} +23 -7
- data/README +96 -66
- data/bin/rabal +6 -7
- data/gemspec.rb +47 -0
- data/lib/rabal.rb +63 -19
- data/lib/rabal/application.rb +4 -4
- data/lib/rabal/plugin/foundation.rb +4 -3
- data/lib/rabal/version.rb +16 -14
- data/resources/trees/bin/rabal.project +7 -8
- data/resources/trees/core/HISTORY.erb +4 -0
- data/resources/trees/core/README.erb +6 -0
- data/resources/trees/core/Rakefile.erb +53 -7
- data/resources/trees/core/gemspec.rb.erb +48 -0
- data/resources/trees/core/lib/rabal.project.rb.erb +52 -20
- data/resources/trees/core/lib/rabal.project/version.rb.erb +21 -13
- data/resources/trees/core/tasks/announce.rake.erb +36 -54
- data/resources/trees/core/tasks/config.rb.erb +107 -0
- data/resources/trees/core/tasks/distribution.rake.erb +19 -13
- data/resources/trees/core/tasks/documentation.rake.erb +25 -19
- data/resources/trees/core/tasks/utils.rb.erb +80 -0
- data/resources/trees/ext/tasks/extension.rake.erb +42 -10
- data/resources/trees/rubyforge/tasks/rubyforge.rake.erb +48 -40
- data/resources/trees/spec/spec/rabal.project_spec.rb.erb +10 -10
- data/resources/trees/spec/tasks/rspec.rake.erb +23 -18
- data/resources/trees/test/tasks/testunit.rake.erb +14 -9
- data/resources/trees/test/test/rabal.project_test.rb.erb +6 -6
- data/resources/trees/website/tasks/site.rake.erb +5 -5
- data/spec/application_spec.rb +3 -3
- data/spec/bin_plugin_spec.rb +1 -1
- data/spec/core_plugin_spec.rb +1 -1
- data/spec/license_plugin_spec.rb +1 -1
- data/spec/plugin_tree_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -6
- data/spec/spec_plugin_spec.rb +1 -1
- data/spec/test_plugin_spec.rb +1 -1
- data/tasks/announce.rake +40 -0
- data/tasks/config.rb +99 -0
- data/tasks/distribution.rake +45 -0
- data/tasks/documentation.rake +31 -0
- data/tasks/rspec.rake +29 -0
- data/tasks/rubyforge.rake +52 -0
- data/tasks/utils.rb +80 -0
- metadata +105 -59
- data/Rakefile +0 -12
- data/lib/rabal/specification.rb +0 -128
- data/resources/trees/core/CHANGES.erb +0 -4
- data/resources/trees/core/lib/rabal.project/gemspec.rb.erb +0 -51
- data/resources/trees/core/lib/rabal.project/specification.rb.erb +0 -128
- data/resources/trees/core/tasks/setup.rb.erb +0 -40
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'configuration'
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'tasks/utils'
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------
|
7
|
+
# General project configuration
|
8
|
+
#-----------------------------------------------------------------------
|
9
|
+
Configuration.for('project') {
|
10
|
+
name "FIXME: NAME"
|
11
|
+
version "FIXME: 0.0.0"
|
12
|
+
author "FIXME: The Author"
|
13
|
+
email "FIXME: author@example.com"
|
14
|
+
homepage "FIXME: http://project.example.com"
|
15
|
+
description Utils.section_of("README", "description")
|
16
|
+
summary description.split(".").first
|
17
|
+
history "HISTORY"
|
18
|
+
license FileList["LICENSE", "COPYING"]
|
19
|
+
readme "README"
|
20
|
+
}
|
21
|
+
|
22
|
+
#-----------------------------------------------------------------------
|
23
|
+
# Packaging
|
24
|
+
#-----------------------------------------------------------------------
|
25
|
+
Configuration.for('packaging') {
|
26
|
+
# files in the project
|
27
|
+
proj_conf = Configuration.for('project')
|
28
|
+
files {
|
29
|
+
bin FileList["bin/*"]
|
30
|
+
ext FileList["ext/*.{c,h,rb}"]
|
31
|
+
lib FileList["lib/**/*.rb"]
|
32
|
+
test FileList["spec/**/*.rb", "test/**/*.rb"]
|
33
|
+
data FileList["data/**/*"]
|
34
|
+
tasks FileList["tasks/**/*.r{ake,b}"]
|
35
|
+
rdoc FileList[proj_conf.readme, proj_conf.history,
|
36
|
+
proj_conf.license] + lib
|
37
|
+
all bin + ext + lib + test + data + rdoc + tasks
|
38
|
+
}
|
39
|
+
|
40
|
+
# ways to package the results
|
41
|
+
formats {
|
42
|
+
tgz true
|
43
|
+
zip true
|
44
|
+
gem Configuration::Table.has_key?('gem')
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
#-----------------------------------------------------------------------
|
49
|
+
# Gem packaging
|
50
|
+
#-----------------------------------------------------------------------
|
51
|
+
Configuration.for("gem") {
|
52
|
+
spec "gemspec.rb"
|
53
|
+
Configuration.for('packaging').files.all << spec
|
54
|
+
}
|
55
|
+
|
56
|
+
#-----------------------------------------------------------------------
|
57
|
+
# Testing
|
58
|
+
# - change mode to 'testunit' to use unit testing
|
59
|
+
#-----------------------------------------------------------------------
|
60
|
+
Configuration.for('test') {
|
61
|
+
mode "spec"
|
62
|
+
files Configuration.for("packaging").files.test
|
63
|
+
options %w[ --format specdoc --color ]
|
64
|
+
ruby_opts %w[ ]
|
65
|
+
}
|
66
|
+
|
67
|
+
#-----------------------------------------------------------------------
|
68
|
+
# Rcov
|
69
|
+
#-----------------------------------------------------------------------
|
70
|
+
Configuration.for('rcov') {
|
71
|
+
output_dir "coverage"
|
72
|
+
libs %w[ lib ]
|
73
|
+
rcov_opts %w[ --html ]
|
74
|
+
ruby_opts %w[ ]
|
75
|
+
test_files Configuration.for('packaging').files.test
|
76
|
+
}
|
77
|
+
|
78
|
+
#-----------------------------------------------------------------------
|
79
|
+
# Rdoc
|
80
|
+
#-----------------------------------------------------------------------
|
81
|
+
Configuration.for('rdoc') {
|
82
|
+
files Configuration.for('packaging').files.rdoc
|
83
|
+
main_page files.first
|
84
|
+
title Configuration.for('project').name
|
85
|
+
options %w[ --line-numbers --inline-source ]
|
86
|
+
output_dir "doc"
|
87
|
+
}
|
88
|
+
|
89
|
+
#-----------------------------------------------------------------------
|
90
|
+
# Extensions
|
91
|
+
#-----------------------------------------------------------------------
|
92
|
+
Configuration.for('extension') {
|
93
|
+
configs Configuration.for('packaging').files.ext.find_all { |x|
|
94
|
+
%w[ mkrf_conf.rb extconf.rb ].include?( File.basename(x) )
|
95
|
+
}
|
96
|
+
}
|
97
|
+
#-----------------------------------------------------------------------
|
98
|
+
# Rubyforge
|
99
|
+
#-----------------------------------------------------------------------
|
100
|
+
Configuration.for('rubyforge') {
|
101
|
+
project "FIXME: rubyforge project"
|
102
|
+
user "FIXME: username"
|
103
|
+
host "rubyforge.org"
|
104
|
+
rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}"
|
105
|
+
}
|
106
|
+
|
107
|
+
|
@@ -1,32 +1,38 @@
|
|
1
|
-
|
1
|
+
require 'tasks/config'
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------------
|
2
4
|
# Distribution and Packaging
|
3
|
-
|
4
|
-
|
5
|
+
#-------------------------------------------------------------------------------
|
6
|
+
if pkg_config = Configuration.for_if_exist?("packaging") then
|
7
|
+
|
8
|
+
require 'gemspec'
|
9
|
+
require 'rake/gempackagetask'
|
10
|
+
require 'rake/contrib/sshpublisher'
|
5
11
|
|
6
|
-
|
12
|
+
namespace :dist do
|
7
13
|
|
8
|
-
Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
|
9
|
-
|
10
|
-
|
14
|
+
Rake::GemPackageTask.new(<%= project_name.camelize %>::GEM_SPEC) do |pkg|
|
15
|
+
pkg.need_tar = pkg_config.formats.tgz
|
16
|
+
pkg.need_zip = pkg_config.formats.zip
|
11
17
|
end
|
12
18
|
|
13
19
|
desc "Install as a gem"
|
14
20
|
task :install => [:clobber, :package] do
|
15
|
-
|
21
|
+
sh "sudo gem install pkg/#{<%= project_name.camelize %>::GEM_SPEC.full_name}.gem"
|
16
22
|
end
|
17
23
|
|
18
|
-
# uninstall the gem and all executables
|
19
24
|
desc "Uninstall gem"
|
20
25
|
task :uninstall do
|
21
|
-
|
26
|
+
sh "sudo gem uninstall -x #{<%= project_name.camelize %>::GEM_SPEC.name}"
|
22
27
|
end
|
23
28
|
|
24
29
|
desc "dump gemspec"
|
25
30
|
task :gemspec do
|
26
|
-
|
31
|
+
puts <%= project_name.camelize %>::GEM_SPEC.to_ruby
|
27
32
|
end
|
28
33
|
|
29
34
|
desc "reinstall gem"
|
30
|
-
task :reinstall => [:uninstall, :install]
|
35
|
+
task :reinstall => [:uninstall, :repackage, :install]
|
31
36
|
|
32
|
-
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,25 +1,31 @@
|
|
1
|
+
require 'tasks/config'
|
2
|
+
|
1
3
|
#-----------------------------------------------------------------------
|
2
4
|
# Documentation
|
3
5
|
#-----------------------------------------------------------------------
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
if rdoc_config = Configuration.for_if_exist?('rdoc') then
|
8
|
+
|
9
|
+
namespace :doc do
|
10
|
+
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
|
7
13
|
# generating documentation locally
|
8
14
|
Rake::RDocTask.new do |rdoc|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
rdoc.rdoc_dir = rdoc_config.output_dir
|
16
|
+
rdoc.options = rdoc_config.options
|
17
|
+
rdoc.rdoc_files = rdoc_config.files
|
18
|
+
rdoc.title = rdoc_config.title
|
19
|
+
rdoc.main = rdoc_config.main_page
|
20
|
+
end
|
21
|
+
|
22
|
+
if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
|
23
|
+
desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
|
24
|
+
task :deploy => :rerdoc do
|
25
|
+
sh "rsync -zav --delete #{rdoc_config.output_dir}/ #{rubyforge_config.rdoc_location}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require '<%= project_name %>/version'
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------------
|
4
|
+
# Additions to the Configuration class that are useful
|
5
|
+
#-------------------------------------------------------------------------------
|
6
|
+
class Configuration
|
7
|
+
class << self
|
8
|
+
def exist?( name )
|
9
|
+
Configuration::Table.has_key?( name )
|
10
|
+
end
|
11
|
+
|
12
|
+
def for_if_exist?( name )
|
13
|
+
if self.exist?( name ) then
|
14
|
+
self.for( name )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#-------------------------------------------------------------------------------
|
21
|
+
# some useful utilitiy methods for the tasks
|
22
|
+
#-------------------------------------------------------------------------------
|
23
|
+
module Utils
|
24
|
+
class << self
|
25
|
+
|
26
|
+
# Try to load the given _library_ using the built-in require, but do not
|
27
|
+
# raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
|
28
|
+
# successfully loaded; returns +false+ otherwise.
|
29
|
+
#
|
30
|
+
def try_require( lib )
|
31
|
+
require lib
|
32
|
+
true
|
33
|
+
rescue LoadError
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
37
|
+
# partition an rdoc file into sections, and return the text of the section
|
38
|
+
# given.
|
39
|
+
def section_of(file, section_name)
|
40
|
+
File.read(file).split(/^(?==)/).each do |section|
|
41
|
+
lines = section.split("\n")
|
42
|
+
return lines[1..-1].join("\n").strip if lines.first =~ /#{section_name}/i
|
43
|
+
end
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get an array of all the changes in the application for a particular
|
48
|
+
# release. This is done by looking in the history file and grabbing the
|
49
|
+
# information for the most recent release. The history file is assumed to
|
50
|
+
# be in RDoc format and version release are 2nd tier sections separated by
|
51
|
+
# '== Version X.Y.Z'
|
52
|
+
#
|
53
|
+
# returns:: A hash of notes keyed by version number
|
54
|
+
#
|
55
|
+
def release_notes_from(history_file)
|
56
|
+
releases = {}
|
57
|
+
File.read(history_file).split(/^(?==)/).each do |section|
|
58
|
+
lines = section.split("\n")
|
59
|
+
md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
|
60
|
+
next unless md
|
61
|
+
releases[md[1]] = lines[1..-1].join("\n").strip
|
62
|
+
end
|
63
|
+
return releases
|
64
|
+
end
|
65
|
+
|
66
|
+
# return a hash of useful information for the latest release
|
67
|
+
# urls, subject, title, description and latest release notes
|
68
|
+
#
|
69
|
+
def announcement
|
70
|
+
cfg = Configuration.for("project")
|
71
|
+
{
|
72
|
+
:subject => "#{cfg.name} #{<%= project_name.camelize %>::VERSION} Released",
|
73
|
+
:title => "#{cfg.name} version #{<%= project_name.camelize %>::VERSION} has been released.",
|
74
|
+
:urls => "#{cfg.homepage}",
|
75
|
+
:description => "#{cfg.description.rstrip}",
|
76
|
+
:release_notes => Utils.release_notes_from(cfg.history)[<%= project_name.camelize %>::VERSION].rstrip
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end # << self
|
@@ -1,15 +1,47 @@
|
|
1
|
-
|
1
|
+
require 'tasks/config'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
#-----------------------------------------------------------------------
|
5
|
+
# Extensions
|
6
|
+
#-----------------------------------------------------------------------
|
7
|
+
if ext_config = Configuration.for_if_exist?('extension') then
|
8
|
+
|
9
|
+
namespace :ext do
|
2
10
|
desc "Build the extension(s)"
|
3
11
|
task :build do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
ext_config.configs.each do |extension|
|
13
|
+
path = Pathname.new(extension)
|
14
|
+
parts = path.split
|
15
|
+
conf = parts.last
|
16
|
+
Dir.chdir(path.dirname) do |d|
|
17
|
+
ruby conf.to_s
|
18
|
+
sh "rake default"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task :clean do
|
24
|
+
ext_config.configs.each do |extension|
|
25
|
+
path = Pathname.new(extension)
|
26
|
+
parts = path.split
|
27
|
+
conf = parts.last
|
28
|
+
Dir.chdir( path.dirname )do |d|
|
29
|
+
sh "rake clean"
|
30
|
+
end
|
31
|
+
end
|
13
32
|
end
|
33
|
+
|
34
|
+
task :clobber do
|
35
|
+
ext_config.configs.each do |extension|
|
36
|
+
path = Pathname.new(extension)
|
37
|
+
parts = path.split
|
38
|
+
conf = parts.last
|
39
|
+
Dir.chdir( path.dirname )do |d|
|
40
|
+
sh "rake clobber"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
14
46
|
end
|
15
47
|
|
@@ -1,43 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
config = rubyforge.userconfig
|
20
|
-
config["release_notes"] = <%= project_name.camelize %>::SPEC.description
|
21
|
-
config["release_changes"] = last_changeset
|
22
|
-
config["Prefomatted"] = true
|
23
|
-
|
24
|
-
puts "Uploading to rubyforge..."
|
25
|
-
files = FileList[File.join("pkg","#{<%= project_name.camelize %>::SPEC.name}-#{<%= project_name.camelize %>::VERSION}*.*")].to_a
|
26
|
-
rubyforge.login
|
27
|
-
rubyforge.add_release(<%= project_name.camelize %>::SPEC.rubyforge_project, <%= project_name.camelize %>::SPEC.name, <%= project_name.camelize %>::VERSION, *files)
|
28
|
-
puts "done."
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'tasks/config'
|
2
|
+
|
3
|
+
#-----------------------------------------------------------------------
|
4
|
+
# Rubyforge additions to the task library
|
5
|
+
#-----------------------------------------------------------------------
|
6
|
+
if rf_conf = Configuration.for_if_exist?("rubyforge") then
|
7
|
+
|
8
|
+
abort("rubyforge gem not installed 'gem install rubyforge'") unless Utils.try_require('rubyforge')
|
9
|
+
|
10
|
+
proj_conf = Configuration.for('project')
|
11
|
+
|
12
|
+
namespace :dist do
|
13
|
+
desc "Release files to rubyforge"
|
14
|
+
task :rubyforge => [:clean, :package] do
|
15
|
+
|
16
|
+
rubyforge = RubyForge.new
|
31
17
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
rubyforge = RubyForge.new
|
37
|
-
rubyforge.login
|
38
|
-
rubyforge.post_news(<%= project_name.camelize %>::SPEC.rubyforge_project, subject, "#{title}\n\n#{urls}\n\n#{body}")
|
39
|
-
puts "Posted to rubyforge"
|
40
|
-
end
|
18
|
+
config = {}
|
19
|
+
config["release_notes"] = proj_conf.description
|
20
|
+
config["release_changes"] = Utils.release_notes_from(proj_conf.history)[<%= project_name.camelize %>::VERSION]
|
21
|
+
config["Prefomatted"] = true
|
41
22
|
|
23
|
+
rubyforge.configure
|
24
|
+
|
25
|
+
# make sure this release doesn't already exist
|
26
|
+
releases = rubyforge.autoconfig['release_ids']
|
27
|
+
if releases.has_key?(<%= project_name.camelize %>::GEM_SPEC.name) and releases[<%= project_name.camelize %>::GEM_SPEC.name][<%= project_name.camelize %>::VERSION] then
|
28
|
+
abort("Release #{<%= project_name.camelize %>::VERSION} already exists! Unable to release.")
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "Uploading to rubyforge..."
|
32
|
+
files = FileList[File.join("pkg","#{<%= project_name.camelize %>::GEM_SPEC.name}-#{<%= project_name.camelize %>::VERSION}*.*")].to_a
|
33
|
+
rubyforge.login
|
34
|
+
rubyforge.add_release(<%= project_name.camelize %>::GEM_SPEC.rubyforge_project, <%= project_name.camelize %>::GEM_SPEC.name, <%= project_name.camelize %>::VERSION, *files)
|
35
|
+
puts "done."
|
42
36
|
end
|
43
|
-
end
|
37
|
+
end
|
38
|
+
|
39
|
+
namespace :announce do
|
40
|
+
desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
|
41
|
+
task :rubyforge do
|
42
|
+
info = Utils.announcement
|
43
|
+
rubyforge = RubyForge.new
|
44
|
+
rubyforge.configure
|
45
|
+
rubyforge.login
|
46
|
+
rubyforge.post_news(rf_conf.project, info[:subject], "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}")
|
47
|
+
puts "Posted to rubyforge"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),"spec_helper.rb")
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
|
2
2
|
|
3
3
|
describe <%= project_name.camelize %> do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
before(:each) do
|
5
|
+
# some setup
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
after(:each) do
|
9
|
+
# some cleanup
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
it "should have some tests" do
|
13
|
+
violated("I just want to be tested... is that so wrong?")
|
14
|
+
end
|
15
15
|
|
16
16
|
end
|