tempatra 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. data/CHANGELOG +11 -0
  2. data/README.md +2 -2
  3. data/Rakefile +14 -15
  4. data/VERSION +1 -1
  5. data/app_generators/tempatra/tempatra_generator.rb +16 -16
  6. data/app_generators/tempatra/templates/README.md.erb +2 -2
  7. data/app_generators/tempatra/templates/Rakefile.erb +1 -1
  8. data/app_generators/tempatra/templates/_gems +4 -3
  9. data/app_generators/tempatra/templates/_gitignore +3 -1
  10. data/app_generators/tempatra/templates/{config.rb.erb → compass.config.erb} +0 -0
  11. data/app_generators/tempatra/templates/config.ru.erb +4 -1
  12. data/app_generators/tempatra/templates/features/homepage.feature.erb +2 -0
  13. data/app_generators/tempatra/templates/features/step_definitions/web_steps.rb +267 -0
  14. data/app_generators/tempatra/templates/features/support/env.rb.erb +4 -11
  15. data/app_generators/tempatra/templates/features/support/paths.rb +2 -2
  16. data/app_generators/tempatra/templates/lib/tempatra.rb.erb +12 -3
  17. data/app_generators/tempatra/templates/public/javascripts/jquery-1.4.2.min.js +154 -0
  18. data/app_generators/tempatra/templates/views/index.haml.erb +7 -7
  19. data/app_generators/tempatra/templates/views/layout.haml.erb +70 -52
  20. data/app_generators/tempatra/templates/views/stylesheets/ie.sass +1 -1
  21. data/app_generators/tempatra/templates/views/stylesheets/main.sass.erb +63 -47
  22. data/app_generators/tempatra/templates/views/stylesheets/partials/_base.sass.erb +4 -4
  23. data/app_generators/tempatra/templates/views/stylesheets/print.sass +2 -2
  24. data/spec/tempatra_spec.rb +1 -9
  25. metadata +152 -85
  26. data/TODO +0 -0
  27. data/app_generators/tempatra/templates/features/step_definitions/webrat_steps.rb +0 -80
  28. data/app_generators/tempatra/templates/public/javascripts/jquery-1.3.2.min.js +0 -19
data/CHANGELOG CHANGED
@@ -0,0 +1,11 @@
1
+ 0.1.0
2
+
3
+ * Upgraded Compass to ~> 0.10.2
4
+ * Upgraded jQuery to 1.4.2
5
+ * Upgraded Haml to ~> 3.0.9
6
+ * Upgraded RDiscount to ~> 1.6.3.2
7
+ * Upgraded Cucumber to ~> 0.7.3
8
+ * Upgraded RubiGen to ~> 1.5.5
9
+ * Upgraded Sinatra to ~> 1.0
10
+ * Switched to Capybara ~> 0.3.8 from Webrat
11
+ * Restyled generated homepage (thanks to Stewart Laufer)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Tempatra
2
2
  ========
3
3
 
4
- A RubiGen Sinatra application generator providing Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.
4
+ A RubiGen Sinatra application generator providing Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Capybara.
5
5
 
6
6
  Installation
7
7
  ------------
@@ -64,7 +64,7 @@ Aaron Quint's [sinatra-gen](http://github.com/quirkey/sinatra-gen) is a Sinatra
64
64
  Authors
65
65
  -------
66
66
 
67
- Stewart Laufer (theIV)
67
+ Stewart Laufer (theIV)
68
68
  Olivier Lauzon (olauzon)
69
69
 
70
70
 
data/Rakefile CHANGED
@@ -5,24 +5,23 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "tempatra"
8
- gem.summary = %Q{A RubiGen based Sinatra application generator.}
9
- gem.description = %Q{A Sinatra application generator using Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.}
8
+ gem.summary = %Q{A basic Sinatra application generator.}
9
+ gem.description = %Q{A basic Sinatra application generator providing Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Capybara.}
10
10
  gem.email = "olauzon@gmail.com"
11
11
  gem.homepage = "http://github.com/olauzon/tempatra"
12
- gem.authors = ["Olivier Lauzon"]
12
+ gem.authors = ["Olivier Lauzon", "Stewart Laufer"]
13
13
 
14
- gem.add_dependency('compass', '>= 0.8.17')
15
- gem.add_dependency('cucumber', '>= 0.4.4')
16
- gem.add_dependency('haml', '>= 2.2.13')
17
- gem.add_dependency('rack-test', '>= 0.5.2')
18
- gem.add_dependency('rake', '>= 0.8.7')
19
- gem.add_dependency('rdiscount', '>= 1.5.5')
20
- gem.add_dependency('rspec')
21
- gem.add_dependency('rubigen', '>= 1.5.2')
22
- gem.add_dependency('sinatra', '>= 0.9.4')
23
- gem.add_dependency('thin', '>= 1.2.3')
24
- gem.add_dependency('webrat', '>= 0.5.3')
25
- gem.add_dependency('shotgun', '>= 0.4')
14
+ gem.add_dependency('compass', '~> 0.10.2')
15
+ gem.add_dependency('cucumber', '~> 0.7.3')
16
+ gem.add_dependency('haml', '~> 3.0.9')
17
+ gem.add_dependency('rack-test', '~> 0.5.3')
18
+ gem.add_dependency('rdiscount', '~> 1.6.3.2')
19
+ gem.add_dependency('rspec', '>= 1.2.6')
20
+ gem.add_dependency('rubigen', '~> 1.5.5')
21
+ gem.add_dependency('sinatra', '~> 1.0')
22
+ gem.add_dependency('shotgun', '>= 0.6')
23
+ gem.add_dependency('thin', '>= 1.2.3')
24
+ gem.add_dependency('capybara', '~> 0.3.8')
26
25
 
27
26
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
28
27
  gem.files = FileList[ 'app_generators/**/*',
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.1.0
@@ -37,13 +37,13 @@ class TempatraGenerator < RubiGen::Base
37
37
  BASEDIRS.each { |path| m.directory path }
38
38
 
39
39
  # Root
40
- m.template "_gems" , ".gems"
41
- m.template "_gitignore" , ".gitignore"
42
- m.template "config.rb.erb" , "config.rb"
43
- m.template "config.ru.erb" , "config.ru"
44
- m.template "config.yml.erb", "config.yml"
45
- m.template "Rakefile.erb" , "Rakefile"
46
- m.template "README.md.erb" , "README.md"
40
+ m.template "_gems" , ".gems"
41
+ m.template "_gitignore" , ".gitignore"
42
+ m.template "compass.config.erb" , "compass.config"
43
+ m.template "config.ru.erb" , "config.ru"
44
+ m.template "config.yml.erb" , "config.yml"
45
+ m.template "Rakefile.erb" , "Rakefile"
46
+ m.template "README.md.erb" , "README.md"
47
47
 
48
48
  # Sinatra
49
49
  m.template "lib/tempatra.rb.erb" , "lib/#{app_file_name}.rb"
@@ -53,8 +53,8 @@ class TempatraGenerator < RubiGen::Base
53
53
  m.template "views/index.haml.erb" , "views/index.haml"
54
54
 
55
55
  # jQuery
56
- m.template "public/javascripts/jquery-1.3.2.min.js",
57
- "public/javascripts/jquery-1.3.2.min.js"
56
+ m.template "public/javascripts/jquery-1.4.2.min.js",
57
+ "public/javascripts/jquery-1.4.2.min.js"
58
58
 
59
59
  m.template "public/javascripts/application.js.erb",
60
60
  "public/javascripts/application.js"
@@ -63,8 +63,8 @@ class TempatraGenerator < RubiGen::Base
63
63
  m.template "features/homepage.feature.erb",
64
64
  "features/homepage.feature"
65
65
 
66
- m.template "features/step_definitions/webrat_steps.rb",
67
- "features/step_definitions/webrat_steps.rb"
66
+ m.template "features/step_definitions/web_steps.rb",
67
+ "features/step_definitions/web_steps.rb"
68
68
 
69
69
  m.template "features/support/env.rb.erb",
70
70
  "features/support/env.rb"
@@ -101,9 +101,9 @@ class TempatraGenerator < RubiGen::Base
101
101
  # Compass
102
102
  compass = which "compass"
103
103
  unless File.exist?(File.expand_path(@destination_root) + '/public/images/grid.png')
104
- m.run("#{compass} --force --grid-img --images-dir public/images")
104
+ m.run("#{compass} grid-img 30+10x22 public/images/grid.png --force")
105
105
  end
106
- m.run("#{compass}") if compile
106
+ m.run("#{compass} --trace compile") if compile
107
107
 
108
108
  # Git
109
109
  if heroku || git_init
@@ -132,13 +132,13 @@ class TempatraGenerator < RubiGen::Base
132
132
  $ cd #{app_name}
133
133
 
134
134
  To run your application
135
- $ thin start -p 4567 -R config.ru
135
+ $ shotgun --server=thin -p 4567 config.ru
136
136
  (Then go to http://localhost:4567/ with your browser)
137
137
 
138
138
  You can continuously compile your Sass stylesheets with Compass
139
139
  $ compass --watch
140
140
 
141
- And of course, use autospec
141
+ Use autospec
142
142
  $ autospec
143
143
 
144
144
 
@@ -154,7 +154,7 @@ protected
154
154
  ----------------------
155
155
  Tempatra
156
156
 
157
- A Sinatra application generator using Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.
157
+ A basic Sinatra application generator providing Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Capybara.
158
158
 
159
159
  Usage: tempatra your-app-name [options]
160
160
  EOS
@@ -8,10 +8,10 @@ Run your application:
8
8
 
9
9
  Then go to [http://localhost:4567/](http://localhost:4567/) with your browser.
10
10
 
11
- You can continuously compile your Sass stylesheets with Compass (in another terminal):
11
+ You can continuously compile your Sass stylesheets with Compass (in another terminal or screen):
12
12
 
13
13
  $ compass --watch
14
14
 
15
- And of course, use autospec (in yet another terminal):
15
+ And of course, use autospec (in yet another terminal or screen):
16
16
 
17
17
  $ autospec
@@ -35,5 +35,5 @@ end
35
35
  require 'cucumber/rake/task'
36
36
  Cucumber::Rake::Task.new(:cucumber, 'Run all Cucumber features') do |t|
37
37
  t.fork = true # You may get faster startup if you set this to false
38
- t.cucumber_opts = "--tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
38
+ t.cucumber_opts = "--guess --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
39
39
  end
@@ -1,3 +1,4 @@
1
- rdiscount
2
- haml --version '>= 2.2.3'
3
- compass --version '>= 0.8.17'
1
+ rdiscount --version '~> 1.6.3.2'
2
+ sinatra --version '~> 1.0'
3
+ haml --version '~> 3.0.9'
4
+ compass --version '~> 0.10.2'
@@ -1,4 +1,6 @@
1
- *.sw?
1
+ *.swo
2
+ *.swp
3
+ .sass-cache
2
4
  coverage/*
3
5
  views/stylesheets/.sass-cache
4
6
  webrat.*
@@ -4,5 +4,8 @@
4
4
  require File.join(File.dirname(__FILE__), 'lib', '<%= app_file_name %>.rb')
5
5
 
6
6
  disable :run
7
- set :environment, :development
7
+
8
+ # Uncomment to run in development mode on Heroku
9
+ #set :environment, :development
10
+
8
11
  run <%= module_name %>
@@ -1,3 +1,5 @@
1
+ Feature: Viewing the homepage
2
+
1
3
  Scenario: Viewing the homepage
2
4
  Given I am on "the homepage"
3
5
  Then I should see "<%= app_full_name %>"
@@ -0,0 +1,267 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ require 'uri'
9
+ require 'cgi'
10
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
11
+
12
+ module WithinHelpers
13
+ def with_scope(locator)
14
+ locator ? within(locator) { yield } : yield
15
+ end
16
+ end
17
+ World(WithinHelpers)
18
+
19
+ Given /^(?:|I )am on (.+)$/ do |page_name|
20
+ visit path_to(page_name)
21
+ end
22
+
23
+ When /^(?:|I )go to (.+)$/ do |page_name|
24
+ visit path_to(page_name)
25
+ end
26
+
27
+ When /^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/ do |button, selector|
28
+ with_scope(selector) do
29
+ click_button(button)
30
+ end
31
+ end
32
+
33
+ When /^(?:|I )follow "([^\"]*)"(?: within "([^\"]*)")?$/ do |link, selector|
34
+ with_scope(selector) do
35
+ click_link(link)
36
+ end
37
+ end
38
+
39
+ When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, value, selector|
40
+ with_scope(selector) do
41
+ fill_in(field, :with => value)
42
+ end
43
+ end
44
+
45
+ When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
46
+ with_scope(selector) do
47
+ fill_in(field, :with => value)
48
+ end
49
+ end
50
+
51
+ # Use this to fill in an entire form with data from a table. Example:
52
+ #
53
+ # When I fill in the following:
54
+ # | Account Number | 5002 |
55
+ # | Expiry date | 2009-11-01 |
56
+ # | Note | Nice guy |
57
+ # | Wants Email? | |
58
+ #
59
+ # TODO: Add support for checkbox, select og option
60
+ # based on naming conventions.
61
+ #
62
+ When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields|
63
+ with_scope(selector) do
64
+ fields.rows_hash.each do |name, value|
65
+ When %{I fill in "#{name}" with "#{value}"}
66
+ end
67
+ end
68
+ end
69
+
70
+ When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
71
+ with_scope(selector) do
72
+ select(value, :from => field)
73
+ end
74
+ end
75
+
76
+ When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
77
+ with_scope(selector) do
78
+ check(field)
79
+ end
80
+ end
81
+
82
+ When /^(?:|I )uncheck "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
83
+ with_scope(selector) do
84
+ uncheck(field)
85
+ end
86
+ end
87
+
88
+ When /^(?:|I )choose "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
89
+ with_scope(selector) do
90
+ choose(field)
91
+ end
92
+ end
93
+
94
+ When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector|
95
+ with_scope(selector) do
96
+ attach_file(field, path)
97
+ end
98
+ end
99
+
100
+ Then /^(?:|I )should see JSON:$/ do |expected_json|
101
+ require 'json'
102
+ expected = JSON.pretty_generate(JSON.parse(expected_json))
103
+ actual = JSON.pretty_generate(JSON.parse(response.body))
104
+ expected.should == actual
105
+ end
106
+
107
+ Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
108
+ with_scope(selector) do
109
+ if page.respond_to? :should
110
+ page.should have_content(text)
111
+ else
112
+ assert page.has_content?(text)
113
+ end
114
+ end
115
+ end
116
+
117
+ Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
118
+ regexp = Regexp.new(regexp)
119
+ with_scope(selector) do
120
+ if page.respond_to? :should
121
+ page.should have_xpath('//*', :text => regexp)
122
+ else
123
+ assert page.has_xpath?('//*', :text => regexp)
124
+ end
125
+ end
126
+ end
127
+
128
+ Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
129
+ with_scope(selector) do
130
+ if page.respond_to? :should
131
+ page.should have_no_content(text)
132
+ else
133
+ assert page.has_no_content?(text)
134
+ end
135
+ end
136
+ end
137
+
138
+ Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
139
+ regexp = Regexp.new(regexp)
140
+ with_scope(selector) do
141
+ if page.respond_to? :should
142
+ page.should have_no_xpath('//*', :text => regexp)
143
+ else
144
+ assert page.has_no_xpath?('//*', :text => regexp)
145
+ end
146
+ end
147
+ end
148
+
149
+ Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
150
+ with_scope(selector) do
151
+ field = find_field(field)
152
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
153
+ if field_value.respond_to? :should
154
+ field_value.should =~ /#{value}/
155
+ else
156
+ assert_match(/#{value}/, field_value)
157
+ end
158
+ end
159
+ end
160
+
161
+ Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value|
162
+ with_scope(selector) do
163
+ field = find_field(field)
164
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
165
+ if field_value.respond_to? :should_not
166
+ field_value.should_not =~ /#{value}/
167
+ else
168
+ assert_no_match(/#{value}/, field_value)
169
+ end
170
+ end
171
+ end
172
+
173
+ Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector|
174
+ with_scope(selector) do
175
+ field_checked = find_field(label)['checked']
176
+ if field_checked.respond_to? :should
177
+ field_checked.should == 'checked'
178
+ else
179
+ assert_equal 'checked', field_checked
180
+ end
181
+ end
182
+ end
183
+
184
+ Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector|
185
+ with_scope(selector) do
186
+ field_checked = find_field(label)['checked']
187
+ if field_checked.respond_to? :should_not
188
+ field_checked.should_not == 'checked'
189
+ else
190
+ assert_not_equal 'checked', field_checked
191
+ end
192
+ end
193
+ end
194
+
195
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
196
+ current_path = URI.parse(current_url).path
197
+ if current_path.respond_to? :should
198
+ current_path.should == path_to(page_name)
199
+ else
200
+ assert_equal path_to(page_name), current_path
201
+ end
202
+ end
203
+
204
+ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
205
+ query = URI.parse(current_url).query
206
+ actual_params = query ? CGI.parse(query) : {}
207
+ expected_params = {}
208
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
209
+
210
+ if actual_params.respond_to? :should
211
+ actual_params.should == expected_params
212
+ else
213
+ assert_equal expected_params, actual_params
214
+ end
215
+ end
216
+
217
+ Then /^show me the page$/ do
218
+ save_and_open_page
219
+ end
220
+
221
+ When /^I uncheck "([^\"]*)"$/ do |field|
222
+ uncheck(field)
223
+ end
224
+
225
+ When /^I choose "([^\"]*)"$/ do |field|
226
+ choose(field)
227
+ end
228
+
229
+ When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
230
+ attach_file(field, path)
231
+ end
232
+
233
+ Then /^I should see "([^\"]*)"$/ do |text|
234
+ body.should contain(text)
235
+ end
236
+
237
+ Then /^I should not see "([^\"]*)"$/ do |text|
238
+ body.should_not contain(text)
239
+ end
240
+
241
+ Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
242
+ field_labeled(field).value.should =~ /#{value}/
243
+ end
244
+
245
+ Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
246
+ field_labeled(field).value.should_not =~ /#{value}/
247
+ end
248
+
249
+ Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
250
+ field_labeled(label).should be_checked
251
+ end
252
+
253
+ Then /^I should be on (.+)$/ do |page_name|
254
+ URI.parse(current_url).path.should == path_to(page_name)
255
+ end
256
+
257
+ When /^I view the page$/ do
258
+ save_and_open_page
259
+ end
260
+
261
+ def response
262
+ last_response
263
+ end
264
+
265
+ def body
266
+ response.body
267
+ end