sinbad 0.0.2 → 0.0.3
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/README.rdoc +8 -1
- data/VERSION +1 -1
- data/bin/sinbad +3 -51
- data/lib/sinbad.rb +3 -0
- data/lib/sinbad/generator.rb +7 -0
- data/lib/sinbad/generator/application.rb +70 -0
- data/sinbad.gemspec +3 -1
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
= sinbad
|
2
|
+
A simple set of tools for quickly creating sinatra projects.
|
2
3
|
|
3
|
-
|
4
|
+
Makes a few assumptions about directory layout.
|
5
|
+
|
6
|
+
Makes no assumptions about storage/database backend
|
7
|
+
|
8
|
+
== Usage
|
9
|
+
|
10
|
+
$ sinbad appname
|
4
11
|
|
5
12
|
== Contributing to sinbad
|
6
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/sinbad
CHANGED
@@ -1,54 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
4
3
|
|
5
|
-
|
6
|
-
Dir::mkdir(root_directory)
|
7
|
-
puts "Created project \"#{root_directory}\"\n"
|
8
|
-
|
9
|
-
Dir::mkdir(root_directory + "/config")
|
10
|
-
puts "\tconfig/"
|
11
|
-
|
12
|
-
Dir::mkdir(root_directory + "/public")
|
13
|
-
puts "\tpublic/"
|
14
|
-
|
15
|
-
Dir::mkdir(root_directory + "/public/images")
|
16
|
-
puts "\t'-images/"
|
17
|
-
|
18
|
-
Dir::mkdir(root_directory + "/public/javascripts")
|
19
|
-
puts "\t'-javascripts/"
|
20
|
-
|
21
|
-
Dir::mkdir(root_directory + "/public/stylesheets")
|
22
|
-
puts "\t'-stylesheets/"
|
23
|
-
|
24
|
-
Dir::mkdir(root_directory + "/views")
|
25
|
-
puts "\tviews/"
|
26
|
-
end
|
27
|
-
OptionParser.new do |options|
|
28
|
-
options.banner = "Usage: #{File.basename($0)} [path]"
|
29
|
-
|
30
|
-
options.on("-h", "--help", "Displays this help info") do
|
31
|
-
puts options
|
32
|
-
exit 0
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
options.parse!(ARGV)
|
37
|
-
rescue OptionParser::ParseError => e
|
38
|
-
warn e.message
|
39
|
-
puts options
|
40
|
-
exit 1
|
41
|
-
end
|
42
|
-
|
43
|
-
# Quick ARGV check
|
44
|
-
if ARGV.empty?
|
45
|
-
abort "No directory specified!"
|
46
|
-
elsif File.exists?(ARGV.first)
|
47
|
-
abort "Directory already exists"
|
48
|
-
elsif ARGV.length > 1
|
49
|
-
abort "I don't think you meant to do that..."
|
50
|
-
end
|
51
|
-
|
52
|
-
create_directories(ARGV.first)
|
53
|
-
end
|
4
|
+
require 'sinbad/generator'
|
54
5
|
|
6
|
+
exit Sinbad::Generator::Application.run!(*ARGV)
|
data/lib/sinbad.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class Sinbad
|
5
|
+
class Generator
|
6
|
+
class Application
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def run!(*args)
|
10
|
+
OptionParser.new do |options|
|
11
|
+
options.banner = "Usage: #{File.basename($0)} [path]"
|
12
|
+
|
13
|
+
options.on("-h", "--help", "Displays this help info") do
|
14
|
+
puts options
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
options.parse!(args)
|
20
|
+
rescue OptionParser::ParseError => e
|
21
|
+
warn e.message
|
22
|
+
puts options
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
# Quick ARGV check
|
27
|
+
if args.empty?
|
28
|
+
abort "No directory specified!"
|
29
|
+
elsif File.exists?(args.first)
|
30
|
+
abort "Directory already exists"
|
31
|
+
elsif args.length > 1
|
32
|
+
abort "I don't think you meant to do that..."
|
33
|
+
end
|
34
|
+
|
35
|
+
create_directories(args.first)
|
36
|
+
end
|
37
|
+
|
38
|
+
return 0
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_directories(root_directory)
|
42
|
+
Dir::mkdir(root_directory)
|
43
|
+
puts "Created project \"#{root_directory}\"\n"
|
44
|
+
|
45
|
+
Dir::mkdir(root_directory + "/config")
|
46
|
+
puts "\tconfig/"
|
47
|
+
|
48
|
+
Dir::mkdir(root_directory + "/public")
|
49
|
+
puts "\tpublic/"
|
50
|
+
|
51
|
+
Dir::mkdir(root_directory + "/public/images")
|
52
|
+
puts "\t'-images/"
|
53
|
+
|
54
|
+
Dir::mkdir(root_directory + "/public/javascripts")
|
55
|
+
puts "\t'-javascripts/"
|
56
|
+
|
57
|
+
Dir::mkdir(root_directory + "/public/stylesheets")
|
58
|
+
puts "\t'-stylesheets/"
|
59
|
+
|
60
|
+
Dir::mkdir(root_directory + "/views")
|
61
|
+
puts "\tviews/"
|
62
|
+
|
63
|
+
# create_files(root_directory)
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/sinbad.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinbad}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Lee Turner}]
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"bin/sinbad",
|
29
29
|
"lib/sinbad.rb",
|
30
|
+
"lib/sinbad/generator.rb",
|
31
|
+
"lib/sinbad/generator/application.rb",
|
30
32
|
"sinbad.gemspec",
|
31
33
|
"test/helper.rb",
|
32
34
|
"test/test_sinbad.rb"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinbad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lee Turner
|
@@ -143,6 +143,8 @@ files:
|
|
143
143
|
- VERSION
|
144
144
|
- bin/sinbad
|
145
145
|
- lib/sinbad.rb
|
146
|
+
- lib/sinbad/generator.rb
|
147
|
+
- lib/sinbad/generator/application.rb
|
146
148
|
- sinbad.gemspec
|
147
149
|
- test/helper.rb
|
148
150
|
- test/test_sinbad.rb
|