prigner 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +29 -0
- data/README.rdoc +32 -42
- data/Rakefile +12 -8
- data/lib/prigner/builder.rb +8 -3
- data/lib/prigner/cli/new.rb +30 -8
- data/lib/prigner/cli.rb +1 -2
- data/lib/prigner/extensions.rb +14 -2
- data/lib/prigner/template.rb +31 -7
- data/lib/prigner.rb +2 -2
- data/prigner.gemspec +14 -5
- data/share/templates/bash/default/models/script.sh +45 -0
- data/share/templates/bash/default/models/scriptrc +2 -0
- data/share/templates/bash/default/specfile +18 -0
- data/share/templates/ruby/default/models/executable +23 -0
- data/share/templates/ruby/default/models/testhelper.rb +23 -0
- data/share/templates/ruby/default/specfile +20 -4
- data/share/templates/ruby/gem/models/README.rdoc +4 -0
- data/share/templates/ruby/gem/models/Rakefile +81 -148
- data/share/templates/ruby/gem/models/cli.rb +43 -0
- data/share/templates/ruby/gem/models/executable +23 -0
- data/share/templates/ruby/gem/models/gemspec +10 -8
- data/share/templates/ruby/gem/models/module.rb +24 -9
- data/share/templates/ruby/gem/models/testhelper.rb +23 -0
- data/share/templates/ruby/gem/specfile +20 -8
- data/test/builder_test.rb +15 -0
- data/test/fixtures/templates/shared/templates/ruby/default/models/cli.rb +0 -0
- data/test/fixtures/templates/shared/templates/ruby/default/models/executable +23 -0
- data/test/fixtures/templates/shared/templates/ruby/default/models/testhelper.rb +0 -0
- data/test/fixtures/templates/shared/templates/ruby/default/specfile +21 -9
- data/test/helpers.rb +8 -8
- data/test/spec_test.rb +18 -4
- data/test/template_test.rb +21 -6
- metadata +19 -10
- data/share/templates/ruby/gem/models/README.mkd +0 -5
- data/share/templates/ruby/gem/models/empty_test.rb +0 -16
- data/test/fixtures/templates/shared/templates/ruby/default/README.mkd +0 -2
@@ -1,145 +1,92 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
|
2
2
|
|
3
3
|
require "rake/clean"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rake/gempackagetask"
|
6
|
+
require "rake/rdoctask"
|
4
7
|
require "lib/<%=project.name%>"
|
5
8
|
|
6
|
-
#
|
9
|
+
# Configurations
|
7
10
|
# =============================================================================
|
8
11
|
|
9
|
-
def
|
10
|
-
|
11
|
-
["hanna", "--fmt", "html", "--accessor", "option_accessor=RW", *args]
|
12
|
-
else
|
13
|
-
["rdoc", *args]
|
14
|
-
end
|
15
|
-
sh @rdoc.join(" ")
|
16
|
-
end
|
17
|
-
|
18
|
-
def test(pattern)
|
19
|
-
testfiles = Dir[pattern]
|
20
|
-
if Gem.available? "turn"
|
21
|
-
sh [ "turn", *testfiles ].join(" ")
|
22
|
-
else
|
23
|
-
testfiles.each do |testfile|
|
24
|
-
sh "ruby #{testfile}"
|
25
|
-
end
|
26
|
-
end
|
12
|
+
def git(cmd, *args)
|
13
|
+
`git #{cmd.to_s.gsub('_','-')} #{args.join(' ')}`
|
27
14
|
end
|
28
15
|
|
29
16
|
def manifest
|
30
|
-
@manifest ||=
|
17
|
+
@manifest ||= git(:ls_files).split("\n").sort.reject do |out|
|
31
18
|
out =~ /^\./ || out =~ /^doc/
|
32
19
|
end.map do |file|
|
33
20
|
" #{file.inspect}"
|
34
21
|
end.join(",\n")
|
35
22
|
end
|
36
23
|
|
37
|
-
def log
|
38
|
-
@log ||= `git log --date=short --format='%d;%cd;%s;%b;'`
|
39
|
-
end
|
40
|
-
|
41
24
|
def version
|
42
25
|
@version ||= <%=project.class_name%>.version
|
43
26
|
end
|
44
27
|
|
28
|
+
def tag
|
29
|
+
git(:tag).split("\n").last
|
30
|
+
end
|
31
|
+
|
32
|
+
def specfile
|
33
|
+
@specfile ||= Pathname.new("<%=project.name%>.gemspec")
|
34
|
+
end
|
35
|
+
|
45
36
|
def gemspec
|
46
|
-
@gemspec ||=
|
47
|
-
@gemspec.file ||= Pathname.new("<%=project.name%>.gemspec")
|
48
|
-
@gemspec.spec ||= eval @gemspec.file.read
|
49
|
-
@gemspec
|
37
|
+
@gemspec ||= eval(specfile.read)
|
50
38
|
end
|
51
39
|
|
52
|
-
#
|
40
|
+
# Test
|
53
41
|
# =============================================================================
|
54
42
|
|
55
|
-
|
43
|
+
Rake::TestTask.new do |test|
|
44
|
+
test.libs << "test"
|
45
|
+
test.test_files = FileList["test/*_test.rb"]
|
46
|
+
test.verbose = true
|
47
|
+
end
|
56
48
|
|
57
|
-
|
49
|
+
# Packaging
|
50
|
+
# =============================================================================
|
58
51
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"--charset", "utf8",
|
63
|
-
"--main", "'<%=project.class_name%>'",
|
64
|
-
"--title", "'<%=project.class_name%> v#{version.tag} API Documentation'",
|
65
|
-
"--inline-source",
|
66
|
-
"--promiscuous",
|
67
|
-
"--line-numbers",
|
68
|
-
filespec.prerequisites.join(" ")
|
69
|
-
end
|
52
|
+
Rake::GemPackageTask.new gemspec do |spec|
|
53
|
+
spec.need_tar = true
|
54
|
+
end
|
70
55
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
desc "Creates/updates CHANGELOG file."
|
75
|
-
task :changelog do |spec|
|
76
|
-
historic = {}
|
77
|
-
text = ""
|
78
|
-
|
79
|
-
log.scan(/(.*?);(.*?);(.*?);(.*?);/m) do |tag, date, subject, content|
|
80
|
-
|
81
|
-
historic[date] = {
|
82
|
-
:release => "#{date} #{tag.match(/(v\d\..*)/im) ? tag : nil}",
|
83
|
-
:changes => []
|
84
|
-
} unless historic.has_key? date
|
85
|
-
|
86
|
-
historic[date][:changes] << "\n* #{subject}\n"
|
87
|
-
historic[date][:changes] << content.gsub(/(.*?)\n/m){"\n #{$1}\n"} unless content.empty?
|
88
|
-
end
|
89
|
-
|
90
|
-
historic.keys.sort.reverse.each do |date|
|
91
|
-
entry = historic[date]
|
92
|
-
puts "Adding historic from date #{date} ..."
|
93
|
-
text << <<-end_text.gsub(/^[ ]{8}/,'')
|
94
|
-
#{entry[:release]}
|
95
|
-
#{"-" * entry[:release].size}
|
96
|
-
#{entry[:changes]}
|
97
|
-
end_text
|
98
|
-
end
|
99
|
-
|
100
|
-
File.open("CHANGELOG", "w+") { |changelog| changelog << text }
|
101
|
-
puts "Historic has #{historic.keys.size} entry dates"
|
102
|
-
puts "Successfully updated CHANGELOG file"
|
103
|
-
end
|
56
|
+
# Documentation
|
57
|
+
# =============================================================================
|
104
58
|
|
59
|
+
Rake::RDocTask.new :doc do |rdoc|
|
60
|
+
rdoc.main = "<%=project.upper_camel_case_namespace%>"
|
61
|
+
rdoc.title = "<%=project.upper_camel_case_namespace%> v#{version.tag} API Documentation"
|
62
|
+
rdoc.rdoc_dir = "doc/api"
|
63
|
+
rdoc.rdoc_files = FileList["lib/**/*.rb", "README.rdoc", "CHANGELOG"]
|
64
|
+
rdoc.options << "--charset utf8" << "--inline-source" << "--promiscuous" << "--line-numbers"
|
105
65
|
end
|
106
66
|
|
107
67
|
# Versioning
|
108
68
|
# =============================================================================
|
109
69
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
desc "Dump major version"
|
115
|
-
task :major do
|
116
|
-
version.tag = "#{major+=1}.0.0"
|
117
|
-
version.save!
|
118
|
-
puts version.to_hash.to_yaml
|
119
|
-
end
|
120
|
-
|
121
|
-
desc "Dump minor version"
|
122
|
-
task :minor do
|
123
|
-
version.tag = "#{major}.#{minor+=1}.0"
|
124
|
-
version.save!
|
125
|
-
puts version.to_hash.to_yaml
|
126
|
-
end
|
70
|
+
desc "Dump version (current v#{version.tag})."
|
71
|
+
task :version, [:counter,:release] do |spec, args|
|
72
|
+
numbering = version.numbering
|
73
|
+
tagnames = %w[major minor patch]
|
127
74
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
75
|
+
if index = tagnames.index(args[:counter])
|
76
|
+
numbering[index] += 1
|
77
|
+
numbering.fill(0, (index + 1)..-1)
|
78
|
+
else
|
79
|
+
numbering[-1] += 1
|
133
80
|
end
|
134
81
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
82
|
+
numbering[-1] = "#{numbering[-1]}#{args[:release]}"
|
83
|
+
version.tag = numbering.join(".")
|
84
|
+
version.save!
|
85
|
+
puts version.to_hash.to_yaml
|
86
|
+
end
|
141
87
|
|
142
|
-
|
88
|
+
namespace :version do
|
89
|
+
desc "Update version date (current #{version.date})."
|
143
90
|
task :date, [:date] do |spec, args|
|
144
91
|
require "parsedate"
|
145
92
|
require "date"
|
@@ -149,65 +96,51 @@ namespace :version do
|
|
149
96
|
puts version.to_hash.to_yaml
|
150
97
|
end
|
151
98
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
# RubyGems
|
99
|
+
#
|
100
|
+
# Packaging
|
156
101
|
# =============================================================================
|
157
102
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
spec.sub! /spec\.version\s*=\s*".*?"/, "spec.version = #{version.tag.inspect}"
|
165
|
-
|
166
|
-
puts "Updating date of version ..."
|
167
|
-
spec.sub! /spec\.date\s*=\s*".*?"/, "spec.date = #{version.date.to_s.inspect}"
|
103
|
+
task :tagged do
|
104
|
+
abort "The gemspec not updated to version #{version.tag} (#{gemspec.version})" \
|
105
|
+
unless gemspec.version.to_s == version.tag
|
106
|
+
abort "The version #{version.tag} is not tagged." \
|
107
|
+
unless tag[1..-1] == version.tag
|
108
|
+
end
|
168
109
|
|
169
|
-
|
170
|
-
|
110
|
+
file specfile => FileList["{bin,lib,test}/**", "Rakefile"] do
|
111
|
+
spec = specfile.read
|
171
112
|
|
172
|
-
|
113
|
+
puts "Updating version ..."
|
114
|
+
spec.sub! /spec\.version\s*=\s*".*?"/, "spec.version = #{version.tag.inspect}"
|
173
115
|
|
174
|
-
|
175
|
-
|
116
|
+
puts "Updating date of version ..."
|
117
|
+
spec.sub! /spec\.date\s*=\s*".*?"/, "spec.date = #{version.date.to_s.inspect}"
|
176
118
|
|
177
|
-
|
178
|
-
|
179
|
-
sh "gem build #{gemspec.file}"
|
180
|
-
end
|
119
|
+
puts "Updating file list ..."
|
120
|
+
spec.sub! /spec\.files\s*=\s*\[.*?\]/m, "spec.files = [\n#{manifest}\n ]"
|
181
121
|
|
182
|
-
|
183
|
-
task :deploy => :build do
|
184
|
-
sh "gem push #{gemspec.spec.file_name}"
|
185
|
-
end
|
186
|
-
|
187
|
-
desc "Install gem package #{gemspec.spec.file_name}"
|
188
|
-
task :install => :build do
|
189
|
-
sh "gem install #{gemspec.spec.file_name} --local"
|
190
|
-
end
|
191
|
-
|
192
|
-
desc "Uninstall gem package #{gemspec.spec.file_name}"
|
193
|
-
task :uninstall do
|
194
|
-
sh "gem uninstall #{gemspec.spec.name} --version #{gemspec.spec.version}"
|
195
|
-
end
|
122
|
+
specfile.open("w+") { |file| file << spec }
|
196
123
|
|
124
|
+
puts "Successfully update #{specfile} file"
|
197
125
|
end
|
198
126
|
|
199
|
-
|
127
|
+
desc "Release gem package to repositories."
|
128
|
+
task :release => [ :tagged, :package ] do
|
129
|
+
sh "gem push #{package('.gem')}"
|
130
|
+
end
|
200
131
|
|
201
|
-
#
|
202
|
-
|
132
|
+
desc "Install gem package #{gemspec.file_name}."
|
133
|
+
task :install => :package do
|
134
|
+
sh "gem install #{package('.gem')} --local"
|
135
|
+
end
|
203
136
|
|
204
|
-
desc "
|
205
|
-
task :
|
206
|
-
|
137
|
+
desc "Uninstall gem package #{gemspec.file_name}."
|
138
|
+
task :uninstall do
|
139
|
+
sh "gem uninstall #{gemspec.name} --version #{gemspec.version}"
|
207
140
|
end
|
208
141
|
|
209
142
|
# Default
|
210
143
|
# =============================================================================
|
211
144
|
|
212
|
-
task :default =>
|
145
|
+
task :default => :test
|
213
146
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# == Command-Line Interface
|
2
|
+
#
|
3
|
+
# This module look a command placed in CLI directory and run it.
|
4
|
+
module <%=project.upper_camel_case_namespace%>
|
5
|
+
|
6
|
+
module CLI
|
7
|
+
|
8
|
+
require "rbconfig"
|
9
|
+
|
10
|
+
# Ruby VM installed in OS.
|
11
|
+
def self.ruby
|
12
|
+
File.join(*::RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) +
|
13
|
+
::RbConfig::CONFIG["EXEEXT"]
|
14
|
+
end
|
15
|
+
|
16
|
+
# The CLI path.
|
17
|
+
def self.path
|
18
|
+
"#{<%=project.upper_camel_case_namespace%>::ROOT}/lib/<%=project.name%>/cli"
|
19
|
+
end
|
20
|
+
|
21
|
+
# List of commands placed in <tt>lib/prigner/cli/</tt>.
|
22
|
+
def self.commands
|
23
|
+
Dir["#{path}/*.rb"].map do |source|
|
24
|
+
File.basename(source, ".rb")
|
25
|
+
end.sort
|
26
|
+
end
|
27
|
+
|
28
|
+
# Source command placed in CLI directory.
|
29
|
+
def self.source(command)
|
30
|
+
"#{path}/#{command}.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Look command in *CLI* directory and execute (by exec).
|
34
|
+
def self.run(*args)
|
35
|
+
command = args.shift if commands.include? args.first
|
36
|
+
raise RuntimeError, "unknown command '#{args.first}'" unless command
|
37
|
+
exec ruby, rubyopt, source(command), *args
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "<%=project.name%>"
|
5
|
+
|
6
|
+
ARGV.options do |args|
|
7
|
+
|
8
|
+
args.on "-s", "--set VALUE", String, "Set anything" do |anything|
|
9
|
+
puts "Setting anything to #{anything} ..."
|
10
|
+
end
|
11
|
+
|
12
|
+
args.on "-a", "--anything", TrueClass, "Do anything!" do |enabled|
|
13
|
+
puts "Enable to doing anything ..." if enabled
|
14
|
+
end
|
15
|
+
|
16
|
+
unless ARGV.empty?
|
17
|
+
args.parse!
|
18
|
+
else
|
19
|
+
puts args
|
20
|
+
exit 0
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -8,12 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.author = "<%=project.author%>"
|
9
9
|
spec.email = ""
|
10
10
|
spec.homepage = "http://rubygems.org/gems/<%=project.name%>"
|
11
|
-
|
12
|
-
#
|
11
|
+
<%if option.bin.enabled%>
|
12
|
+
#executable
|
13
|
+
spec.executables = [ "<%=project.name%>" ]
|
14
|
+
spec.default_executable = "<%=project.name%>"
|
13
15
|
#
|
14
|
-
|
16
|
+
<%end%>
|
15
17
|
#version
|
16
|
-
spec.version = "0.0
|
18
|
+
spec.version = "0.1.0"
|
17
19
|
spec.date = "<%=date%>"
|
18
20
|
#
|
19
21
|
|
@@ -25,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
25
27
|
spec.files = [
|
26
28
|
"CHANGELOG",
|
27
29
|
"COPYING",
|
28
|
-
"README.
|
30
|
+
"README.rdoc",
|
29
31
|
"Rakefile",
|
30
32
|
"lib/<%=project.name%>.rb",
|
31
33
|
"<%=project.name%>.gemspec",
|
@@ -40,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
40
42
|
#documentation
|
41
43
|
spec.has_rdoc = true
|
42
44
|
spec.extra_rdoc_files = [
|
43
|
-
"README.
|
45
|
+
"README.rdoc",
|
44
46
|
"COPYING",
|
45
47
|
"CHANGELOG"
|
46
48
|
]
|
@@ -56,9 +58,9 @@ Gem::Specification.new do |spec|
|
|
56
58
|
spec.rubyforge_project = spec.name
|
57
59
|
spec.post_install_message = <<-end_message.gsub(/^[ ]{4}/,'')
|
58
60
|
#{'-'*78}
|
59
|
-
<%=project.
|
61
|
+
<%=project.upper_camel_case_namespace%> v#{spec.version}
|
60
62
|
|
61
|
-
Thanks for use <%=project.
|
63
|
+
Thanks for use <%=project.upper_camel_case_namespace%>.
|
62
64
|
|
63
65
|
#{'-'*78}
|
64
66
|
end_message
|
@@ -1,7 +1,6 @@
|
|
1
1
|
#@ ---
|
2
|
-
#@ :tag: 0.0
|
2
|
+
#@ :tag: 0.1.0
|
3
3
|
#@ :date: <%=date%>
|
4
|
-
#@ :milestone: Pre-Alpha
|
5
4
|
#@ :timestamp: <%=Time.now.strftime "%F %T %z"%>
|
6
5
|
|
7
6
|
# encoding: UTF-8
|
@@ -15,18 +14,24 @@ module <%=project.upper_camel_case_namespace%>
|
|
15
14
|
require "pathname"
|
16
15
|
require "yaml"
|
17
16
|
|
17
|
+
ROOT = File.join(File.dirname(__FILE__), "..")
|
18
|
+
|
18
19
|
# Return the current version.
|
19
20
|
def self.version
|
20
21
|
@version ||= Version.current
|
21
22
|
end
|
22
23
|
|
23
|
-
class
|
24
|
+
# The objective of this class is to implement various ideas proposed by the
|
25
|
+
# Semantic Versioning Specification (see reference[http://semver.org/]).
|
26
|
+
class Version
|
24
27
|
|
25
28
|
FILE = Pathname.new(__FILE__).freeze
|
26
29
|
|
27
|
-
attr_accessor :
|
30
|
+
attr_accessor :date, :tag
|
31
|
+
|
28
32
|
attr_reader :timestamp
|
29
33
|
|
34
|
+
# Basic initialization of the attributes using a single hash.
|
30
35
|
def initialize(attributes = {})
|
31
36
|
attributes.each do |attribute, value|
|
32
37
|
send("#{attribute}=", value) if respond_to? "#{attribute}="
|
@@ -34,17 +39,27 @@ module <%=project.upper_camel_case_namespace%>
|
|
34
39
|
@timestamp = attributes[:timestamp]
|
35
40
|
end
|
36
41
|
|
42
|
+
# The numbering of the major, minor and patch values.
|
43
|
+
def numbering
|
44
|
+
self.tag.split(".").map do |key|
|
45
|
+
if key.match(/^(\d{1,})(\w+).*$/)
|
46
|
+
[ $1.to_i, $2 ]
|
47
|
+
else
|
48
|
+
key.to_i
|
49
|
+
end
|
50
|
+
end.flatten
|
51
|
+
end
|
52
|
+
|
37
53
|
def to_hash
|
38
|
-
[:tag, :date, :
|
54
|
+
[:tag, :date, :timestamp].inject({}) do |hash, key|
|
39
55
|
hash[key] = send(key)
|
40
56
|
hash
|
41
57
|
end
|
42
58
|
end
|
43
59
|
|
44
60
|
def save!
|
45
|
-
@date = Date.today
|
46
61
|
source = FILE.readlines
|
47
|
-
source[0..
|
62
|
+
source[0..3] = self.to_hash.to_yaml.to_s.gsub(/^/, '#@ ')
|
48
63
|
FILE.open("w+") do |file|
|
49
64
|
file << source.join("")
|
50
65
|
end
|
@@ -53,7 +68,7 @@ module <%=project.upper_camel_case_namespace%>
|
|
53
68
|
|
54
69
|
class << self
|
55
70
|
def current
|
56
|
-
yaml = FILE.readlines[0..
|
71
|
+
yaml = FILE.readlines[0..3].
|
57
72
|
join("").
|
58
73
|
gsub(/\#@ /,'')
|
59
74
|
new(YAML.load(yaml))
|
@@ -61,7 +76,7 @@ module <%=project.upper_camel_case_namespace%>
|
|
61
76
|
|
62
77
|
def to_s
|
63
78
|
name.match(/(.*?)::.*/)
|
64
|
-
"#{$1} v#{current.tag}
|
79
|
+
"#{$1} v#{current.tag} (#{current.date})"
|
65
80
|
end
|
66
81
|
end # self
|
67
82
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This code extracted from book "Ruby Best Practices" and the code be found
|
2
|
+
# in http://github.com/sandal/rbp/blob/master/testing/test_unit_extensions.rb
|
3
|
+
|
4
|
+
TEST_HOME = File.expand_path(File.dirname(__FILE__)) unless defined? TEST_HOME
|
5
|
+
FIXTURES = File.join(TEST_HOME, "fixtures") unless defined? FIXTURES
|
6
|
+
|
7
|
+
module Test::Unit
|
8
|
+
class TestCase
|
9
|
+
def self.should(description, &block)
|
10
|
+
test_name = "test_#{description.gsub(/\s+/,'_')}".downcase.to_sym
|
11
|
+
defined = instance_method(test_name) rescue false
|
12
|
+
raise "#{test_name} is already defined in #{self}" if defined
|
13
|
+
if block_given?
|
14
|
+
define_method(test_name, &block)
|
15
|
+
else
|
16
|
+
define_method(test_name) do
|
17
|
+
flunk "No implementation provided for #{description}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -1,9 +1,19 @@
|
|
1
|
-
author
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
author:
|
2
|
+
Hallison Batista
|
3
|
+
email:
|
4
|
+
hallison@codigorama.com
|
5
|
+
version:
|
6
|
+
0.2.0
|
7
|
+
description:
|
8
|
+
Default template for RubyGem projects.
|
5
9
|
|
6
10
|
options:
|
11
|
+
bin:
|
12
|
+
description:
|
13
|
+
Includes executable file.
|
14
|
+
files:
|
15
|
+
executable: bin/(project)
|
16
|
+
cli.rb: lib/(project)/cli.rb
|
7
17
|
|
8
18
|
directories:
|
9
19
|
- lib/(project)
|
@@ -12,9 +22,11 @@ directories:
|
|
12
22
|
files:
|
13
23
|
CHANGELOG:
|
14
24
|
COPYING:
|
15
|
-
README.
|
25
|
+
README.rdoc:
|
16
26
|
Rakefile:
|
17
|
-
gemspec:
|
18
|
-
module.rb:
|
19
|
-
|
27
|
+
gemspec: (project).gemspec
|
28
|
+
module.rb: lib/(project).rb
|
29
|
+
test.rb: test/(project)_test.rb
|
30
|
+
testhelper.rb: test/helper.rb
|
20
31
|
|
32
|
+
# vim: filetype=yaml
|
data/test/builder_test.rb
CHANGED
@@ -2,6 +2,11 @@ require "test/unit"
|
|
2
2
|
require "test/helpers"
|
3
3
|
require "lib/prigner"
|
4
4
|
|
5
|
+
def Prigner.shared_path
|
6
|
+
[ "#{ENV['HOME']}/.prigner/templates",
|
7
|
+
"#{FIXTURES}/templates/shared/templates" ]
|
8
|
+
end
|
9
|
+
|
5
10
|
class BuilderTest < Test::Unit::TestCase
|
6
11
|
|
7
12
|
def setup
|
@@ -34,5 +39,15 @@ class BuilderTest < Test::Unit::TestCase
|
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
42
|
+
should "create optional files" do
|
43
|
+
options = %w[bin test]
|
44
|
+
options.each do |option|
|
45
|
+
files = @builder.make_project_files_for_option(option)
|
46
|
+
files.each do |file, status|
|
47
|
+
assert status, "File #{file} not created"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
37
52
|
end
|
38
53
|
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "<%=project.name%>"
|
5
|
+
|
6
|
+
ARGV.options do |args|
|
7
|
+
|
8
|
+
args.on "-s", "--set VALUE", String, "Set anything" do |anything|
|
9
|
+
puts "Setting anything to #{anything} ..."
|
10
|
+
end
|
11
|
+
|
12
|
+
args.on "-a", "--anything", TrueClass, "Do anything!" do |enabled|
|
13
|
+
puts "Enable to doing anything ..." if enabled
|
14
|
+
end
|
15
|
+
|
16
|
+
unless ARGV.empty?
|
17
|
+
args.parse!
|
18
|
+
else
|
19
|
+
puts args
|
20
|
+
exit 0
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
File without changes
|
@@ -1,18 +1,30 @@
|
|
1
|
-
author
|
2
|
-
email
|
3
|
-
version
|
4
|
-
description
|
1
|
+
author: John Doe
|
2
|
+
email: john.doe@se7en.com
|
3
|
+
version: 0.1.0
|
4
|
+
description: Default template for Ruby projects
|
5
5
|
|
6
6
|
options:
|
7
|
-
svn:
|
8
|
-
|
7
|
+
svn:
|
8
|
+
Include Subversion keywords in code.
|
9
|
+
git:
|
10
|
+
Enable Git flags in templates.
|
11
|
+
bin:
|
12
|
+
description: Include executable file in bin/<name>.
|
13
|
+
files:
|
14
|
+
executable: bin/(project)
|
15
|
+
cli.rb: lib/(project)/cli.rb
|
16
|
+
test:
|
17
|
+
description: Include test files.
|
18
|
+
files:
|
19
|
+
empty_test.rb: test/(project)_test.rb
|
20
|
+
testhelper.rb: test/helper.rb
|
9
21
|
|
10
22
|
directories:
|
11
23
|
- test/fixtures
|
12
24
|
- lib/(project)
|
13
25
|
|
14
26
|
files:
|
15
|
-
README.mkd
|
16
|
-
module.rb
|
17
|
-
empty_test.rb : test/(project)_test.rb
|
27
|
+
README.mkd:
|
28
|
+
module.rb: lib/(project).rb
|
18
29
|
|
30
|
+
# vim: filetype=yaml
|