gemstub 1.0.1 → 1.0.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/bin/gemstub +44 -4
- metadata +2 -2
data/bin/gemstub
CHANGED
@@ -1,9 +1,25 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'optparse'
|
3
|
+
require 'optparse/time'
|
4
|
+
require 'ostruct'
|
5
|
+
require 'pp'
|
2
6
|
require "active_support"
|
3
7
|
|
4
8
|
app = ARGV[0]
|
5
9
|
raise "You must specify a name for this gem!" if app.nil?
|
6
10
|
|
11
|
+
options = OpenStruct.new
|
12
|
+
options.binary = false
|
13
|
+
|
14
|
+
opts = OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: example.rb [options]"
|
16
|
+
|
17
|
+
opts.on("-b") do
|
18
|
+
options.binary = true
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
7
23
|
app = app.downcase.gsub(" ", "_")
|
8
24
|
|
9
25
|
puts "create directory: #{app}"
|
@@ -44,9 +60,31 @@ gem_spec = Gem::Specification.new do |s|
|
|
44
60
|
|
45
61
|
s.files = FileList['lib/**/*.rb', 'README', 'doc/**/*.*']
|
46
62
|
s.require_paths << 'lib'
|
47
|
-
|
63
|
+
|
64
|
+
s.autorequire = []
|
65
|
+
|
66
|
+
["lib"].each do |dir|
|
67
|
+
Find.find(dir) do |f|
|
68
|
+
if FileTest.directory?(f) and !f.match(/.svn/)
|
69
|
+
s.require_paths << f
|
70
|
+
else
|
71
|
+
if FileTest.file?(f)
|
72
|
+
m = f.match(/\/[a-zA-Z-_]*.rb/)
|
73
|
+
if m
|
74
|
+
model = m.to_s
|
75
|
+
unless model.match("test_")
|
76
|
+
x = model.gsub('/', '').gsub('.rb', '')
|
77
|
+
s.autorequire << x
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
s.autorequire.uniq!
|
85
|
+
|
48
86
|
s.bindir = "bin"
|
49
|
-
#s.executables = "#{app}"
|
87
|
+
#{options.binary ? "" : "#"}s.executables = "#{app}"
|
50
88
|
#s.default_executable = ""
|
51
89
|
#s.add_dependency("", "")
|
52
90
|
#s.add_dependency("", "")
|
@@ -84,8 +122,10 @@ README
|
|
84
122
|
}.strip
|
85
123
|
end
|
86
124
|
|
87
|
-
|
88
|
-
|
125
|
+
ldir = options.binary ? "bin" : "lib"
|
126
|
+
fext = options.binary ? "" : ".rb"
|
127
|
+
puts "creating #{app}/#{ldir}/#{app}#{fext}"
|
128
|
+
File.open("#{app}/#{ldir}/#{app}#{fext}", "w") do |file|
|
89
129
|
file << ""
|
90
130
|
end
|
91
131
|
|
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-04
|
6
|
+
version: 1.0.2
|
7
|
+
date: 2007-06-04 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
|