showtime 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/.gitignore +4 -0
- data/LICENSE +20 -0
- data/README.markdown +14 -0
- data/Rakefile +33 -0
- data/TODO +2 -0
- data/VERSION +1 -0
- data/bin/showtime +5 -0
- data/lib/showtime.rb +3 -0
- data/lib/showtime/generator.rb +37 -0
- data/lib/showtime/templates/.gems +1 -0
- data/lib/showtime/templates/Rakefile +9 -0
- data/lib/showtime/templates/application.rb +6 -0
- data/lib/showtime/templates/config.ru +12 -0
- data/lib/showtime/templates/spec/application_spec.rb +10 -0
- data/lib/showtime/templates/spec/spec_helper.rb +12 -0
- data/spec/generator_spec.rb +55 -0
- data/spec/helper_methods.rb +21 -0
- data/spec/spec_helper.rb +14 -0
- metadata +119 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Lucas Mazza
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Showtime
|
2
|
+
|
3
|
+
Showtime's a sinatra apps generator based on [thor](http://github.com/wycats/thor). Just run `showtime [appame]` and start hacking!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`gem install showtime`
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
`showtime [appname] [--heroku]`
|
12
|
+
|
13
|
+
appname folder name for the application. Otherwise uses the current folder.
|
14
|
+
--heroku builds a .gems file for heroku usage.
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = "showtime"
|
9
|
+
gem.summary = %Q{Simple Sinatra generator}
|
10
|
+
gem.description = %Q{Application generator for simple Sinatra apps.}
|
11
|
+
gem.email = "luc4smazza@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/lucasmazza/showtime"
|
13
|
+
gem.authors = ["Lucas Mazza"]
|
14
|
+
gem.add_development_dependency "rspec", ">= 1.3.0"
|
15
|
+
gem.require_path = 'lib'
|
16
|
+
gem.bindir = "bin"
|
17
|
+
gem.executables = %w(showtime)
|
18
|
+
gem.test_files.include 'spec/**/*'
|
19
|
+
gem.add_dependency "thor", "0.13.8"
|
20
|
+
end
|
21
|
+
Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'spec/rake/spectask'
|
27
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.spec_opts = %w(--format specdoc --color)
|
30
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
+
end
|
32
|
+
|
33
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/showtime
ADDED
data/lib/showtime.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Showtime
|
2
|
+
class Generator < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
argument :name, :optional => true, :default => '.'
|
6
|
+
class_options :heroku => :boolean
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.join(File.dirname(__FILE__), "templates")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_application_file
|
13
|
+
template("application.rb", "#{name}/application.rb")
|
14
|
+
end
|
15
|
+
def create_rakefile
|
16
|
+
template("Rakefile", "#{name}/Rakefile")
|
17
|
+
end
|
18
|
+
def create_config_ru
|
19
|
+
template("config.ru", "#{name}/config.ru")
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_lib_folder
|
23
|
+
empty_directory("#{name}/lib")
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_spec_folder_and_helper
|
27
|
+
directory("spec", "#{name}/spec")
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_gem_dependency_strategy
|
31
|
+
if options.heroku?
|
32
|
+
template(".gems", "#{name}/.gems")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
sinatra
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'application'
|
2
|
+
|
3
|
+
<% unless options.heroku? %>
|
4
|
+
root_dir = File.dirname(__FILE__)
|
5
|
+
|
6
|
+
set :environment, ENV['RACK_ENV'].to_sym
|
7
|
+
set :root, root_dir
|
8
|
+
set :app_file, File.join(root_dir, 'application.rb')
|
9
|
+
disable :run
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
run Sinatra::Application
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helper_methods'
|
3
|
+
|
4
|
+
describe Showtime::Generator do
|
5
|
+
include HelperMethods
|
6
|
+
|
7
|
+
context "with empty arguments" do
|
8
|
+
before(:each) { invoke! }
|
9
|
+
|
10
|
+
it "creates the app on the working directory" do
|
11
|
+
inside(sandbox) { verify_expected_files! }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with a given project name" do
|
16
|
+
before(:each) do
|
17
|
+
@path = invoke!("my_awesome_app")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "creates the app on the given directory" do
|
21
|
+
inside(@path) { verify_expected_files! }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with the --heroku option" do
|
26
|
+
before(:each) do
|
27
|
+
@path = invoke!("some_heroku_app", "--heroku")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "creates the .gems file for deployment" do
|
31
|
+
inside(@path) do
|
32
|
+
verify_expected_files!
|
33
|
+
File.exists?(".gems").should be_true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def invoke!(path = nil,*args)
|
39
|
+
args = ([path] + args).compact
|
40
|
+
ARGV.replace(args)
|
41
|
+
|
42
|
+
inside(sandbox) do
|
43
|
+
silenced(:stdout) { Showtime::Generator.start }
|
44
|
+
end
|
45
|
+
path ? File.join(sandbox, path) : sandbox
|
46
|
+
end
|
47
|
+
|
48
|
+
def verify_expected_files!
|
49
|
+
%W(application.rb Rakefile config.ru spec/spec_helper.rb spec/application_spec.rb).each do |file|
|
50
|
+
File.exists?(file).should be_true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module HelperMethods
|
2
|
+
|
3
|
+
# Stealed from http://github.com/wycats/thor/blob/master/spec/spec_helper.rb#L32
|
4
|
+
def silenced(stream)
|
5
|
+
begin
|
6
|
+
stream = stream.to_s
|
7
|
+
eval "$#{stream} = StringIO.new"
|
8
|
+
yield
|
9
|
+
result = eval("$#{stream}").string
|
10
|
+
ensure
|
11
|
+
eval("$#{stream} = #{stream.upcase}")
|
12
|
+
end
|
13
|
+
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
def inside(path)
|
18
|
+
FileUtils.cd(path) { yield }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: showtime
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Lucas Mazza
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-21 00:00:00 -03:00
|
19
|
+
default_executable: showtime
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 0
|
34
|
+
version: 1.3.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: thor
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 59
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 13
|
49
|
+
- 8
|
50
|
+
version: 0.13.8
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
description: Application generator for simple Sinatra apps.
|
54
|
+
email: luc4smazza@gmail.com
|
55
|
+
executables:
|
56
|
+
- showtime
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README.markdown
|
62
|
+
- TODO
|
63
|
+
files:
|
64
|
+
- .gitignore
|
65
|
+
- LICENSE
|
66
|
+
- README.markdown
|
67
|
+
- Rakefile
|
68
|
+
- TODO
|
69
|
+
- VERSION
|
70
|
+
- bin/showtime
|
71
|
+
- lib/showtime.rb
|
72
|
+
- lib/showtime/generator.rb
|
73
|
+
- lib/showtime/templates/.gems
|
74
|
+
- lib/showtime/templates/Rakefile
|
75
|
+
- lib/showtime/templates/application.rb
|
76
|
+
- lib/showtime/templates/config.ru
|
77
|
+
- lib/showtime/templates/spec/application_spec.rb
|
78
|
+
- lib/showtime/templates/spec/spec_helper.rb
|
79
|
+
- spec/generator_spec.rb
|
80
|
+
- spec/helper_methods.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: http://github.com/lucasmazza/showtime
|
84
|
+
licenses: []
|
85
|
+
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options:
|
88
|
+
- --charset=UTF-8
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.3.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Simple Sinatra generator
|
116
|
+
test_files:
|
117
|
+
- spec/generator_spec.rb
|
118
|
+
- spec/helper_methods.rb
|
119
|
+
- spec/spec_helper.rb
|