toe 0.4.0

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/History ADDED
@@ -0,0 +1,3 @@
1
+ == 0.4.0 / 2010-05-02
2
+
3
+ Release with updates to work with Tap > 1.0.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2009-2010, Simon Chiang
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,19 @@
1
+ = Toe
2
+
3
+ Project management tasks
4
+
5
+ == Description
6
+
7
+ Toe provides boilerplate management tasks for ruby projects, for example test
8
+ and gem packaging tasks. Use like any {Tap}[http://tap.rubyforge.org] tasks.
9
+
10
+ == Installation
11
+
12
+ Available as a gem from Gemcutter[http://gemcutter.org/gems/toe].
13
+
14
+ % gem install toe
15
+
16
+ == Info
17
+
18
+ Copyright (c) 2009-2010, Simon Chiang
19
+ License:: {MIT-Style}[link:files/MIT-LICENSE.html]
@@ -0,0 +1,2 @@
1
+ require 'toe/manifest'
2
+ require 'toe/test'
@@ -0,0 +1,21 @@
1
+ require 'toe/gem_task'
2
+ require 'fileutils'
3
+
4
+ module Toe
5
+ # ::task package a gem
6
+ class Gem < GemTask
7
+
8
+ config :output_dir, 'pkg', :short => :o # Output directory
9
+
10
+ def process(path=default_path)
11
+ unless File.directory?(output_dir)
12
+ FileUtils.mkdir_p(output_dir)
13
+ end
14
+
15
+ path = ::Gem::Builder.new(gemspec(path)).build
16
+ FileUtils.mv(path, File.join(output_dir, File.basename(path)))
17
+
18
+ path
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rubygems/specification'
3
+ require 'tap/task'
4
+
5
+ module Toe
6
+ class GemTask < Tap::Task
7
+ def default_path
8
+ File.expand_path("#{File.basename(Dir.pwd)}.gemspec")
9
+ end
10
+
11
+ def gemspec(path)
12
+ unless File.exists?(path)
13
+ raise "no such gemspec: #{path}"
14
+ end
15
+
16
+ eval(File.read(path), TOPLEVEL_BINDING, path)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,36 @@
1
+ require 'toe/gem_task'
2
+
3
+ module Toe
4
+ # ::task prints files for a manifest
5
+ class Manifest < GemTask
6
+
7
+ config :omit, %w{^rdoc ^pkg ^test}, &c.list(&c.regexp)
8
+
9
+ def process(path=default_path)
10
+
11
+ # collect files from the gemspec, labeling
12
+ # with true or false corresponding to the
13
+ # file existing or not
14
+ files = gemspec(path).files.inject({}) do |files, file|
15
+ files[File.expand_path(file)] = [File.exists?(file), file]
16
+ files
17
+ end
18
+
19
+ # gather non-rdoc/pkg files for the project
20
+ # and add to the files list if they are not
21
+ # included already (marking by the absence
22
+ # of a label)
23
+ Dir.glob("**/*").each do |file|
24
+ next if File.directory?(file) || omit.any? {|pattern| file =~ pattern }
25
+
26
+ path = File.expand_path(file)
27
+ files[path] = ["", file] unless files.has_key?(path)
28
+ end
29
+
30
+ # sort and output the results
31
+ files.values.sort_by {|exists, file| file }.each do |entry|
32
+ puts "%-5s %s" % entry
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,46 @@
1
+ require 'toe/gem_task'
2
+ require 'rdoc/rdoc'
3
+ require 'cdoc'
4
+
5
+ module Toe
6
+ # :startdoc::task generate rdoc
7
+ class Rdoc < GemTask
8
+
9
+ config :output_dir, 'rdoc', :short => :o, &c.string_or_nil # Output directory
10
+ config :force, false, &c.flag # Force rebuild
11
+ config :cdoc, true, &c.switch # Use cdoc template
12
+
13
+ def options
14
+ opts = []
15
+
16
+ if output_dir
17
+ opts << '--op'
18
+ opts << output_dir
19
+ end
20
+
21
+ if cdoc
22
+ opts.concat %w{
23
+ --fmt cdoc
24
+ --template cdoc/cdoc_html_template
25
+ }
26
+ end
27
+
28
+ if force
29
+ opts << '--force-update'
30
+ end
31
+
32
+ opts
33
+ end
34
+
35
+ def process(path=default_path)
36
+ spec = gemspec(path)
37
+
38
+ files = spec.files.select {|file|
39
+ file =~ /lib.*\.rb$/
40
+ } + spec.extra_rdoc_files
41
+
42
+ args = options + spec.rdoc_options + files.uniq
43
+ RDoc::RDoc.new.document(args)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,55 @@
1
+ require 'tap/task'
2
+
3
+ module Toe
4
+ module Setup
5
+ # :startdoc::task setup github pages
6
+ #
7
+ # GitHub Pages are about the easiest way to put up documentation possible.
8
+ # This task sets up github pages a-la the instructions that appear when
9
+ # you visit your project homepage before pages is set up:
10
+ #
11
+ # yourname.github.com/project
12
+ #
13
+ # Caution: make your working directory clean before you do this (either
14
+ # stash or commit), otherwise this will LOSE any changes you've made to
15
+ # your project since the last commit.
16
+ #
17
+ # % tap setup/gh_pages
18
+ #
19
+ # Subsequent to this task, your working directory will be empty and you
20
+ # will be on the gh-pages branch. Add content and push to github:
21
+ #
22
+ # echo "My GitHub Page" > index.html
23
+ # git add .
24
+ # git commit -a -m "First pages commit"
25
+ # git push origin gh-pages
26
+ #
27
+ # The documentation should be updated in about a minute.
28
+ class GhPages < Tap::Task
29
+ include Tap::Utils
30
+
31
+ config :clean, false, &c.flag # Remove all files
32
+
33
+ def process
34
+ unless File.exists?(".git")
35
+ raise "cannot setup pages, not a git repository"
36
+ end
37
+
38
+ sh "git symbolic-ref HEAD refs/heads/gh-pages"
39
+
40
+ if File.exists?(".git/index")
41
+ sh "rm .git/index"
42
+ end
43
+
44
+ if clean
45
+ sh "git clean -fdx"
46
+ end
47
+ end
48
+
49
+ def sh(*cmd)
50
+ log :sh, cmd.join(' ')
51
+ super
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,84 @@
1
+ require 'tap/task'
2
+
3
+ module Toe
4
+ # :startdoc::task a testing task
5
+ #
6
+ # The Tap version of Rake::TestTask, shamelessly adapted from the original.
7
+ # The default test command is:
8
+ #
9
+ # % ruby -w -Ilib -e 'ARGV.each{|f| load f}' TEST_FILES...
10
+ #
11
+ # Where the test files are all files matching 'test/**/*_test.rb'. The options
12
+ # can be used to specify other options, lib paths, globs, filters, and even
13
+ # multiple interpreters.
14
+ #
15
+ class Test < Tap::Task
16
+ include Tap::Utils
17
+
18
+ # The command to launch a ruby interpreter. Multiple
19
+ # commands many be specified for multiple interpreters.
20
+ config :cmds, ["ruby"], :long => :cmd, &c.list # Commands to launch a ruby interpreter
21
+
22
+ # Array of options to pass to each cmd.
23
+ config :opts, ["w"], :long => :opt, &c.list # Options to the ruby interpreter
24
+
25
+ # List of directories to added to $LOAD_PATH before
26
+ # running the tests.
27
+ config :libs, ['lib'], :long => :lib, :short => :I, &c.list # Specify the test libraries
28
+
29
+ # Note that the default pattern reflects modern
30
+ # test naming conventions.
31
+ config :globs, ["test/**/*_test.rb"], :long => :glob, &c.list # Globs to auto-discover test files
32
+
33
+ # Filters test files, useful for only testing
34
+ # a subset of all tests. Test files are always
35
+ # filtered, even when manually specified.
36
+ config :filter, ".", &c.regexp # A regexp filter of test files
37
+
38
+ # Iterates over test files to launch them one by one.
39
+ config :iterate, false, &c.switch # Iteratively runs test files
40
+
41
+ # Code to load the test files, by default a simple one-liner:
42
+ #
43
+ # -e 'ARGV.each{|f| load f}'
44
+ #
45
+ def load_code
46
+ "-e 'ARGV.each{|f| load f}'"
47
+ end
48
+
49
+ def process(*args)
50
+
51
+ # construct the command options
52
+ options = [load_code]
53
+ opts.each {|opt| options << (opt[0] == ?- ? opt : "-#{opt}") }
54
+ libs.each {|path| options << "-I\"#{File.expand_path(path)}\"" }
55
+ options = options.join(" ")
56
+
57
+ # select test files
58
+ files = globs.collect do |glob|
59
+ Dir.glob(glob).select do |path|
60
+ File.file?(path) && path =~ filter
61
+ end
62
+ end.flatten!
63
+
64
+ if files.empty?
65
+ log :warn, "no files found for: #{globs.inspect}", Logger::WARN
66
+ end
67
+
68
+ files.collect! {|path| "\"#{path}\""}
69
+ files = [files.join(' ')] unless iterate
70
+
71
+ # launch each test
72
+ files.each do |path|
73
+ cmds.each do |cmd|
74
+ sh(cmd, options, path)
75
+ end
76
+ end
77
+ end
78
+
79
+ def sh(*cmd)
80
+ log :sh, cmd.join(' ')
81
+ super
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,7 @@
1
+ module Toe
2
+ MAJOR = 0
3
+ MINOR = 4
4
+ TINY = 0
5
+
6
+ VERSION="#{MAJOR}.#{MINOR}.#{TINY}"
7
+ end
data/tap.yml ADDED
File without changes
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: toe
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
+ platform: ruby
11
+ authors:
12
+ - Simon Chiang
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-02 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: tap-gen
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 7
30
+ - 0
31
+ version: 0.7.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: simon.a.chiang@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - History
42
+ - README
43
+ - MIT-LICENSE
44
+ files:
45
+ - lib/toe.rb
46
+ - lib/toe/gem.rb
47
+ - lib/toe/gem_task.rb
48
+ - lib/toe/manifest.rb
49
+ - lib/toe/rdoc.rb
50
+ - lib/toe/setup/gh_pages.rb
51
+ - lib/toe/test.rb
52
+ - lib/toe/version.rb
53
+ - tap.yml
54
+ - History
55
+ - README
56
+ - MIT-LICENSE
57
+ has_rdoc: true
58
+ homepage: http://tap.rubyforge.org/toe/
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --main
64
+ - README
65
+ - -S
66
+ - -N
67
+ - --title
68
+ - Toe
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project: tap
88
+ rubygems_version: 1.3.6
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: A tap development suite
92
+ test_files: []
93
+