jrun-rstack 0.5.2
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/CHANGELOG.txt +0 -0
- data/LICENSE.txt +20 -0
- data/README.textile +57 -0
- data/Rakefile +13 -0
- data/bin/rstack +18 -0
- data/lib/rstack/configuration.rb +67 -0
- data/lib/rstack/generator.rb +58 -0
- data/lib/rstack/tasks/doc.rb +15 -0
- data/lib/rstack/tasks/gem.rb +52 -0
- data/lib/rstack/tasks/rspec.rb +24 -0
- data/lib/rstack/version.rb +9 -0
- data/lib/rstack.rb +25 -0
- data/spec/configuration_spec.rb +49 -0
- data/spec/generator_spec.rb +76 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/tasks/doc_spec.rb +13 -0
- data/templates/README.txt +1 -0
- data/templates/Rakefile +11 -0
- data/templates/cruise_config.rb +10 -0
- data/templates/main.rb +1 -0
- data/templates/spec_helper.rb +14 -0
- data/templates/version.rb +8 -0
- data/vendor/allison-2.0.2/CHANGELOG +16 -0
- data/vendor/allison-2.0.2/LICENSE +184 -0
- data/vendor/allison-2.0.2/Manifest +23 -0
- data/vendor/allison-2.0.2/README +66 -0
- data/vendor/allison-2.0.2/allison.gemspec +45 -0
- data/vendor/allison-2.0.2/bin/allison +9 -0
- data/vendor/allison-2.0.2/cache/BODY +571 -0
- data/vendor/allison-2.0.2/cache/CLASS_INDEX +4 -0
- data/vendor/allison-2.0.2/cache/CLASS_PAGE +1 -0
- data/vendor/allison-2.0.2/cache/FILE_INDEX +4 -0
- data/vendor/allison-2.0.2/cache/FILE_PAGE +1 -0
- data/vendor/allison-2.0.2/cache/FONTS +1 -0
- data/vendor/allison-2.0.2/cache/FR_INDEX_BODY +1 -0
- data/vendor/allison-2.0.2/cache/INDEX +1 -0
- data/vendor/allison-2.0.2/cache/JAVASCRIPT +317 -0
- data/vendor/allison-2.0.2/cache/METHOD_INDEX +4 -0
- data/vendor/allison-2.0.2/cache/METHOD_LIST +1 -0
- data/vendor/allison-2.0.2/cache/PROJECT +1 -0
- data/vendor/allison-2.0.2/cache/SRC_PAGE +1 -0
- data/vendor/allison-2.0.2/cache/STYLE +321 -0
- data/vendor/allison-2.0.2/contrib/Rakefile +147 -0
- data/vendor/allison-2.0.2/lib/allison.css +315 -0
- data/vendor/allison-2.0.2/lib/allison.js +317 -0
- data/vendor/allison-2.0.2/lib/allison.rb +276 -0
- metadata +157 -0
data/CHANGELOG.txt
ADDED
File without changes
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007 Jeremy Burks
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
h2. Why?
|
2
|
+
|
3
|
+
"newgem":http://newgem.rubyforge.org/ and "hoe":http://seattlerb.rubyforge.org/hoe/ work great for open source projects. RStack is intended to be used behind the firewall. There are a couple of other differences. One being it uses "RSpec":http://rspec.info/ rather than test/unit. The second difference is RStack automatically works with "CruiseControl.rb":http://cruisecontrolrb.thoughtworks.com/. It does that by adding a @cruise_config.rb@ configuration and by including a @cruise@ task.
|
4
|
+
|
5
|
+
h2. Usage
|
6
|
+
|
7
|
+
<pre><code>
|
8
|
+
rstack ninjas
|
9
|
+
</code></pre>
|
10
|
+
|
11
|
+
h2. Generated Files and Directories
|
12
|
+
|
13
|
+
<pre><code>
|
14
|
+
jrun ~/tmp $ rstack ninjas
|
15
|
+
creating ninjas/lib/ninjas
|
16
|
+
creating ninjas/spec/shared
|
17
|
+
creating ninjas/spec
|
18
|
+
creating ninjas/bin
|
19
|
+
creating ninjas/lib
|
20
|
+
creating ninjas/lib
|
21
|
+
moving Rakefile to ninjas/Rakefile
|
22
|
+
moving README.txt to ninjas/README.txt
|
23
|
+
moving cruise_config.rb to ninjas/cruise_config.rb
|
24
|
+
moving main.rb to ninjas/lib/ninjas.rb
|
25
|
+
moving version.rb to ninjas/lib/ninjas/version.rb
|
26
|
+
moving spec_helper.rb to ninjas/spec/spec_helper.rb
|
27
|
+
</pre></code>
|
28
|
+
|
29
|
+
h2. Generated Rakefile
|
30
|
+
|
31
|
+
<pre><code>
|
32
|
+
require 'rubygems'
|
33
|
+
require 'rstack'
|
34
|
+
require File.join(File.dirname(__FILE__), 'lib', 'ninjas', 'version')
|
35
|
+
|
36
|
+
RStack::Configuration.new 'ninjas' do |config|
|
37
|
+
config.summary = '[ENTER A SUMMARY]'
|
38
|
+
config.author = 'jrun'
|
39
|
+
config.email = '[ENTER YOUR EMAIL]'
|
40
|
+
config.url = '[ENTER A PROJECT URL]'
|
41
|
+
config.version = Ninjas::Version::STRING
|
42
|
+
end
|
43
|
+
</pre></code>
|
44
|
+
|
45
|
+
h2. Available Tasks
|
46
|
+
<pre><code>
|
47
|
+
jrun ~/tmp/ninjas $ rake -T
|
48
|
+
(in /Users/jrun/tmp/ninjas)
|
49
|
+
rake clobber_package # Remove package products
|
50
|
+
rake clobber_spec:with_coverage # Remove rcov products for spec:with_coverage
|
51
|
+
rake gem # Build the gem file ninjas-0.1.0.gem
|
52
|
+
rake package # Build all the packages
|
53
|
+
rake repackage # Force a rebuild of the package files
|
54
|
+
rake spec # Run specs
|
55
|
+
rake spec:with_coverage # Run specs through RCov and generate HTML...
|
56
|
+
</code></pre>
|
57
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
2
|
+
require 'rstack'
|
3
|
+
|
4
|
+
RStack::Configuration.new 'rstack' do |config|
|
5
|
+
config.summary = "Provides a gem library generator and helpful rake tasks"
|
6
|
+
config.author = 'jeremy burks'
|
7
|
+
config.email = "jeremy.burks@gmail.com"
|
8
|
+
config.url = "http://github.com/jrun/rstack/wikis"
|
9
|
+
config.has_rdoc = true
|
10
|
+
config.version = RStack::Version::STRING
|
11
|
+
config.executables = ["rstack"]
|
12
|
+
config.package_filelist.add *['templates/**/*', 'vendor/**/*']
|
13
|
+
end
|
data/bin/rstack
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rstack'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
parser = OptionParser.new do |opts|
|
6
|
+
opts.banner = <<BANNER
|
7
|
+
Generate a standardized gem which uses rspec.
|
8
|
+
|
9
|
+
Usage: rstack [ENTER NAME OF GEM]
|
10
|
+
|
11
|
+
Options:
|
12
|
+
BANNER
|
13
|
+
opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
|
14
|
+
opts.parse!(ARGV)
|
15
|
+
end
|
16
|
+
parser.parse!(["-h"]) unless ARGV[0]
|
17
|
+
|
18
|
+
RStack::Generator.new(ARGV[0]).run
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module RStack
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :gem_name, :summary, :author, :email, :url, :version,
|
4
|
+
:platform, :spec_filelist, :package_filelist, :require_path,
|
5
|
+
:has_rdoc, :rdoc_files, :outpath, :executables, :dependencies
|
6
|
+
|
7
|
+
attr_reader :outpath
|
8
|
+
|
9
|
+
def initialize(gem_name)
|
10
|
+
@gem_name = gem_name
|
11
|
+
@summary = '[ENTER A SUMMARY]'
|
12
|
+
@author = '[ENTER A AUTHOR]'
|
13
|
+
@email = '[ENTER YOUR EMAIL]'
|
14
|
+
@url = '[ENTER A PROJECT URL]'
|
15
|
+
@require_path = 'lib'
|
16
|
+
@version = "0.1.0"
|
17
|
+
@platform = ::Gem::Platform::RUBY
|
18
|
+
@package_filelist = FileList['[a-zA-Z]*', 'bin/**/*', 'lib/**/*', 'spec/**/*']
|
19
|
+
@spec_filelist = FileList['spec/**/*_spec.rb']
|
20
|
+
@rdoc_files = ['README.txt', 'CHANGELOG.txt', "LICENSE.txt", 'lib/**/*.rb']
|
21
|
+
@has_rdoc = false
|
22
|
+
@executables = []
|
23
|
+
@dependencies = {}
|
24
|
+
|
25
|
+
@outpath = ENV["CC_BUILD_ARTIFACTS"] || default_outpath
|
26
|
+
|
27
|
+
unless File.exist?(@outpath)
|
28
|
+
FileUtils.mkdir(@outpath)
|
29
|
+
end
|
30
|
+
|
31
|
+
yield self if block_given?
|
32
|
+
|
33
|
+
define_tasks
|
34
|
+
end
|
35
|
+
|
36
|
+
def files
|
37
|
+
@files ||= filelist_to_cleaned_a @package_filelist
|
38
|
+
end
|
39
|
+
|
40
|
+
def spec_files
|
41
|
+
@spec_files ||= filelist_to_cleaned_a @spec_filelist
|
42
|
+
end
|
43
|
+
|
44
|
+
def define_tasks
|
45
|
+
RSpec.define_tasks self
|
46
|
+
Gem.define_tasks self
|
47
|
+
RDoc.define_tasks self if @has_rdoc
|
48
|
+
|
49
|
+
task :default => :spec
|
50
|
+
task :repackage => "spec:with_coverage"
|
51
|
+
task :cruise do
|
52
|
+
::Rake::Task[:repackage].invoke
|
53
|
+
::Rake::Task[:rdoc].invoke if @has_rdoc
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def filelist_to_cleaned_a(filelist)
|
58
|
+
filelist.to_a.delete_if {|file| file.include?('.svn') || file.include?('rdoc') }
|
59
|
+
end
|
60
|
+
private :filelist_to_cleaned_a
|
61
|
+
|
62
|
+
def default_outpath
|
63
|
+
FileUtils.getwd / 'out'
|
64
|
+
end
|
65
|
+
private :default_outpath
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module RStack
|
2
|
+
class Generator
|
3
|
+
|
4
|
+
attr_reader :project_name, :pathized_project_name, :path, :main, :main_path,
|
5
|
+
:module_name, :templates_path
|
6
|
+
|
7
|
+
def initialize(project_name)
|
8
|
+
@project_name = project_name.downcase
|
9
|
+
@pathized_project_name = @project_name.to_const_path
|
10
|
+
@module_name = @pathized_project_name.camel_case
|
11
|
+
@path = Pathname.new(@project_name)
|
12
|
+
|
13
|
+
parts = @pathized_project_name.split("/")
|
14
|
+
@main = parts.last + ".rb"
|
15
|
+
@main_path = Pathname.new((parts - [parts.last]).join("/"))
|
16
|
+
@templates_path = Pathname.new(RStack.root) / 'templates'
|
17
|
+
end
|
18
|
+
|
19
|
+
def paths
|
20
|
+
{
|
21
|
+
:bin => path / "bin",
|
22
|
+
:lib => path / 'lib',
|
23
|
+
:main => path / "lib" / @main_path,
|
24
|
+
:project => path / "lib" / @pathized_project_name,
|
25
|
+
:spec => path / "spec"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
create_directories
|
31
|
+
move_template "Rakefile", path / "Rakefile"
|
32
|
+
move_template "README.txt", path / "README.txt"
|
33
|
+
move_template "cruise_config.rb", path / "cruise_config.rb"
|
34
|
+
move_template "main.rb", paths[:main] / @main
|
35
|
+
move_template "version.rb", paths[:project] / "version.rb"
|
36
|
+
move_template "spec_helper.rb", paths[:spec] / "spec_helper.rb"
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_directories
|
40
|
+
paths.values.each do |path|
|
41
|
+
puts "creating #{path}"
|
42
|
+
path.mkpath
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def move_template(template_name, destination_path)
|
47
|
+
puts "moving #{template_name} to #{destination_path}"
|
48
|
+
contents = File.read(templates_path + template_name)
|
49
|
+
File.open(destination_path, 'w') do |f|
|
50
|
+
f << eval('"' + contents + '"')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def author
|
55
|
+
ENV['USERNAME'] || ENV['USER'] || '[ENTER YOUR USERNAME]'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RStack
|
2
|
+
class RDoc
|
3
|
+
def self.define_tasks(configuration)
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
::Rake::RDocTask.new do |rdoc|
|
6
|
+
rdoc.rdoc_files.add configuration.rdoc_files
|
7
|
+
rdoc.rdoc_dir = configuration.outpath + '/doc'
|
8
|
+
rdoc.title = "#{configuration.gem_name} -- #{configuration.version}"
|
9
|
+
rdoc.main = 'README.txt'
|
10
|
+
rdoc.template = RStack.vendor / 'allison-2.0.2' / 'lib' / 'allison.rb'
|
11
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module RStack
|
2
|
+
class Gem
|
3
|
+
def self.define_tasks(configuration)
|
4
|
+
spec = ::Gem::Specification.new do |s|
|
5
|
+
s.name = configuration.gem_name
|
6
|
+
s.version = configuration.version
|
7
|
+
s.platform = configuration.platform
|
8
|
+
s.summary = configuration.summary
|
9
|
+
s.author = configuration.author
|
10
|
+
s.email = configuration.email
|
11
|
+
s.homepage = configuration.url
|
12
|
+
|
13
|
+
unless configuration.gem_name == 'rstack'
|
14
|
+
s.add_dependency "rstack", ">= #{RStack::Version::STRING}"
|
15
|
+
end
|
16
|
+
|
17
|
+
s.add_dependency 'rake', '>= 0.8.1'
|
18
|
+
s.add_dependency 'rcov', '>= 0.8.0'
|
19
|
+
s.add_dependency 'diff-lcs', '>= 1.1.2'
|
20
|
+
s.add_dependency 'rspec', '>= 1.1.3'
|
21
|
+
s.add_dependency 'extlib'
|
22
|
+
|
23
|
+
configuration.dependencies.each do |dependency, version|
|
24
|
+
s.add_dependency dependency, version
|
25
|
+
end
|
26
|
+
|
27
|
+
s.files = configuration.files
|
28
|
+
s.executables = configuration.executables
|
29
|
+
s.require_path = configuration.require_path
|
30
|
+
s.has_rdoc = configuration.has_rdoc
|
31
|
+
#s.extra_rdoc_files = ["README.txt"]
|
32
|
+
end
|
33
|
+
::Rake::GemPackageTask.new(spec) { |p| p.gem_spec = spec }
|
34
|
+
|
35
|
+
namespace :gem do
|
36
|
+
desc "Repackage gem, uninstall and install again (does not use sudo)."
|
37
|
+
task :refresh => :repackage do
|
38
|
+
system "gem uninstall #{configuration.gem_name} -v #{configuration.version}"
|
39
|
+
system "gem install pkg/#{configuration.gem_name}-#{configuration.version}.gem"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Create a gemspec file"
|
43
|
+
task :spec do
|
44
|
+
File.open("#{configuration.gem_name}.gemspec", "w") do |file|
|
45
|
+
file.puts spec.to_ruby
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RStack
|
2
|
+
class RSpec
|
3
|
+
def self.define_tasks(configuration)
|
4
|
+
::Spec::Rake::SpecTask.new do |t|
|
5
|
+
t.spec_opts = if File.exist?('spec/spec.opts')
|
6
|
+
['-O', 'spec/spec.opts' ]
|
7
|
+
else
|
8
|
+
['--format', 'specdoc', '--diff', '--color']
|
9
|
+
end
|
10
|
+
t.spec_files = configuration.spec_files
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run specs through RCov and generate HTML reports"
|
14
|
+
::Spec::Rake::SpecTask.new('spec:with_coverage') do |t|
|
15
|
+
t.rcov_dir = configuration.outpath / 'coverage'
|
16
|
+
t.spec_files = configuration.spec_files
|
17
|
+
t.spec_opts = ["--format", "html:#{configuration.outpath}/spec_report.html", "--diff"]
|
18
|
+
t.fail_on_error = false
|
19
|
+
t.rcov = true
|
20
|
+
t.rcov_opts << '--no-rcovrt' # required or rcov will fail
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/rstack.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'extlib'
|
3
|
+
|
4
|
+
module RStack
|
5
|
+
def self.root
|
6
|
+
Pathname.new(File.dirname(__FILE__)).parent.expand_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.vendor
|
10
|
+
root / 'vendor'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Pathname.glob((RStack.vendor / '**').to_s).each do |dir|
|
15
|
+
$:.unshift File.directory?(lib = "#{dir}/lib") ? lib : dir
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rake/gempackagetask'
|
19
|
+
require 'spec/rake/spectask'
|
20
|
+
|
21
|
+
require 'rstack/version'
|
22
|
+
require 'rstack/configuration'
|
23
|
+
require 'rstack/generator'
|
24
|
+
|
25
|
+
Pathname.glob((RStack.root / 'lib/rstack/tasks/*.rb').to_s).each {|f| require f }
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe RStack::Configuration do
|
5
|
+
before(:each) do
|
6
|
+
@config = RStack::Configuration.new('rstack')
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have a #gem_name equal to the name give to initialize" do
|
10
|
+
@config.gem_name.should == 'rstack'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should default the version to 0.1.0" do
|
14
|
+
@config.version.should == '0.1.0'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should default the require path to 'lib'" do
|
18
|
+
@config.require_path.should == 'lib'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should default the platform to ruby" do
|
22
|
+
@config.platform.should == Gem::Platform::RUBY
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should define a 'spec' task" do
|
26
|
+
Rake::Task.should be_task_defined("spec")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should define a 'spec:full' task" do
|
30
|
+
Rake::Task.should be_task_defined("spec:with_coverage")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not define a 'rdoc' task by default" do
|
34
|
+
Rake::Task.should_not be_task_defined("rdoc")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should define a repackage task" do
|
38
|
+
Rake::Task.should be_task_defined("repackage")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should define an rdoc task if 'has_rdoc' is true" do
|
42
|
+
RStack::Configuration.new('rstack') {|config| config.has_rdoc = true }
|
43
|
+
Rake::Task.should be_task_defined("rdoc")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should define a 'cruise' task" do
|
47
|
+
Rake::Task.should be_task_defined("cruise")
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe RStack::Generator do
|
4
|
+
before(:each) do
|
5
|
+
@generator = RStack::Generator.new("Foo")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should assign the given project name downcased to the project name attribute" do
|
9
|
+
@generator.project_name.should == "foo"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should assign the given project name classified to the module name attribute" do
|
13
|
+
generator = RStack::Generator.new("classified_project")
|
14
|
+
generator.module_name.should == "ClassifiedProject"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have a path equal to the project name" do
|
18
|
+
@generator.path.should == Pathname.new(@generator.project_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have a pathized project name" do
|
22
|
+
@generator.pathized_project_name.should == "foo"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should assign the last element to be the name of main .rb file" do
|
26
|
+
@generator.main.should == "foo.rb"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have a lib path should include the elements of the dasherized project name" do
|
30
|
+
@generator.paths[:lib].to_s.should == RStack.root.to_s / "foo/lib"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have a main path that includes all the pathized elements but the last" do
|
34
|
+
@generator.paths[:main].to_s.should == RStack.root.to_s / "foo/lib"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have a project path that includes the pathized elements" do
|
38
|
+
@generator.paths[:project].to_s.should == RStack.root.to_s / "foo/lib/foo"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe RStack::Generator, "#move_template" do
|
43
|
+
before(:each) do
|
44
|
+
File.stub!(:read).and_return("foo")
|
45
|
+
File.stub!(:open)
|
46
|
+
@generator = RStack::Generator.new("foo")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should read the given template file from template path" do
|
50
|
+
File.should_receive(:read).with(@generator.templates_path + 'template_file')
|
51
|
+
@generator.move_template("template_file", "destination_file")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should write the given destination file to the gem path" do
|
55
|
+
File.should_receive(:open).with("destination_path", 'w')
|
56
|
+
@generator.move_template("template_file", "destination_path")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe RStack::Generator, "#templates_path" do
|
61
|
+
before(:each) do
|
62
|
+
@generator = RStack::Generator.new("foo")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be an instance of Pathname" do
|
66
|
+
@generator.templates_path.should be_instance_of(Pathname)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should start with RSTACK_ROOT" do
|
70
|
+
@generator.templates_path.to_s.starts_with?(RStack.root).should be_true
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should exist" do
|
74
|
+
File.exist?(@generator.templates_path).should be_true
|
75
|
+
end
|
76
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
2
|
+
require 'rstack'
|
3
|
+
|
4
|
+
# extension modules for use in specs
|
5
|
+
Dir.glob(File.dirname(__FILE__) + '/shared/*.rb').each {|f| require f }
|
6
|
+
|
7
|
+
module SpecHelper
|
8
|
+
def null_mock(name, options = {})
|
9
|
+
mock name, options.merge(:null_object => true)
|
10
|
+
end
|
11
|
+
|
12
|
+
alias :null_stub :null_mock
|
13
|
+
end
|
14
|
+
|
15
|
+
Spec::Runner.configure do |config|
|
16
|
+
config.include(SpecHelper)
|
17
|
+
|
18
|
+
# config.before(:each) do
|
19
|
+
# end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe RStack::RDoc, 'defining a task' do
|
4
|
+
before(:each) do
|
5
|
+
@config = stub_everything :configuration
|
6
|
+
@config.stub!(:to_str).and_return('')
|
7
|
+
@task = RStack::RDoc.define_tasks @config
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should define a valid template path" do
|
11
|
+
@task.template.should exist
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
== README
|
data/templates/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rstack'
|
3
|
+
require File.join(File.dirname(__FILE__), 'lib', '#{pathized_project_name}', 'version')
|
4
|
+
|
5
|
+
RStack::Configuration.new '#{project_name}' do |config|
|
6
|
+
config.summary = '[ENTER A SUMMARY]'
|
7
|
+
config.author = '#{author}'
|
8
|
+
config.email = '[ENTER YOUR EMAIL]'
|
9
|
+
config.url = '[ENTER A PROJECT URL]'
|
10
|
+
config.version = #{module_name}::Version::STRING
|
11
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Project.configure do |project|
|
2
|
+
# Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
|
3
|
+
project.email_notifier.emails = []
|
4
|
+
|
5
|
+
# Build the project by invoking rake task 'custom'
|
6
|
+
# project.rake_task = 'repackage:full'
|
7
|
+
|
8
|
+
# Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
|
9
|
+
# project.scheduler.polling_interval = 5.minutes
|
10
|
+
end
|
data/templates/main.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$:.unshift File.exapnd_path(File.dirname(__FILE__))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require '#{main.chomp('.rb')}'
|
2
|
+
|
3
|
+
module SpecHelper
|
4
|
+
def null_mock(name, options = {})
|
5
|
+
mock name, options.merge(:null_object => true)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
config.include(SpecHelper)
|
11
|
+
|
12
|
+
# config.before(:each) do
|
13
|
+
# end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#{mods = ''; module_name.split('::').each_with_index {|mod, i| mods << 'module ' << mod << ' #:nodoc' << $/ << (' ' * i)}; mods}module Version #:nodoc:
|
2
|
+
MAJOR = 0
|
3
|
+
MINOR = 1
|
4
|
+
TINY = 0
|
5
|
+
|
6
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
7
|
+
end
|
8
|
+
#{ends = ''; module_name.split('::').each {|mod| ends << 'end' << $/ }; ends;}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
v2.0.2. Let's not talk about that.
|
3
|
+
|
4
|
+
v2.0.1. Remove PROJECT constant which isn't even used, gosh (Adam).
|
5
|
+
|
6
|
+
v2.0. Visual redesign. Gem version. 'allison' command line tool.
|
7
|
+
|
8
|
+
v1.5. RDoc.
|
9
|
+
|
10
|
+
v1.4. Again.
|
11
|
+
|
12
|
+
v1.3. Hack to make gem versioning work.
|
13
|
+
|
14
|
+
v1.2. Caching in order to remove Markaby dependency.
|
15
|
+
|
16
|
+
v1. First release.
|