mafia 0.0.9 → 0.1.0
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/lib/mafia.rb +7 -1
- data/lib/mafia/templates/app.rb.tt +8 -5
- data/lib/mafia/templates/bin.tt +41 -0
- data/lib/mafia/templates/gem.rb.tt +6 -1
- data/lib/mafia/templates/gemspec.tt +1 -1
- data/lib/version.rb +1 -1
- metadata +5 -4
data/lib/mafia.rb
CHANGED
@@ -35,7 +35,13 @@ module Mafia
|
|
35
35
|
def create_version_file
|
36
36
|
template("version.rb.tt", "#{name}/lib/version.rb")
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
|
+
def create_bin_file
|
40
|
+
if yes? "\n\nCreate a binary to run your application?", :yellow
|
41
|
+
template("bin.tt", "#{name}/bin/#{name}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
39
45
|
def create_gem_file
|
40
46
|
template("gem.rb.tt", "#{name}/lib/#{name}.rb")
|
41
47
|
end
|
@@ -4,10 +4,13 @@ require "sass"
|
|
4
4
|
|
5
5
|
module <%= camelize(name) %>
|
6
6
|
class Application < Sinatra::Base
|
7
|
-
|
7
|
+
|
8
8
|
set :public_folder, File.join(File.dirname(__FILE__), 'public')
|
9
|
-
set :views, File.join(File.dirname(__FILE__), 'views')
|
10
|
-
|
11
|
-
# Your actions go here
|
9
|
+
set :views, File.join(File.dirname(__FILE__), 'views')
|
10
|
+
|
11
|
+
# Your actions go here
|
12
|
+
get '/' do
|
13
|
+
"Hello World. I am the template <%= camelize(name) %> application."
|
14
|
+
end
|
12
15
|
end
|
13
|
-
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "optparse"
|
7
|
+
require "<%= name %>"
|
8
|
+
require "version"
|
9
|
+
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
optparse = OptionParser.new do |opts|
|
13
|
+
# Set a banner, displayed at the top
|
14
|
+
# of the help screen.
|
15
|
+
opts.banner = "Usage: <%= camelize(name) %> [options] ..."
|
16
|
+
|
17
|
+
opts.separator ''
|
18
|
+
opts.separator "Configuration options:"
|
19
|
+
|
20
|
+
opts.on_tail( "-v", "--version", "Show version") do
|
21
|
+
puts "<%= camelize(name) %> version #{<%= camelize(name) %>::VERSION}"
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.separator ""
|
26
|
+
opts.separator "Common options:"
|
27
|
+
|
28
|
+
opts.on_tail("-h", "--help", "Display this screen" ) do
|
29
|
+
puts opts
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
optparse.parse!
|
36
|
+
<%= camelize(name) %>::Application.run!
|
37
|
+
rescue OptionParser::InvalidArgument, OptionParser::InvalidOption, OptionParser::MissingArgument
|
38
|
+
puts $!.to_s
|
39
|
+
puts optparse
|
40
|
+
exit
|
41
|
+
end
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency "sinatra"
|
19
|
+
s.add_dependency "sinatra", "1.3.1"
|
20
20
|
s.add_dependency "haml"
|
21
21
|
s.add_dependency "sass"
|
22
22
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mafia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-26 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70345886295140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70345886295140
|
25
25
|
description: Generator to create sinatra apps that are also gems
|
26
26
|
email:
|
27
27
|
- george@accountsapp.com
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/mafia/templates/README.md.tt
|
43
43
|
- lib/mafia/templates/Rakefile
|
44
44
|
- lib/mafia/templates/app.rb.tt
|
45
|
+
- lib/mafia/templates/bin.tt
|
45
46
|
- lib/mafia/templates/config.ru.tt
|
46
47
|
- lib/mafia/templates/gem.rb.tt
|
47
48
|
- lib/mafia/templates/gemspec.tt
|