gemstub 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gemstub +35 -7
- metadata +2 -2
data/bin/gemstub
CHANGED
@@ -9,7 +9,10 @@ app = ARGV[0]
|
|
9
9
|
raise "You must specify a name for this gem!" if app.nil?
|
10
10
|
|
11
11
|
options = OpenStruct.new
|
12
|
+
options.version = "0.0.1"
|
12
13
|
options.binary = false
|
14
|
+
options.author = (ENV["USERNAME"] || ENV["USER"])
|
15
|
+
options.force = false
|
13
16
|
|
14
17
|
opts = OptionParser.new do |opts|
|
15
18
|
opts.banner = "Usage: example.rb [options]"
|
@@ -18,10 +21,34 @@ opts = OptionParser.new do |opts|
|
|
18
21
|
options.binary = true
|
19
22
|
end
|
20
23
|
|
24
|
+
opts.on("-v [VERSION]") do |v|
|
25
|
+
options.version = v
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-a [AUTHOR]") do |v|
|
29
|
+
options.author = v
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on("-f") do |v|
|
33
|
+
options.force = true
|
34
|
+
end
|
35
|
+
|
21
36
|
end
|
22
37
|
|
38
|
+
opts.parse!(ARGV)
|
39
|
+
|
40
|
+
puts "options = #{options.inspect}"
|
41
|
+
|
23
42
|
app = app.downcase.gsub(" ", "_")
|
24
43
|
|
44
|
+
if options.force
|
45
|
+
begin
|
46
|
+
FileUtils.rm_rf app
|
47
|
+
rescue Exception => e
|
48
|
+
puts e
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
25
52
|
puts "create directory: #{app}"
|
26
53
|
Dir.mkdir app
|
27
54
|
|
@@ -39,7 +66,6 @@ Dir.mkdir "#{app}/test"
|
|
39
66
|
|
40
67
|
puts "creating Rakefile"
|
41
68
|
File.open("#{app}/Rakefile", "w") do |file|
|
42
|
-
user = (ENV["USERNAME"] || ENV["USER"])
|
43
69
|
file << %{
|
44
70
|
require 'rake'
|
45
71
|
require 'rake/gempackagetask'
|
@@ -49,10 +75,10 @@ require 'find'
|
|
49
75
|
|
50
76
|
gem_spec = Gem::Specification.new do |s|
|
51
77
|
s.name = '#{app}'
|
52
|
-
s.version = '
|
78
|
+
s.version = '#{options.version}'
|
53
79
|
s.summary = %{#{app}}
|
54
|
-
s.description = %{#{app} was developed by: #{
|
55
|
-
s.author = "#{
|
80
|
+
s.description = %{#{app} was developed by: #{options.author}}
|
81
|
+
s.author = "#{options.author}"
|
56
82
|
#s.email = ""
|
57
83
|
#s.homepage = ""
|
58
84
|
|
@@ -60,7 +86,9 @@ gem_spec = Gem::Specification.new do |s|
|
|
60
86
|
|
61
87
|
s.files = FileList['lib/**/*.rb', 'README', 'doc/**/*.*']
|
62
88
|
s.require_paths << 'lib'
|
63
|
-
|
89
|
+
|
90
|
+
# This will loop through all files in your lib directory and autorequire them for you.
|
91
|
+
# It will also ignore all Subversion files.
|
64
92
|
s.autorequire = []
|
65
93
|
|
66
94
|
["lib"].each do |dir|
|
@@ -69,7 +97,7 @@ gem_spec = Gem::Specification.new do |s|
|
|
69
97
|
s.require_paths << f
|
70
98
|
else
|
71
99
|
if FileTest.file?(f)
|
72
|
-
m = f.match(
|
100
|
+
m = f.match(/[a-zA-Z\-_]*.rb/)
|
73
101
|
if m
|
74
102
|
model = m.to_s
|
75
103
|
unless model.match("test_")
|
@@ -83,7 +111,7 @@ gem_spec = Gem::Specification.new do |s|
|
|
83
111
|
end
|
84
112
|
s.autorequire.uniq!
|
85
113
|
|
86
|
-
s.bindir = "bin"
|
114
|
+
#{options.binary ? "" : "#"}s.bindir = "bin"
|
87
115
|
#{options.binary ? "" : "#"}s.executables = "#{app}"
|
88
116
|
#s.default_executable = ""
|
89
117
|
#s.add_dependency("", "")
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: gemstub
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-06
|
6
|
+
version: 1.0.3
|
7
|
+
date: 2007-07-06 00:00:00 -04:00
|
8
8
|
summary: "Gemstub is a very simple tool for creating the stub code you need to build a gem. Usage: at a command prompt simply type: gemstub your_gem_name_here That's it, after that, you all you have to do is the actual coding of your gem! Enjoy!"
|
9
9
|
require_paths:
|
10
10
|
- lib
|