showtime 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -1,2 +1,2 @@
1
1
  * Gemfile support
2
- * Optional views generation
2
+ * Lookup for default args on "~/.showtime".
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -3,7 +3,7 @@ module Showtime
3
3
  include Thor::Actions
4
4
 
5
5
  argument :name, :optional => true, :default => '.'
6
- class_options :heroku => :boolean
6
+ class_options :heroku => :boolean, :views => :boolean
7
7
 
8
8
  def self.source_root
9
9
  File.join(File.dirname(__FILE__), "templates")
@@ -33,5 +33,12 @@ module Showtime
33
33
  end
34
34
  end
35
35
 
36
+ def create_views_and_public_folders
37
+ if options.views?
38
+ directory("views", "#{name}/views")
39
+ directory("public", "#{name}/public")
40
+ end
41
+ end
42
+
36
43
  end
37
- end
44
+ end
@@ -2,5 +2,10 @@ require 'rubygems'
2
2
  require 'sinatra'
3
3
 
4
4
  get '/' do
5
+ <% if options.views? %>
6
+ @text = "Hello world!"
7
+ erb :index
8
+ <% else %>
5
9
  "Hello world!"
6
- end
10
+ <% end %>
11
+ end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Sinatra!</title>
5
+ <link rel="stylesheet" href="/stylesheets/aplication.css" type='text/css' media="screen, projection" />
6
+ <script type="text/javascript" src="/javascripts/application.js">
7
+ </script>
8
+ </head>
9
+ <body>
10
+ <h1><%= @text %></h1>
11
+ </body>
12
+ </html>
13
+
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{showtime}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Lucas Mazza"]
12
- s.date = %q{2010-07-27}
12
+ s.date = %q{2010-08-01}
13
13
  s.default_executable = %q{showtime}
14
14
  s.description = %q{Application generator for simple Sinatra apps.}
15
15
  s.email = %q{luc4smazza@gmail.com}
@@ -33,8 +33,11 @@ Gem::Specification.new do |s|
33
33
  "lib/showtime/templates/Rakefile",
34
34
  "lib/showtime/templates/application.rb",
35
35
  "lib/showtime/templates/config.ru",
36
+ "lib/showtime/templates/public/javascripts/application.js",
37
+ "lib/showtime/templates/public/stylesheets/application.css",
36
38
  "lib/showtime/templates/spec/application_spec.rb",
37
39
  "lib/showtime/templates/spec/spec_helper.rb",
40
+ "lib/showtime/templates/views/index.erb",
38
41
  "showtime.gemspec",
39
42
  "spec/generator_spec.rb",
40
43
  "spec/helper_methods.rb",
@@ -46,9 +49,9 @@ Gem::Specification.new do |s|
46
49
  s.rubygems_version = %q{1.3.7}
47
50
  s.summary = %q{Simple Sinatra generator}
48
51
  s.test_files = [
49
- "spec/generator_spec.rb",
50
- "spec/helper_methods.rb",
51
- "spec/spec_helper.rb"
52
+ "spec/spec_helper.rb",
53
+ "spec/generator_spec.rb",
54
+ "spec/helper_methods.rb"
52
55
  ]
53
56
 
54
57
  if s.respond_to? :specification_version then
@@ -34,6 +34,26 @@ describe Showtime::Generator do
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ context "with the --views option" do
39
+ before(:each) do
40
+ @path = invoke!("i_has_views", "--views")
41
+ end
42
+
43
+ it "sets a public folder with javascripts and stylesheets subfolders" do
44
+ inside(@path) do
45
+ File.exists?("public/javascripts/application.js").should be_true
46
+ File.exists?("public/stylesheets/application.css").should be_true
47
+ end
48
+ end
49
+
50
+ it "creates a simple erb view" do
51
+ inside(@path) do
52
+ File.exists?("views/index.erb").should be_true
53
+ end
54
+ end
55
+
56
+ end
37
57
 
38
58
  def invoke!(path = nil,*args)
39
59
  args = ([path] + args).compact
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showtime
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lucas Mazza
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-27 00:00:00 -03:00
18
+ date: 2010-08-01 00:00:00 -03:00
19
19
  default_executable: showtime
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -74,8 +74,11 @@ files:
74
74
  - lib/showtime/templates/Rakefile
75
75
  - lib/showtime/templates/application.rb
76
76
  - lib/showtime/templates/config.ru
77
+ - lib/showtime/templates/public/javascripts/application.js
78
+ - lib/showtime/templates/public/stylesheets/application.css
77
79
  - lib/showtime/templates/spec/application_spec.rb
78
80
  - lib/showtime/templates/spec/spec_helper.rb
81
+ - lib/showtime/templates/views/index.erb
79
82
  - showtime.gemspec
80
83
  - spec/generator_spec.rb
81
84
  - spec/helper_methods.rb
@@ -115,6 +118,6 @@ signing_key:
115
118
  specification_version: 3
116
119
  summary: Simple Sinatra generator
117
120
  test_files:
121
+ - spec/spec_helper.rb
118
122
  - spec/generator_spec.rb
119
123
  - spec/helper_methods.rb
120
- - spec/spec_helper.rb