sinatra-gen 0.2.2 → 0.3.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.
@@ -1,3 +1,8 @@
1
+ == 0.3.0 2009-04-29
2
+
3
+ * No longer use deprecated Sinatra::Test - depend on Rack::Test and simple helper
4
+ * Changed defaults for test framework and views to bacon and haml respectively based on community feedback/usage.
5
+
1
6
  == 0.2.2 2009-02-10
2
7
 
3
8
  * Added --heroku option which creates a heroku app [Thanks to Michael Kohl]
@@ -14,11 +14,11 @@ user into any specific frameworks/dev practices.
14
14
 
15
15
  Run:
16
16
 
17
- sinatra-gen [appname] [actions] [options]
17
+ sinatra-gen [appname] [options] [paths]
18
18
 
19
19
  e.g.
20
20
 
21
- sinatra-gen mysinatrapp get:/ post:/:id --vendor --init --test=shoulda --views=haml
21
+ sinatra-gen mysinatrapp --vendor --init --test=shoulda --views=haml get:/ post:/:id
22
22
 
23
23
  === Actions
24
24
 
@@ -48,16 +48,25 @@ It will also generate test skeletons in the test framework of your choosing.
48
48
 
49
49
  (can also be obtained by running sinatra-gen with no arguments):
50
50
 
51
- -v, --version Show the sinatra-gen version number and quit.
52
- -d, --vendor Extract the latest sinatra to vendor/sinatra
53
- --tiny Only create the minimal files.
54
- --init Initialize a git repository
55
- --heroku Create a Heroku app (also runs 'git init'). Optionally, specify the path to the heroku bin
56
- --cap Adds config directory with basic capistrano deploy.rb
57
- --scripts Install the rubigen scripts (script/generate, script/destroy)
58
- --git /path/to/git Specify a different path for 'git'
59
- --test=test_framework Specify your testing framework (unit (default)/rspec/spec/shoulda/bacon)
60
- --views=view_framework Specify your view framework (erb (default)/haml/builder)
51
+ -v, --version Show the sinatra-gen version number and quit.
52
+ -d, --vendor Extract the latest sinatra to vendor/sinatra
53
+ --tiny Only create the minimal files.
54
+ --init Initialize a git repository
55
+ --heroku Create a Heroku app (also runs 'git init').
56
+ Optionally, specify the path to the heroku bin
57
+ --cap Adds config directory with basic capistrano deploy.rb
58
+ --scripts Install the rubigen scripts (script/generate, script/destroy)
59
+ --test=test_framework Specify your testing framework (bacon (default)/rspec/spec/shoulda/test)
60
+ --views=view_framework Specify your view framework (haml (default)/erb/builder)
61
+ General Options:
62
+ -h, --help Show this help message and quit.
63
+ -p, --pretend Run but do not make any changes.
64
+ -f, --force Overwrite files that already exist.
65
+ -s, --skip Skip files that already exist.
66
+ -q, --quiet Suppress normal output.
67
+ -t, --backtrace Debugging: show backtrace on errors.
68
+ -c, --svn Modify files with subversion. (Note: svn must be in path)
69
+ -g, --git Modify files with git. (Note: git must be in path)
61
70
 
62
71
 
63
72
  The --tiny option will create no directories. Just an app.rb, a Rakefile, and a config.ru (Rackup file)
data/Rakefile CHANGED
@@ -6,11 +6,11 @@ require File.dirname(__FILE__) + '/lib/sinatra-gen'
6
6
  $hoe = Hoe.new('sinatra-gen', SinatraGen::VERSION) do |p|
7
7
  p.developer('Aaron Quint', 'aaron@quirkey.com')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
- p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
9
  p.rubyforge_name = 'quirkey'
11
10
  p.extra_deps = [
12
11
  ['rubigen','>= 1.5.2'],
13
- ['sinatra', '>= 0.9.0']
12
+ ['sinatra', '>= 0.9.0'],
13
+ ['rack-test', '>= 0.1.0']
14
14
  ]
15
15
  p.extra_dev_deps = [
16
16
  ['newgem', ">= #{::Newgem::VERSION}"]
@@ -5,4 +5,4 @@ Description:
5
5
 
6
6
  Usage:
7
7
 
8
- sinatra-gen [appname] [options]
8
+ sinatra-gen [appname] [options] [paths]
@@ -51,13 +51,17 @@ class SinatraAppGenerator < RubiGen::Base
51
51
  m.template 'config.ru.erb', 'config.ru'
52
52
  m.template 'app.rb.erb' , "#{app_name}.rb"
53
53
  m.template 'Rakefile.erb' , 'Rakefile'
54
-
54
+
55
+ test_dir = (tests_are_specs? ? 'spec' : 'test')
56
+
55
57
  unless tiny
56
58
  BASEDIRS.each { |path| m.directory path }
59
+ m.directory test_dir
57
60
  m.file 'config.yml', 'config.yml'
58
61
  m.template 'lib/module.rb.erb', "lib/#{app_name}.rb"
59
- m.template 'test/test_helper.rb.erb', 'test/test_helper.rb'
60
- m.template "test/test_app_#{test_framework}.rb.erb", "test/test_#{app_name}.rb"
62
+ m.template 'test/test_helper.rb.erb', "#{test_dir}/#{test_dir}_helper.rb"
63
+ m.template "test/test_app_#{test_framework}.rb.erb",
64
+ "#{test_dir}/#{(tests_are_specs? ? "#{app_name}_spec" : "test_#{app_name}")}.rb"
61
65
  m.template "views/#{view_framework}_index.erb", "views/index.#{view_framework}"
62
66
  m.template "views/#{view_framework}_layout.erb", "views/layout.#{view_framework}" unless view_framework == 'builder'
63
67
  end
@@ -94,7 +98,7 @@ class SinatraAppGenerator < RubiGen::Base
94
98
  <<-EOS
95
99
  Creates the skeleton for a new sinatra app
96
100
 
97
- USAGE: #{spec.name} app_name
101
+ USAGE: #{spec.name} app_name [options] [paths]
98
102
  EOS
99
103
  end
100
104
 
@@ -106,12 +110,12 @@ class SinatraAppGenerator < RubiGen::Base
106
110
  opts.on("-d", "--vendor", "Extract the latest sinatra to vendor/sinatra") {|o| options[:vendor] = o }
107
111
  opts.on("--tiny", "Only create the minimal files.") {|o| options[:tiny] = o }
108
112
  opts.on("--init", "Initialize a git repository") {|o| options[:init] = o }
109
- opts.on("--heroku", "Create a Heroku app (also runs 'git init'). Optionally, specify the path to the heroku bin") { |o| options[:heroku] = o }
113
+ opts.on("--heroku", "Create a Heroku app (also runs 'git init').\n Optionally, specify the path to the heroku bin") { |o| options[:heroku] = o }
110
114
  opts.on("--cap", "Adds config directory with basic capistrano deploy.rb") {|o| options[:cap] = o }
111
115
  opts.on("--scripts", "Install the rubigen scripts (script/generate, script/destroy)") {|o| options[:scripts] = o }
112
116
  opts.on("--git /path/to/git", "Specify a different path for 'git'") {|o| options[:git] = o }
113
- opts.on("--test=test_framework", String, "Specify your testing framework (unit (default)/rspec/spec/shoulda/bacon)") {|o| options[:test_framework] = o }
114
- opts.on("--views=view_framework", "Specify your view framework (erb (default)/haml/builder)") {|o| options[:view_framework] = o }
117
+ opts.on("--test=test_framework", String, "Specify your testing framework (bacon (default)/rspec/spec/shoulda/test)") {|o| options[:test_framework] = o }
118
+ opts.on("--views=view_framework", "Specify your view framework (haml (default)/erb/builder)") {|o| options[:view_framework] = o }
115
119
  end
116
120
 
117
121
  def extract_options
@@ -124,8 +128,8 @@ class SinatraAppGenerator < RubiGen::Base
124
128
  self.git = options[:git] || `which git`.strip
125
129
  self.heroku = options[:heroku] ? `which heroku`.strip : false
126
130
  self.git_init = options[:init] || !!heroku || false
127
- self.test_framework = options[:test_framework] || 'unit'
128
- self.view_framework = options[:view_framework] || 'erb'
131
+ self.test_framework = options[:test_framework] || 'bacon'
132
+ self.view_framework = options[:view_framework] || 'haml'
129
133
  self.install_scripts = options[:scripts] || false
130
134
  end
131
135
 
@@ -136,12 +140,15 @@ class SinatraAppGenerator < RubiGen::Base
136
140
  def parse_actions(*action_args)
137
141
  @actions = action_args.flatten.collect { |a| a.split(':', 2) }
138
142
  end
143
+
144
+ def tests_are_specs?
145
+ ['rspec','spec','bacon'].include?(test_framework)
146
+ end
139
147
 
140
148
  # Installation skeleton. Intermediate directories are automatically
141
149
  # created so don't sweat their absence here.
142
150
  BASEDIRS = %w(
143
151
  lib
144
- test
145
152
  public
146
153
  views
147
154
  )
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe '<%= klass_name %>' do
4
4
 
@@ -6,14 +6,14 @@ describe '<%= klass_name %>' do
6
6
  <% actions.each do |meth, path| %>
7
7
  it 'should <%= meth %> <%= path %>' do
8
8
  <%= meth %> '<%= path %>'
9
- should.be.ok
9
+ last_response.should.be.ok
10
10
  end
11
11
 
12
12
  <%- end -%>
13
13
  <%- else -%>
14
14
  it 'should load the index' do
15
15
  get '/'
16
- should.be.ok
16
+ last_response.should.be.ok
17
17
  end
18
18
  <%- end -%>
19
19
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe '<%= klass_name %>' do
4
4
 
@@ -6,14 +6,14 @@ describe '<%= klass_name %>' do
6
6
  <% actions.each do |meth, path| %>
7
7
  it 'should <%= meth %> <%= path %>' do
8
8
  <%= meth %> '<%= path %>'
9
- @response.should be_ok
9
+ last_response.should be_ok
10
10
  end
11
11
 
12
12
  <%- end -%>
13
13
  <%- else -%>
14
14
  it 'should load the index' do
15
15
  get '/'
16
- @response.should be_ok
16
+ last_response.should be_ok
17
17
  end
18
18
  <%- end -%>
19
19
  end
@@ -11,7 +11,7 @@ class <%= klass_name -%>Test < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  should "respond" do
14
- assert @response.body
14
+ assert body
15
15
  end
16
16
  end
17
17
 
@@ -23,7 +23,7 @@ class <%= klass_name -%>Test < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  should "respond" do
26
- assert @response.body
26
+ assert body
27
27
  end
28
28
  end
29
29
  <%- end -%>
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe '<%= klass_name %>' do
4
4
 
@@ -6,14 +6,14 @@ describe '<%= klass_name %>' do
6
6
  <% actions.each do |meth, path| %>
7
7
  it 'should <%= meth %> <%= path %>' do
8
8
  <%= meth %> '<%= path %>'
9
- should.be.ok
9
+ last_response.should.be.ok
10
10
  end
11
11
 
12
12
  <%- end -%>
13
13
  <%- else -%>
14
14
  it 'should load the index' do
15
15
  get '/'
16
- should.be.ok
16
+ last_response.should.be.ok
17
17
  end
18
18
  <%- end -%>
19
19
 
@@ -1,21 +1,58 @@
1
1
  <%- if vendor -%>
2
2
  $:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra', 'lib')
3
- require 'sinatra'
4
- <%- else -%>
5
- require 'sinatra'
6
3
  <%- end -%>
7
- <%- case test_framework -%>
4
+ require 'sinatra'
5
+ require 'rack/test'
6
+
7
+ Sinatra::Default.set(
8
+ :environment => :test,
9
+ :run => false,
10
+ :raise_errors => true,
11
+ :logging => false
12
+ )
13
+
14
+ require File.join(File.dirname(__FILE__), '..', '<%= app_name %>.rb')
15
+
16
+ module TestHelper
17
+
18
+ def app
19
+ # change to your app class if using the 'classy' style
20
+ Sinatra::Application.new
21
+ end
22
+
23
+ def body
24
+ last_response.body
25
+ end
26
+
27
+ def status
28
+ last_response.status
29
+ end
30
+
31
+ include Rack::Test::Methods
32
+
33
+ end
34
+
35
+ <%- case test_framework -%>
8
36
  <%- when 'rspec' -%>
9
37
  require 'spec'
10
- require 'sinatra/test/rspec'
38
+ require 'spec/interop/test'
39
+
40
+ Spec::Runner.configure do |config|
41
+ include TestHelper
42
+ end
11
43
  <%- when 'bacon' -%>
12
- require 'sinatra/test/bacon'
44
+ require 'bacon'
45
+
46
+ Bacon::Context.send(:include, TestHelper)
13
47
  <%- when 'spec' -%>
14
- require 'sinatra/test/spec'
48
+ require 'test/spec'
15
49
  <%- when 'shoulda' -%>
16
- require 'sinatra/test/unit'
50
+ require 'test/unit'
17
51
  require 'shoulda'
52
+
53
+ Test::Unit::TestCase.send(:include, TestHelper)
18
54
  <%- when 'unit' -%>
19
- require 'sinatra/test/unit'
20
- <%- end -%>
21
- require File.join(File.dirname(__FILE__), '..', '<%= app_name %>.rb')
55
+ require 'test/unit'
56
+
57
+ Test::Unit::TestCase.send(:include, TestHelper)
58
+ <%- end -%>
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module SinatraGen
5
- VERSION = '0.2.2'
5
+ VERSION = '0.3.0'
6
6
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sinatra-gen}
5
- s.version = "0.2.2"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Aaron Quint"]
9
- s.date = %q{2009-03-27}
9
+ s.date = %q{2009-04-29}
10
10
  s.default_executable = %q{sinatra-gen}
11
11
  s.description = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework. For more information on sinatra, check out http://sinatrarb.com}
12
12
  s.email = ["aaron@quirkey.com"]
@@ -30,17 +30,20 @@ Gem::Specification.new do |s|
30
30
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
31
31
  s.add_runtime_dependency(%q<rubigen>, [">= 1.5.2"])
32
32
  s.add_runtime_dependency(%q<sinatra>, [">= 0.9.0"])
33
+ s.add_runtime_dependency(%q<rack-test>, [">= 0.1.0"])
33
34
  s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
34
35
  s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
35
36
  else
36
37
  s.add_dependency(%q<rubigen>, [">= 1.5.2"])
37
38
  s.add_dependency(%q<sinatra>, [">= 0.9.0"])
39
+ s.add_dependency(%q<rack-test>, [">= 0.1.0"])
38
40
  s.add_dependency(%q<newgem>, [">= 1.2.3"])
39
41
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
40
42
  end
41
43
  else
42
44
  s.add_dependency(%q<rubigen>, [">= 1.5.2"])
43
45
  s.add_dependency(%q<sinatra>, [">= 0.9.0"])
46
+ s.add_dependency(%q<rack-test>, [">= 0.1.0"])
44
47
  s.add_dependency(%q<newgem>, [">= 1.2.3"])
45
48
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
46
49
  end
@@ -13,17 +13,17 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
13
13
 
14
14
  def test_generate_app_without_options
15
15
  run_generator('sinatra_app', [APP_ROOT], sources)
16
- assert_basic_paths_and_files
17
- assert_generated_file 'views/layout.erb'
18
- assert_generated_file 'views/index.erb'
19
- assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
20
- assert_match(/def test/, test_contents)
16
+ assert_basic_paths_and_files('spec')
17
+ assert_generated_file 'views/layout.haml'
18
+ assert_generated_file 'views/index.haml'
19
+ assert_generated_file "spec/#{app_name}_spec.rb" do |test_contents|
20
+ assert_match(/describe/, test_contents)
21
21
  end
22
22
  end
23
23
 
24
24
  def test_generate_app_with_vendor_option
25
25
  run_generator('sinatra_app', [APP_ROOT, '--vendor'], sources)
26
- assert_basic_paths_and_files
26
+ assert_basic_paths_and_files('spec')
27
27
  assert_directory_exists 'vendor/sinatra/lib'
28
28
  end
29
29
 
@@ -36,13 +36,13 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
36
36
 
37
37
  def test_generate_app_with_init_option
38
38
  run_generator('sinatra_app', [APP_ROOT, '-i'], sources)
39
- assert_basic_paths_and_files
39
+ assert_basic_paths_and_files('spec')
40
40
  assert_directory_exists '.git'
41
41
  end
42
42
 
43
43
  def test_generate_app_with_heroku_option
44
44
  run_generator('sinatra_app', [APP_ROOT, '--heroku'], sources)
45
- assert_basic_paths_and_files
45
+ assert_basic_paths_and_files('spec')
46
46
  assert_directory_exists '.git'
47
47
  assert_generated_file '.git/config' do |config_contents|
48
48
  assert_match(/\[remote "heroku"\]/, config_contents)
@@ -51,7 +51,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
51
51
 
52
52
  def test_generate_app_with_cap_option
53
53
  run_generator('sinatra_app', [APP_ROOT, '--cap'], sources)
54
- assert_basic_paths_and_files
54
+ assert_basic_paths_and_files('spec')
55
55
  assert_directory_exists 'config'
56
56
  assert_generated_file 'Capfile'
57
57
  assert_generated_file 'config/deploy.rb' do |deploy_contents|
@@ -61,31 +61,31 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
61
61
 
62
62
  def test_generate_app_with_rspect_test_option
63
63
  run_generator('sinatra_app', [APP_ROOT, '--test=rspec'], sources)
64
- assert_basic_paths_and_files
65
- assert_generated_file 'test/test_helper.rb' do |helper_contents|
66
- assert_match(/sinatra\/test\/rspec/, helper_contents)
64
+ assert_basic_paths_and_files('spec')
65
+ assert_generated_file 'spec/spec_helper.rb' do |helper_contents|
66
+ assert_match(/spec/, helper_contents)
67
67
  end
68
- assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
68
+ assert_generated_file "spec/#{app_name}_spec.rb" do |test_contents|
69
69
  assert_match(/describe/, test_contents)
70
70
  end
71
71
  end
72
72
 
73
73
  def test_generate_app_with_spec_test_option
74
74
  run_generator('sinatra_app', [APP_ROOT, '--test=spec'], sources)
75
- assert_basic_paths_and_files
76
- assert_generated_file 'test/test_helper.rb' do |helper_contents|
77
- assert_match(/sinatra\/test\/spec/, helper_contents)
75
+ assert_basic_paths_and_files('spec')
76
+ assert_generated_file 'spec/spec_helper.rb' do |helper_contents|
77
+ assert_match(/spec/, helper_contents)
78
78
  end
79
- assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
79
+ assert_generated_file "spec/#{app_name}_spec.rb" do |test_contents|
80
80
  assert_match(/describe/, test_contents)
81
81
  end
82
82
  end
83
83
 
84
84
  def test_generate_app_with_shoulda_test_option
85
85
  run_generator('sinatra_app', [APP_ROOT, '--test=shoulda'], sources)
86
- assert_basic_paths_and_files
86
+ assert_basic_paths_and_files('test')
87
87
  assert_generated_file 'test/test_helper.rb' do |helper_contents|
88
- assert_match(/sinatra\/test\/unit/, helper_contents)
88
+ assert_match(/test\/unit/, helper_contents)
89
89
  assert_match(/shoulda/, helper_contents)
90
90
  end
91
91
  assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
@@ -95,9 +95,9 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
95
95
 
96
96
  def test_generate_app_with_test_unit_option
97
97
  run_generator('sinatra_app', [APP_ROOT, '--test=unit'], sources)
98
- assert_basic_paths_and_files
98
+ assert_basic_paths_and_files('test')
99
99
  assert_generated_file 'test/test_helper.rb' do |helper_contents|
100
- assert_match(/sinatra\/test\/unit/, helper_contents)
100
+ assert_match(/test\/unit/, helper_contents)
101
101
  end
102
102
  assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
103
103
  assert_match(/def test/, test_contents)
@@ -106,18 +106,18 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
106
106
 
107
107
  def test_generate_app_with_test_bacon_option
108
108
  run_generator('sinatra_app', [APP_ROOT, '--test=bacon'], sources)
109
- assert_basic_paths_and_files
110
- assert_generated_file 'test/test_helper.rb' do |helper_contents|
111
- assert_match(/sinatra\/test\/bacon/, helper_contents)
109
+ assert_basic_paths_and_files('spec')
110
+ assert_generated_file 'spec/spec_helper.rb' do |helper_contents|
111
+ assert_match(/bacon/, helper_contents)
112
112
  end
113
- assert_generated_file "test/test_#{app_name}.rb" do |test_contents|
113
+ assert_generated_file "spec/#{app_name}_spec.rb" do |test_contents|
114
114
  assert_match(/describe/, test_contents)
115
115
  end
116
116
  end
117
117
 
118
118
  def test_generate_app_with_views_haml_option
119
119
  run_generator('sinatra_app', [APP_ROOT, '--views=erb'], sources)
120
- assert_basic_paths_and_files
120
+ assert_basic_paths_and_files('spec')
121
121
  assert_generated_file "#{app_name}.rb" do |app_contents|
122
122
  assert_match(/erb \:index/, app_contents)
123
123
  end
@@ -127,7 +127,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
127
127
 
128
128
  def test_generate_app_with_views_haml_option
129
129
  run_generator('sinatra_app', [APP_ROOT, '--views=haml'], sources)
130
- assert_basic_paths_and_files
130
+ assert_basic_paths_and_files('spec')
131
131
  assert_generated_file "#{app_name}.rb" do |app_contents|
132
132
  assert_match(/haml \:index/, app_contents)
133
133
  end
@@ -137,7 +137,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
137
137
 
138
138
  def test_generate_app_with_views_builder_option
139
139
  run_generator('sinatra_app', [APP_ROOT, '--views=builder'], sources)
140
- assert_basic_paths_and_files
140
+ assert_basic_paths_and_files('spec')
141
141
  assert_generated_file "#{app_name}.rb" do |app_contents|
142
142
  assert_match(/builder \:index/, app_contents)
143
143
  end
@@ -146,7 +146,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
146
146
 
147
147
  def test_generate_app_with_scripts_option
148
148
  run_generator('sinatra_app', [APP_ROOT, '--scripts'], sources)
149
- assert_basic_paths_and_files
149
+ assert_basic_paths_and_files('spec')
150
150
  assert_directory_exists 'script'
151
151
  assert_generated_file 'script/destroy'
152
152
  assert_generated_file 'script/generate'
@@ -154,7 +154,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
154
154
 
155
155
  def test_generate_app_with_actions_and_no_options
156
156
  run_generator('sinatra_app', [APP_ROOT, 'get:/', 'post:/users/:id', 'put:/users/*'], sources)
157
- assert_basic_paths_and_files
157
+ assert_basic_paths_and_files('spec')
158
158
  assert_generated_file "#{app_name}.rb" do |app_contents|
159
159
  assert_match(/get '\/' do/, app_contents)
160
160
  assert_match(/post '\/users\/\:id' do/, app_contents)
@@ -175,9 +175,9 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
175
175
  end
176
176
 
177
177
  private
178
- def assert_basic_paths_and_files
178
+ def assert_basic_paths_and_files(spec_or_test = 'spec')
179
179
  assert_directory_exists 'lib'
180
- assert_directory_exists 'test'
180
+ assert_directory_exists spec_or_test
181
181
  assert_directory_exists 'public'
182
182
  assert_directory_exists 'views'
183
183
  assert_generated_file 'config.ru'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-27 00:00:00 +00:00
12
+ date: 2009-04-29 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,16 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.0
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rack-test
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.1.0
44
+ version:
35
45
  - !ruby/object:Gem::Dependency
36
46
  name: newgem
37
47
  type: :development
@@ -95,7 +105,7 @@ files:
95
105
  - sinatra-gen.gemspec
96
106
  has_rdoc: true
97
107
  homepage: http://github.com/quirkey/sinatra-gen
98
- post_install_message: PostInstall.txt
108
+ post_install_message:
99
109
  rdoc_options:
100
110
  - --main
101
111
  - README.rdoc