this_town 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,13 @@ module ThisTown
57
57
  template "lib/newgem.rb", "lib/#{@gem_name}.rb"
58
58
  template "lib/newgem/version.rb", "lib/#{@gem_name}/version.rb"
59
59
  template "lib/newgem/application.rb", "lib/#{@gem_name}/application.rb"
60
- directory "lib/#{@gem_name}/views"
60
+ template "lib/newgem/views.rb", "lib/#{@gem_name}/views.rb"
61
+ template "lib/newgem/views/layout.rb", "lib/#{@gem_name}/views/layout.rb"
62
+ template "lib/newgem/views/index.rb", "lib/#{@gem_name}/views/index.rb"
63
+
64
+ # templates
65
+ template "templates/layout.mustache"
66
+ file "templates/index.mustache"
61
67
 
62
68
  # config
63
69
  template "config/database.yml"
@@ -67,6 +73,8 @@ module ThisTown
67
73
  template "test/unit/test_application.rb"
68
74
 
69
75
  # public
76
+ file "public/reset.css"
77
+ file "public/style.css"
70
78
  fetch "http://code.jquery.com/jquery-latest.min.js", "public/jquery.min.js"
71
79
  file "public/jquery.mustache.min.js"
72
80
 
@@ -1,3 +1,3 @@
1
1
  module ThisTown
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/templates/gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ db/*.db
@@ -11,7 +11,7 @@
11
11
  enable :reload_templates if development?
12
12
 
13
13
  get "/" do
14
- "sup?"
14
+ mustache :index
15
15
  end
16
16
  end
17
17
  <%- end -%>
@@ -0,0 +1,6 @@
1
+ <%- code do -%>
2
+ module Views
3
+ class Index < Mustache
4
+ end
5
+ end
6
+ <%- end -%>
@@ -0,0 +1,6 @@
1
+ <%- code do -%>
2
+ module Views
3
+ class Layout < Mustache
4
+ end
5
+ end
6
+ <%- end -%>
@@ -0,0 +1,4 @@
1
+ <%- code do -%>
2
+ module Views
3
+ end
4
+ <%- end -%>
@@ -22,4 +22,5 @@ require 'logger'
22
22
  <%- end -%>
23
23
 
24
24
  require "<%= gem_name %>/version"
25
+ require "<%= gem_name %>/views"
25
26
  require "<%= gem_name %>/application"
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
File without changes
@@ -0,0 +1 @@
1
+ sup?
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title><%= constant_name %></title>
6
+ <link rel="stylesheet" type="text/css" href="/reset.css" />
7
+ <link rel="stylesheet" type="text/css" href="/style.css" />
8
+ <script type="text/javascript" src="/jquery.min.js"></script>
9
+ <script type="text/javascript" src="/jquery.mustache.min.js"></script>
10
+ </head>
11
+
12
+ <body>
13
+ {{{yield}}}
14
+ </body>
15
+
16
+ </html>
@@ -7,6 +7,7 @@ rescue Bundler::BundlerError => e
7
7
  $stderr.puts "Run `bundle install` to install missing gems"
8
8
  exit e.status_code
9
9
  end
10
+ ENV['RACK_ENV'] = 'test'
10
11
 
11
12
  require 'test/unit'
12
13
  require 'mocha/setup'
@@ -25,3 +26,22 @@ class SequenceHelper
25
26
  expectation.in_sequence(@seq)
26
27
  end
27
28
  end
29
+
30
+ module XhrHelper
31
+ def xhr(path, params={})
32
+ verb = params.delete(:as) || :get
33
+ send(verb, path, params, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest")
34
+ end
35
+ end
36
+
37
+ class Test::Unit::TestCase
38
+ alias_method :run_without_transactions, :run
39
+
40
+ def run(*args, &block)
41
+ result = nil
42
+ Sequel::Model.db.transaction(:rollback => :always) do
43
+ result = run_without_transactions(*args, &block)
44
+ end
45
+ result
46
+ end
47
+ end
@@ -2,6 +2,7 @@ require 'helper'
2
2
 
3
3
  class TestApplication < Test::Unit::TestCase
4
4
  include Rack::Test::Methods
5
+ include XhrHelper
5
6
 
6
7
  def app
7
8
  <%= constant_name %>::Application
@@ -10,6 +11,6 @@ class TestApplication < Test::Unit::TestCase
10
11
  test "index" do
11
12
  get '/'
12
13
  assert last_response.ok?
13
- assert_equal "sup?", last_response.body
14
+ assert_match "sup?", last_response.body
14
15
  end
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: this_town
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-02-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Gem generator for Sinatra applications that use the following libraries:
15
15
  sequel, mustache, test-unit, rack-test, mocha, guard'
@@ -41,8 +41,15 @@ files:
41
41
  - templates/lib/newgem.rb.erb
42
42
  - templates/lib/newgem/application.rb.erb
43
43
  - templates/lib/newgem/version.rb.erb
44
+ - templates/lib/newgem/views.rb.erb
45
+ - templates/lib/newgem/views/index.rb.erb
46
+ - templates/lib/newgem/views/layout.rb.erb
44
47
  - templates/newgem.gemspec.erb
45
48
  - templates/public/jquery.mustache.min.js
49
+ - templates/public/reset.css
50
+ - templates/public/style.css
51
+ - templates/templates/index.mustache
52
+ - templates/templates/layout.mustache.erb
46
53
  - templates/test/helper.rb.erb
47
54
  - templates/test/unit/test_application.rb.erb
48
55
  - this_town.gemspec
@@ -71,3 +78,4 @@ signing_key:
71
78
  specification_version: 3
72
79
  summary: Gem generator for Sinatra applications
73
80
  test_files: []
81
+ has_rdoc: