simple-templater 0.1.pre → 0.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -2
- data/Rakefile +3 -12
- data/deps.rip +1 -0
- data/deps.rip.rbe +1 -0
- data/lib/simple-templater/builder.rb +7 -7
- data/lib/simple-templater/generator.rb +5 -5
- data/lib/simple-templater/generator_set.rb +1 -1
- data/lib/simple-templater/helpers.rb +4 -3
- data/lib/simple-templater/hooks/hook.rb +8 -8
- data/lib/simple-templater/version.rb +1 -1
- data/lib/simple-templater.rb +2 -2
- data/script/spec +10 -2
- data/simple-templater.gemspec +9 -0
- data/simple-templater.pre.gemspec +10 -1
- data/spec/simple-templater/helpers_spec.rb +2 -2
- data/spec/simple-templater/hooks/hook_spec.rb +1 -0
- data/spec/simple-templater/hooks/postprocess/git_repository_spec.rb +1 -0
- data/spec/simple-templater_spec.rb +8 -0
- data/spec/spec_helper.rb +0 -33
- data/stubs/project/content/%name%.gemspec.rbt +1 -1
- data/tasks/gem.rake +1 -1
- data/tasks/spec.rake +3 -3
- data/vendor/abstract/ChangeLog +3 -0
- data/vendor/abstract/README.txt +57 -0
- data/vendor/abstract/abstract.gemspec +48 -0
- data/vendor/abstract/doc/classes/Kernel.html +134 -0
- data/vendor/abstract/doc/classes/Kernel.src/M000002.html +24 -0
- data/vendor/abstract/doc/classes/Module.html +140 -0
- data/vendor/abstract/doc/classes/Module.src/M000001.html +20 -0
- data/vendor/abstract/doc/created.rid +1 -0
- data/vendor/abstract/doc/files/README_txt.html +173 -0
- data/vendor/abstract/doc/files/lib/abstract_rb.html +137 -0
- data/vendor/abstract/doc/fr_class_index.html +28 -0
- data/vendor/abstract/doc/fr_file_index.html +28 -0
- data/vendor/abstract/doc/fr_method_index.html +28 -0
- data/vendor/abstract/doc/index.html +24 -0
- data/vendor/abstract/doc/rdoc-style.css +208 -0
- data/vendor/abstract/lib/abstract.rb +75 -0
- data/vendor/abstract/setup.rb +1331 -0
- data/vendor/abstract/test/test.rb +91 -0
- metadata +31 -4
- data/Gemfile +0 -12
- data/lib/simple-templater/core_exts.rb +0 -99
data/README.textile
CHANGED
@@ -33,11 +33,11 @@ You would probably want to use simple templater for your own generators, here is
|
|
33
33
|
<pre>
|
34
34
|
require "simple-templater"
|
35
35
|
|
36
|
-
templater = SimpleTemplater.new(:rango)
|
36
|
+
templater = SimpleTemplater.new(:rango, SimpleTemplater.logger)
|
37
37
|
if defined?(Gem) # try to find generators installed as gems
|
38
38
|
templater.discovery!
|
39
39
|
else
|
40
|
-
warn "Running without RubyGems which means SimpleTemplater won't be able to find generators distributed as a Gems."
|
40
|
+
SimpleTemplater.logger.warn "Running without RubyGems which means SimpleTemplater won't be able to find generators distributed as a Gems."
|
41
41
|
# register generators just for rango
|
42
42
|
load File.join(File.dirname(__FILE__), "..", "simple-templater.scope")
|
43
43
|
end
|
data/Rakefile
CHANGED
@@ -3,23 +3,14 @@
|
|
3
3
|
require_relative "lib/simple-templater/version"
|
4
4
|
|
5
5
|
# ENV setup for external commands
|
6
|
-
ENV["RUBYLIB"] = Dir["
|
7
|
-
$LOAD_PATH.clear.push(*Dir["
|
8
|
-
|
9
|
-
# encoding
|
10
|
-
Encoding.default_internal = "utf-8"
|
11
|
-
Encoding.default_external = "utf-8"
|
6
|
+
ENV["RUBYLIB"] = Dir["vendor/*/lib"].join(":")
|
7
|
+
$LOAD_PATH.clear.push(*Dir["vendor/*/lib"])
|
12
8
|
|
13
9
|
# http://support.runcoderun.com/faqs/builds/how-do-i-run-rake-with-trace-enabled
|
14
10
|
Rake.application.options.trace = true
|
15
11
|
|
16
|
-
task :bundle do
|
17
|
-
# NOTE: the sense of the checkout is to avoid overwriting our changes in scripts
|
18
|
-
exec "gem bundle --cached && git checkout script"
|
19
|
-
end
|
20
|
-
|
21
12
|
# default task for RunCodeRun.com
|
22
|
-
task :default => [:
|
13
|
+
task :default => ["submodules:init", :spec]
|
23
14
|
|
24
15
|
# load tasks
|
25
16
|
Dir["tasks/*.rake"].each do |taskfile|
|
data/deps.rip
CHANGED
@@ -3,4 +3,5 @@
|
|
3
3
|
# Syntax:
|
4
4
|
# repository [tag or commit to install]
|
5
5
|
git://github.com/botanicus/cli.git 76a7985d78673426814017d6a1d6ebec2ba1bcc8
|
6
|
+
git://github.com/botanicus/rubyexts.git 41ef70523b4b6a19cac52e6c024330103faef993
|
6
7
|
git://github.com/genki/erubis.git b4fc63f1e75574676707768680ad72c83e77a001
|
data/deps.rip.rbe
CHANGED
@@ -21,7 +21,7 @@ class SimpleTemplater
|
|
21
21
|
class Builder
|
22
22
|
def self.create(*args)
|
23
23
|
templater = self.new(*args)
|
24
|
-
|
24
|
+
SimpleTemplater.logger.debug("Context: #{templater.context.inspect}")
|
25
25
|
templater.create
|
26
26
|
end
|
27
27
|
|
@@ -74,7 +74,7 @@ class SimpleTemplater
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def proceed_file(template, file, local_context = Hash.new)
|
77
|
-
|
77
|
+
SimpleTemplater.logger.debug("Local context: #{local_context.inspect}") unless local_context.empty?
|
78
78
|
FileUtils.mkdir_p(File.dirname(file))
|
79
79
|
|
80
80
|
if File.directory?(template)
|
@@ -84,9 +84,9 @@ class SimpleTemplater
|
|
84
84
|
|
85
85
|
if template.end_with?(".rbt")
|
86
86
|
if File.exist?(file)
|
87
|
-
|
87
|
+
SimpleTemplater.logger.debug("[RETEMPLATE] #{file} (from #{template})")
|
88
88
|
else
|
89
|
-
|
89
|
+
SimpleTemplater.logger.debug("[TEMPLATE] #{file} (from #{template})")
|
90
90
|
end
|
91
91
|
File.open(file, "w") do |file|
|
92
92
|
eruby = Erubis::Eruby.new(File.read(template))
|
@@ -95,7 +95,7 @@ class SimpleTemplater
|
|
95
95
|
begin
|
96
96
|
output = eruby.evaluate(context)
|
97
97
|
rescue Exception => exception
|
98
|
-
|
98
|
+
SimpleTemplater.logger.error("Exception occured in template #{template}: #{exception.message}")
|
99
99
|
end
|
100
100
|
file.print(output)
|
101
101
|
end
|
@@ -104,10 +104,10 @@ class SimpleTemplater
|
|
104
104
|
# do nothing
|
105
105
|
# it shouldn't get here never, we have File.directory? above
|
106
106
|
elsif File.file?(file)
|
107
|
-
|
107
|
+
SimpleTemplater.logger.debug("[RECOPY] #{file} (from #{template})")
|
108
108
|
FileUtils.cp_f(template, file)
|
109
109
|
else
|
110
|
-
|
110
|
+
SimpleTemplater.logger.debug("[COPY] #{file} (from #{template})")
|
111
111
|
FileUtils.cp(template, file)
|
112
112
|
end
|
113
113
|
end
|
@@ -65,9 +65,9 @@ class SimpleTemplater
|
|
65
65
|
if self.full? && Dir.exist?(self.target) # has to run after setup.rb hook, because setup.rb can manipulate with target
|
66
66
|
raise TargetAlreadyExist, "#{self.target} already exist, aborting."
|
67
67
|
end
|
68
|
-
|
68
|
+
SimpleTemplater.logger.info("[#{self.name} generator] Running before hooks #{self.before_hooks.inspect}")
|
69
69
|
self.run_hooks(:before)
|
70
|
-
|
70
|
+
SimpleTemplater.logger.info("[#{self.name} generator] Creating #{@target} (#{self.config.type})")
|
71
71
|
if self.flat?
|
72
72
|
# flat/content/flat.ru.rbt
|
73
73
|
# flat/content/%user%.rb
|
@@ -85,9 +85,9 @@ class SimpleTemplater
|
|
85
85
|
|
86
86
|
def run_hook(basename)
|
87
87
|
if File.exist?(hook = file(basename))
|
88
|
-
|
88
|
+
SimpleTemplater.logger.info("Running #{basename} hook")
|
89
89
|
DSL.new(self).instance_eval(File.read(hook))
|
90
|
-
|
90
|
+
SimpleTemplater.logger.info("Finished")
|
91
91
|
end
|
92
92
|
rescue Exception => exception
|
93
93
|
abort "Exception #{exception.inspect} occured during running #{basename}\n#{exception.backtrace.join("\n")}"
|
@@ -118,7 +118,7 @@ class SimpleTemplater
|
|
118
118
|
metadata_file = File.join(self.path, "metadata.yml")
|
119
119
|
YAML::load_file(metadata_file)
|
120
120
|
rescue Errno::ENOENT
|
121
|
-
|
121
|
+
SimpleTemplater.logger.fatal("SimpleTemplater expected '#{metadata_file}'")
|
122
122
|
end
|
123
123
|
|
124
124
|
def config
|
@@ -13,7 +13,7 @@ class SimpleTemplater
|
|
13
13
|
@name = name.to_sym
|
14
14
|
@paths = check_paths(paths)
|
15
15
|
if File.directory?(self.custom)
|
16
|
-
|
16
|
+
SimpleTemplater.logger.info "Added custom generator from #{self.custom}"
|
17
17
|
@paths.unshift(self.custom)
|
18
18
|
end
|
19
19
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require "rbconfig"
|
4
|
+
require "rubyexts/platform"
|
4
5
|
|
5
6
|
class SimpleTemplater
|
6
7
|
module Helpers
|
7
8
|
extend self
|
8
9
|
|
9
10
|
def shebang(executable = rubypath, *args)
|
10
|
-
if
|
11
|
-
self.env_shebang(executable, args)
|
12
|
-
else
|
11
|
+
if RubyExts::Platform.linux?
|
13
12
|
self.plain_shebang(executable, args)
|
13
|
+
else
|
14
|
+
self.env_shebang(executable, args)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require "rubyexts/string" # String#snake_case
|
4
|
+
require "rubyexts/class"
|
3
5
|
require "simple-templater/argv_parsing"
|
4
6
|
|
5
7
|
# When generator runs:
|
@@ -22,26 +24,24 @@ class SimpleTemplater
|
|
22
24
|
end
|
23
25
|
|
24
26
|
class Hook
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
27
|
+
cattr_reader :hooks
|
28
|
+
@@hooks ||= Array.new
|
29
29
|
def self.find(key)
|
30
|
-
|
30
|
+
@@hooks.find { |hook| hook.name.split("::").last.snake_case.to_sym == key }
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.inherited(klass)
|
34
|
-
|
34
|
+
@@hooks.push(klass)
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.invoke(context)
|
38
38
|
hook = self.new(context)
|
39
39
|
if hook.will_run?
|
40
|
-
|
40
|
+
SimpleTemplater.logger.info("Running hook #{self}")
|
41
41
|
hook.run
|
42
42
|
return true
|
43
43
|
else
|
44
|
-
|
44
|
+
SimpleTemplater.logger.info("Skipping hook #{self}")
|
45
45
|
return false
|
46
46
|
end
|
47
47
|
end
|
data/lib/simple-templater.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby -Ivendor/erubis/lib:vendor/abstract/lib:vendor/cli/lib
|
1
|
+
#!/usr/bin/env ruby -Ivendor/rubyexts/lib:vendor/erubis/lib:vendor/abstract/lib:vendor/cli/lib
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
require "
|
4
|
+
require "rubyexts"
|
5
5
|
require "simple-templater/discoverer"
|
6
6
|
require "simple-templater/generator_set"
|
7
7
|
|
data/script/spec
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
Dir[File.join(File.dirname(__FILE__), "..", "vendor", "*")].each do |path|
|
5
|
+
if File.directory?(path) && Dir["#{path}/*"].empty?
|
6
|
+
warn "Dependency #{File.basename(path)} in vendor seems to be empty. Run git submodule init && git submodule update to checkout it."
|
7
|
+
elsif File.directory?(path) && File.directory?(File.join(path, "lib"))
|
8
|
+
$:.unshift File.join(path, "lib")
|
9
|
+
end
|
10
|
+
end
|
2
11
|
|
3
12
|
ARGV.push("spec") if ARGV.empty?
|
4
13
|
|
5
|
-
|
6
|
-
load File.join(File.dirname(__FILE__), "../gems/gems/rspec-1.2.9/bin/spec")
|
14
|
+
load File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor", "rspec", "bin", "spec"))
|
data/simple-templater.gemspec
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
#!/usr/bin/env gem build
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
+
Dir[File.join(File.dirname(__FILE__), "vendor", "*")].each do |path|
|
5
|
+
if File.directory?(path) && Dir["#{path}/*"].empty?
|
6
|
+
warn "Dependency #{File.basename(path)} in vendor seems to be empty. Run git submodule init && git submodule update to checkout it."
|
7
|
+
elsif File.directory?(path) && File.directory?(File.join(path, "lib"))
|
8
|
+
$:.unshift File.join(path, "lib")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
# NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
|
5
13
|
require File.join(File.dirname(__FILE__), "lib", "simple-templater", "version")
|
6
14
|
|
@@ -26,6 +34,7 @@ Gem::Specification.new do |s|
|
|
26
34
|
|
27
35
|
# runtime dependencies
|
28
36
|
s.add_dependency "cli"
|
37
|
+
s.add_dependency "rubyexts"
|
29
38
|
s.add_dependency "erubis" # for generators
|
30
39
|
|
31
40
|
# development dependencies
|
@@ -1,12 +1,20 @@
|
|
1
1
|
#!/usr/bin/env gem build
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
+
Dir[File.join(File.dirname(__FILE__), "vendor", "*")].each do |path|
|
5
|
+
if File.directory?(path) && Dir["#{path}/*"].empty?
|
6
|
+
warn "Dependency #{File.basename(path)} in vendor seems to be empty. Run git submodule init && git submodule update to checkout it."
|
7
|
+
elsif File.directory?(path) && File.directory?(File.join(path, "lib"))
|
8
|
+
$:.unshift File.join(path, "lib")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
# NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
|
5
13
|
require File.join(File.dirname(__FILE__), "lib", "simple-templater", "version")
|
6
14
|
|
7
15
|
Gem::Specification.new do |s|
|
8
16
|
s.name = "simple-templater"
|
9
|
-
s.version = '0.
|
17
|
+
s.version = '0.2.pre'
|
10
18
|
s.authors = ["Jakub Šťastný aka Botanicus"]
|
11
19
|
s.homepage = "http://github.com/botanicus/simple-templater"
|
12
20
|
s.summary = "SimpleTemplater is dead-simple solution for creating generators."
|
@@ -26,6 +34,7 @@ Gem::Specification.new do |s|
|
|
26
34
|
|
27
35
|
# runtime dependencies
|
28
36
|
s.add_dependency "cli"
|
37
|
+
s.add_dependency "rubyexts"
|
29
38
|
s.add_dependency "erubis" # for generators
|
30
39
|
|
31
40
|
# development dependencies
|
@@ -11,7 +11,7 @@ describe SimpleTemplater::Helpers do
|
|
11
11
|
describe "#shebang" do
|
12
12
|
include SimpleTemplater::Helpers
|
13
13
|
before(:each) do
|
14
|
-
|
14
|
+
RubyExts::Platform.stub!(:linux?).and_return(true)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should generate shebang with path to executable on Linux" do
|
@@ -19,7 +19,7 @@ describe SimpleTemplater::Helpers do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should generate shebang with /usr/bin/env on other platforms" do
|
22
|
-
|
22
|
+
RubyExts::Platform.stub!(:linux?).and_return(false)
|
23
23
|
shebang("ruby").should eql("#!/usr/bin/env ruby")
|
24
24
|
end
|
25
25
|
|
@@ -47,6 +47,14 @@ describe SimpleTemplater do
|
|
47
47
|
SimpleTemplater.scopes.should have_key(:local)
|
48
48
|
end
|
49
49
|
end
|
50
|
+
|
51
|
+
describe ".logger" do
|
52
|
+
it "should set default logger" do
|
53
|
+
[:info, :debug, :error, :fatal].each do |method|
|
54
|
+
SimpleTemplater.logger.should respond_to(method)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
data/spec/spec_helper.rb
CHANGED
@@ -6,39 +6,6 @@ $:.unshift(File.expand_path(File.join(SPEC_ROOT, "..", "lib")))
|
|
6
6
|
require "spec" # so you can run ruby spec/rango/whatever_spec.rb
|
7
7
|
# require "fakefs" # TODO: makes some troubles with rubyexts
|
8
8
|
|
9
|
-
require "stringio"
|
10
|
-
|
11
|
-
def STDOUT.capture(&block)
|
12
|
-
before = self
|
13
|
-
$stdout = StringIO.new
|
14
|
-
block.call
|
15
|
-
$stdout.rewind
|
16
|
-
output = $stdout.read
|
17
|
-
$stdout = before
|
18
|
-
output
|
19
|
-
end
|
20
|
-
|
21
|
-
# @example STDOUT.capture { puts "hi" }
|
22
|
-
# # => "hi"
|
23
|
-
def STDERR.capture(&block)
|
24
|
-
before = self
|
25
|
-
$stderr = StringIO.new
|
26
|
-
block.call
|
27
|
-
$stderr.rewind
|
28
|
-
output = $stderr.read
|
29
|
-
$stderr = before
|
30
|
-
output
|
31
|
-
end
|
32
|
-
|
33
|
-
# @example STDIN.capture("yes") { ask("Do you hear me?") }
|
34
|
-
# # => "yes"
|
35
|
-
def STDIN.capture(default, &block)
|
36
|
-
STDIN.reopen "/dev/null" # so we don't get the fucking prompt
|
37
|
-
STDIN.ungetbyte(default) # so the default value can be get by STDIN.getc & similar methods
|
38
|
-
block.call
|
39
|
-
# TODO: how I can get back the original STDIN?
|
40
|
-
end
|
41
|
-
|
42
9
|
module Spec
|
43
10
|
module Matchers
|
44
11
|
def match(expected)
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_ruby_version = ::Gem::Requirement.new(">= 1.9")
|
27
27
|
|
28
28
|
# runtime dependencies
|
29
|
-
# s.add_dependency "
|
29
|
+
# s.add_dependency "rubyexts"
|
30
30
|
|
31
31
|
# development dependencies
|
32
32
|
# use gem install rango --development if you want to install them
|
data/tasks/gem.rake
CHANGED
@@ -12,7 +12,7 @@ namespace :build do
|
|
12
12
|
content = File.read(gemspec)
|
13
13
|
prename = "#{gemspec.split(".").first}.pre.gemspec"
|
14
14
|
# 0.1.1 => 0.2
|
15
|
-
version = SimpleTemplater::VERSION.sub(/^(\d+)\.(\d
|
15
|
+
version = SimpleTemplater::VERSION.sub(/^(\d+)\.(\d+\.){2}.*$/) { "#$1.#{$2.to_i + 1}" }
|
16
16
|
puts "Current #{SimpleTemplater::VERSION} => #{version} pre"
|
17
17
|
File.open(prename, "w") do |file|
|
18
18
|
file.puts(content.gsub(/(\w+::VERSION)/, "'#{version}.pre'"))
|
data/tasks/spec.rake
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
desc "Run specs"
|
4
|
-
task :spec, :
|
5
|
-
exec "./script/spec --options spec/spec.opts #{args.
|
4
|
+
task :spec, :path do |task, args|
|
5
|
+
exec "./script/spec --options spec/spec.opts #{args.path || "spec"}"
|
6
6
|
end
|
7
7
|
|
8
8
|
desc "Create stubs of all library files."
|
@@ -15,7 +15,7 @@ task "spec:stubs" do
|
|
15
15
|
puts "Created #{specfile}"
|
16
16
|
end
|
17
17
|
end
|
18
|
-
(Dir.glob("spec/simple-templater/**/*.rb") + ["spec/simple-
|
18
|
+
(Dir.glob("spec/simple-templater/**/*.rb") + ["spec/simple-templater_spec.rb"]).each do |file|
|
19
19
|
libfile = file.sub(/spec/, "lib").sub(/_spec\.rb$/, '.rb')
|
20
20
|
if !File.exist?(libfile) && File.zero?(file)
|
21
21
|
%x[rm #{file}]
|
@@ -0,0 +1,57 @@
|
|
1
|
+
= README
|
2
|
+
|
3
|
+
revision:: $Rev: 1 $
|
4
|
+
release:: $Release: 1.0.0 $
|
5
|
+
copyright:: copyright(c) 2006 kuwata-lab.com all rights reserved.
|
6
|
+
|
7
|
+
|
8
|
+
== Introduction
|
9
|
+
|
10
|
+
'abstract.rb' is a library which enable you to define abstract method in Ruby.
|
11
|
+
|
12
|
+
The followings are examples:
|
13
|
+
|
14
|
+
## example1. (shorter notation)
|
15
|
+
require 'rubygems' # if installed with 'gem install'
|
16
|
+
require 'abstract'
|
17
|
+
class Foo
|
18
|
+
abstract_method 'arg1, arg2=""', :method1, :method2, :method3
|
19
|
+
end
|
20
|
+
|
21
|
+
## example2. (RDoc friendly notation)
|
22
|
+
require 'rubygems' # if installed with 'gem install'
|
23
|
+
require 'abstract'
|
24
|
+
class Bar
|
25
|
+
# ... method1 description ...
|
26
|
+
def method1(arg1, arg2="")
|
27
|
+
not_implemented
|
28
|
+
end
|
29
|
+
# ... method2 description ...
|
30
|
+
def method2(arg1, arg2="")
|
31
|
+
not_implemented
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
Abstract method makes your code more descriptive.
|
37
|
+
It is useful even for dynamic language such as Ruby.
|
38
|
+
|
39
|
+
|
40
|
+
== Installation
|
41
|
+
|
42
|
+
|
43
|
+
* Type 'gem install -r abstract' with root account if you have installed RubyGems.
|
44
|
+
|
45
|
+
* Or type 'ruby setup.rb' with root account if you can be root account.
|
46
|
+
|
47
|
+
* Or copy lib/abstract.rb into proper directory such as '/usr/local/lib/ruby/site_ruby'.
|
48
|
+
|
49
|
+
|
50
|
+
== License
|
51
|
+
|
52
|
+
Ruby's
|
53
|
+
|
54
|
+
|
55
|
+
== Copyright
|
56
|
+
|
57
|
+
copyright(c) 2006 kuwata-lab.com all rights reserved.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
###
|
4
|
+
### RubyGems Specification file for abstract.rb
|
5
|
+
###
|
6
|
+
### $Rev: 1 $
|
7
|
+
### $Release: 1.0.0 $
|
8
|
+
### copyright(c) 2006 kuwata-lab.com all rights reserved.
|
9
|
+
###
|
10
|
+
|
11
|
+
require 'rubygems'
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
## package information
|
15
|
+
s.name = 'abstract'
|
16
|
+
s.author = 'makoto kuwata'
|
17
|
+
s.version = ("$Release: 1.0.0 $" =~ /[\.\d]+/) && $&
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
s.homepage = 'http://rubyforge.org/projects/abstract'
|
20
|
+
s.summary = "a library which enable you to define abstract method in Ruby"
|
21
|
+
s.description = <<-'END'
|
22
|
+
'abstract.rb' is a library which enable you to define abstract method in Ruby.
|
23
|
+
END
|
24
|
+
|
25
|
+
## files
|
26
|
+
files = []
|
27
|
+
files += Dir.glob('lib/**/*')
|
28
|
+
files += Dir.glob('test/**/*')
|
29
|
+
files += %w[README.txt ChangeLog setup.rb abstract.gemspec]
|
30
|
+
#s.files = files.delete_if { |path| path =~ /\.svn/ }
|
31
|
+
s.files = files
|
32
|
+
s.test_file = 'test/test.rb'
|
33
|
+
end
|
34
|
+
|
35
|
+
# Quick fix for Ruby 1.8.3 / YAML bug (thanks to Ross Bamford)
|
36
|
+
if (RUBY_VERSION == '1.8.3')
|
37
|
+
def spec.to_yaml
|
38
|
+
out = super
|
39
|
+
out = '--- ' + out unless out =~ /^---/
|
40
|
+
out
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if $0 == __FILE__
|
45
|
+
Gem::manage_gems
|
46
|
+
Gem::Builder.new(spec).build
|
47
|
+
end
|
48
|
+
|