bootstrap-generators 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Generators
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -5,15 +5,18 @@ module Bootstrap
5
5
  class InstallGenerator < ::Rails::Generators::Base
6
6
  desc "Copy BootstrapGenerators default files"
7
7
  source_root File.expand_path('../templates', __FILE__)
8
+ class_option :layout, :desc => "Bootstrap layout templates (hero, fluid or container-app)", :default => "hero", :type => :string
9
+
10
+ class_option :template_engine
8
11
 
9
12
  def copy_lib
10
- directory 'lib'
13
+ directory "lib/templates/#{options[:template_engine]}"
11
14
  end
12
15
 
13
16
  def create_layout
14
- template 'application.html.erb', 'app/views/layouts/application.html.erb'
15
- copy_file 'bootstrap-generators.css.scss', 'app/assets/stylesheets/bootstrap-generators.css.scss'
16
- copy_file 'bootstrap-generators.js', 'app/assets/javascripts/bootstrap-generators.js'
17
+ template "layouts/#{options[:layout]}.html.#{options[:template_engine]}", "app/views/layouts/application.html.#{options[:template_engine]}"
18
+ copy_file "layouts/#{options[:layout]}.css.scss", "app/assets/stylesheets/bootstrap-generators.css.scss"
19
+ copy_file "bootstrap-generators.js", "app/assets/javascripts/bootstrap-generators.js"
17
20
  end
18
21
  end
19
22
  end
@@ -0,0 +1,56 @@
1
+ /*
2
+ *= require bootstrap
3
+ */
4
+
5
+ .page-header {
6
+ a.btn {
7
+ float: right;
8
+ }
9
+
10
+ a.btn + a.btn {
11
+ margin-right: 8px;
12
+ }
13
+ }
14
+
15
+ .form-stacked div.alert-message {
16
+ margin-left: -10px;
17
+ }
18
+
19
+ /* Override some defaults */
20
+ html, body {
21
+ background-color: #eee;
22
+ }
23
+ body {
24
+ padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
25
+ }
26
+ .container > footer p {
27
+ text-align: center; /* center align it with the container */
28
+ }
29
+ .container {
30
+ width: 820px; /* downsize our container to make the content feel a bit tighter and more cohesive. NOTE: this removes two full columns from the grid, meaning you only go to 14 columns and not 16. */
31
+ }
32
+
33
+ /* The white background content wrapper */
34
+ .content {
35
+ background-color: #fff;
36
+ padding: 20px;
37
+ margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
38
+ -webkit-border-radius: 0 0 6px 6px;
39
+ -moz-border-radius: 0 0 6px 6px;
40
+ border-radius: 0 0 6px 6px;
41
+ -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
42
+ -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
43
+ box-shadow: 0 1px 2px rgba(0,0,0,.15);
44
+ }
45
+
46
+ /* Page header tweaks */
47
+ .content > .page-header {
48
+ background-color: #f5f5f5;
49
+ padding: 20px 20px 10px;
50
+ margin: -20px -20px 20px;
51
+ }
52
+
53
+ .topbar .btn {
54
+ border: 0;
55
+ }
56
+
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Bootstrap, from Twitter</title>
6
+ <meta name="description" content="">
7
+ <meta name="author" content="">
8
+
9
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
+ <![endif]-->
13
+
14
+ <%%= stylesheet_link_tag "application" %>
15
+ <%%= javascript_include_tag "application" %>
16
+ <%%= csrf_meta_tags %>
17
+ </head>
18
+ <body>
19
+ <div class="topbar">
20
+ <div class="fill">
21
+ <div class="container">
22
+ <%%= link_to "Project name", "#", :class => "brand" %>
23
+ <ul class="nav">
24
+ <li class="active"><a href="#">Home</a></li>
25
+ <li><a href="#about">About</a></li>
26
+ <li><a href="#contact">Contact</a></li>
27
+ </ul>
28
+ <form action="" class="pull-right">
29
+ <input class="input-small" type="text" placeholder="Username">
30
+ <input class="input-small" type="password" placeholder="Password">
31
+ <button class="btn" type="submit">Sign in</button>
32
+ </form>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <div class="container">
37
+ <div class="content">
38
+ <div class="page-header">
39
+ <h1>Page name <small>Supporting text or tagline</small></h1>
40
+ </div>
41
+ <div class="row">
42
+ <div class="span14">
43
+ <%% flash.each do |name, msg| %>
44
+ <%%= content_tag :div, :class => "alert-message #{name == :error ? "error" : "success" }", :"data-alert" => "alert" do %>
45
+ <a class="close" href="#">×</a>
46
+ <p><%%= msg %></p>
47
+ <%% end %>
48
+ <%% end %>
49
+ <%%= yield %>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <footer>
54
+ <p>&copy; Company 2011</p>
55
+ </footer>
56
+ </div>
57
+ </body>
58
+ </html>
@@ -0,0 +1,46 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:charset => "utf-8"}
5
+ %title Bootstrap, from Twitter
6
+ %meta{:content => "", :name => "description"}
7
+ %meta{:content => "", :name => "author"}
8
+
9
+ / Le HTML5 shim, for IE6-8 support of HTML elements
10
+ /[if lt IE 9]
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
+ = stylesheet_link_tag "application"
13
+ = javascript_include_tag "application"
14
+ = csrf_meta_tags
15
+ %body
16
+ .topbar
17
+ .fill
18
+ .container
19
+ = link_to "Project name", "#", :class => "brand"
20
+ %ul.nav
21
+ %li.active
22
+ %a{:href => "#"} Home
23
+ %li
24
+ %a{:href => "#about"} About
25
+ %li
26
+ %a{:href => "#contact"} Contact
27
+ %form.pull-right{:action => ""}
28
+ %input.input-small{:placeholder => "Username", :type => "text"}
29
+ %input.input-small{:placeholder => "Password", :type => "password"}
30
+ %button.btn{:type => "submit"} Sign in
31
+ .container
32
+ .content
33
+ .page-header
34
+ %h1
35
+ Page name
36
+ %small Supporting text or tagline
37
+ .row
38
+ .span14
39
+ - flash.each do |name, msg|
40
+ = content_tag :div, :class => "alert-message #{name == :error ? "error" : "success" }", :"data-alert" => "alert" do
41
+ %a.close{:href => "#"} ×
42
+ %p= msg
43
+ = yield
44
+ %footer
45
+ %p © Company 2011 (haml)
46
+
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Bootstrap, from Twitter</title>
6
+ <meta name="description" content="">
7
+ <meta name="author" content="">
8
+
9
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
+ <![endif]-->
13
+
14
+ <%%= stylesheet_link_tag "application" %>
15
+ <%%= javascript_include_tag "application" %>
16
+ <%%= csrf_meta_tags %>
17
+ </head>
18
+ <body>
19
+ <div class="topbar">
20
+ <div class="topbar-inner">
21
+ <div class="container-fluid">
22
+ <a class="brand" href="#">Project name</a>
23
+ <ul class="nav">
24
+ <li class="active"><a href="#">Home</a></li>
25
+ <li><a href="#about">About</a></li>
26
+ <li><a href="#contact">Contact</a></li>
27
+ </ul>
28
+ <p class="pull-right">Logged in as <a href="#">username</a></p>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <div class="container-fluid">
33
+ <div class="sidebar">
34
+ <div class="well">
35
+ <h5>Sidebar</h5>
36
+ <ul>
37
+ <li><a href="#">Link</a></li>
38
+ <li><a href="#">Link</a></li>
39
+ <li><a href="#">Link</a></li>
40
+ <li><a href="#">Link</a></li>
41
+ </ul>
42
+ <h5>Sidebar</h5>
43
+ <ul>
44
+ <li><a href="#">Link</a></li>
45
+ <li><a href="#">Link</a></li>
46
+ <li><a href="#">Link</a></li>
47
+ <li><a href="#">Link</a></li>
48
+ <li><a href="#">Link</a></li>
49
+ <li><a href="#">Link</a></li>
50
+ </ul>
51
+ <h5>Sidebar</h5>
52
+ <ul>
53
+ <li><a href="#">Link</a></li>
54
+ <li><a href="#">Link</a></li>
55
+ </ul>
56
+ </div>
57
+ </div>
58
+ <%% flash.each do |name, msg| %>
59
+ <%%= content_tag :div, :class => "container alert-message #{name == :error ? "error" : "success" }", :"data-alert" => "alert" do %>
60
+ <a class="close" href="#">×</a>
61
+ <p><%%= msg %></p>
62
+ <%% end %>
63
+ <%% end %>
64
+ <div class="content">
65
+ <div class="row">
66
+ <div class="span16">
67
+ <%%= yield %>
68
+ </div>
69
+ </div>
70
+ <footer>
71
+ <p>&copy; Company 2011</p>
72
+ </footer>
73
+ </div>
74
+ </div>
75
+ </body>
76
+ </html>
@@ -0,0 +1,73 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:charset => "utf-8"}
5
+ %title Bootstrap, from Twitter
6
+ %meta{:content => "", :name => "description"}
7
+ %meta{:content => "", :name => "author"}
8
+
9
+ / Le HTML5 shim, for IE6-8 support of HTML elements
10
+ /[if lt IE 9]
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
+ = stylesheet_link_tag "application"
13
+ = javascript_include_tag "application"
14
+ = csrf_meta_tags
15
+ %body
16
+ .topbar
17
+ .topbar-inner
18
+ .container-fluid
19
+ %a.brand{:href => "#"} Project name
20
+ %ul.nav
21
+ %li.active
22
+ %a{:href => "#"} Home
23
+ %li
24
+ %a{:href => "#about"} About
25
+ %li
26
+ %a{:href => "#contact"} Contact
27
+ %p.pull-right
28
+ Logged in as
29
+ %a{:href => "#"} username
30
+ .container-fluid
31
+ .sidebar
32
+ .well
33
+ %h5 Sidebar
34
+ %ul
35
+ %li
36
+ %a{:href => "#"} Link
37
+ %li
38
+ %a{:href => "#"} Link
39
+ %li
40
+ %a{:href => "#"} Link
41
+ %li
42
+ %a{:href => "#"} Link
43
+ %h5 Sidebar
44
+ %ul
45
+ %li
46
+ %a{:href => "#"} Link
47
+ %li
48
+ %a{:href => "#"} Link
49
+ %li
50
+ %a{:href => "#"} Link
51
+ %li
52
+ %a{:href => "#"} Link
53
+ %li
54
+ %a{:href => "#"} Link
55
+ %li
56
+ %a{:href => "#"} Link
57
+ %h5 Sidebar
58
+ %ul
59
+ %li
60
+ %a{:href => "#"} Link
61
+ %li
62
+ %a{:href => "#"} Link
63
+ - flash.each do |name, msg|
64
+ = content_tag :div, :class => "container alert-message #{name == :error ? "error" : "success" }", :"data-alert" => "alert" do
65
+ %a.close{:href => "#"} ×
66
+ %p= msg
67
+ .content
68
+ .row
69
+ .span16
70
+ = yield
71
+ %footer
72
+ %p © Company 2011 (haml)
73
+
@@ -0,0 +1,21 @@
1
+ /*
2
+ *= require bootstrap
3
+ */
4
+
5
+ body {
6
+ padding-top: 60px;
7
+ }
8
+
9
+ .page-header {
10
+ a.btn {
11
+ float: right;
12
+ }
13
+
14
+ a.btn + a.btn {
15
+ margin-right: 8px;
16
+ }
17
+ }
18
+
19
+ .form-stacked div.alert-message {
20
+ margin-left: -10px;
21
+ }
@@ -0,0 +1,37 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:charset => "utf-8"}
5
+ %title Bootstrap, from Twitter
6
+ %meta{:content => "", :name => "description"}
7
+ %meta{:content => "", :name => "author"}
8
+
9
+ / Le HTML5 shim, for IE6-8 support of HTML elements
10
+ /[if lt IE 9]
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
+ = stylesheet_link_tag "application"
13
+ = javascript_include_tag "application"
14
+ = csrf_meta_tags
15
+ %body
16
+ .topbar
17
+ .fill
18
+ .container
19
+ = link_to "Project name", "#", :class => "brand"
20
+ %ul.nav
21
+ %li.active
22
+ %a{:href => "#"} Home
23
+ %li
24
+ %a{:href => "#about"} About
25
+ %li
26
+ %a{:href => "#contact"} Contact
27
+ - flash.each do |name, msg|
28
+ = content_tag :div, :class => "container alert-message #{name == :error ? "error" : "success" }", :"data-alert" => "alert" do
29
+ %a.close{:href => "#"} ×
30
+ %p= msg
31
+ .container
32
+ .row
33
+ .span16
34
+ = yield
35
+ %footer
36
+ %p © Company 2011 (haml)
37
+
@@ -1,6 +1,6 @@
1
1
  .page-header
2
- = link_to 'Back', <%= index_helper %>_path, :class => 'btn', :class => 'btn primary'
3
- = link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
2
+ = link_to 'Back', <%= index_helper %>_path, :class => 'btn'
3
+ = link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), :class => 'btn primary'
4
4
  %h1 Listing <%= plural_table_name %>
5
5
 
6
6
  %dl
@@ -3,6 +3,7 @@ require 'test_helper'
3
3
  class Bootstrap::Generators::InstallGeneratorTest < ::Rails::Generators::TestCase
4
4
  destination File.join(Rails.root)
5
5
  tests Bootstrap::Generators::InstallGenerator
6
+ arguments %w(--template-engine erb)
6
7
 
7
8
  setup :prepare_destination
8
9
  setup :copy_routes
@@ -11,23 +12,74 @@ class Bootstrap::Generators::InstallGeneratorTest < ::Rails::Generators::TestCas
11
12
  run_generator
12
13
 
13
14
  assert_file "lib/templates/erb/controller/view.html.erb"
15
+ assert_no_file "lib/templates/haml/controller/view.html.haml"
14
16
  end
15
17
 
16
18
  test "should copy controller haml templates" do
17
- run_generator
19
+ run_generator %w(--template-engine haml)
18
20
 
19
21
  assert_file "lib/templates/haml/controller/view.html.haml"
22
+ assert_no_file "lib/templates/erb/controller/view.html.erb"
20
23
  end
21
24
 
22
25
  test "should copy scaffold erb templates" do
23
26
  run_generator
24
27
 
25
- %w(index edit new show _form).each { |view| assert_file "lib/templates/erb/scaffold/#{view}.html.erb" }
28
+ %w(index edit new show _form).each { |view|
29
+ assert_file "lib/templates/erb/scaffold/#{view}.html.erb"
30
+ assert_no_file "lib/templates/haml/scaffold/#{view}.html.haml"
31
+ }
26
32
  end
27
33
 
28
34
  test "should copy scaffold haml templates" do
35
+ run_generator %w(--template-engine haml)
36
+
37
+ %w(index edit new show _form).each { |view|
38
+ assert_file "lib/templates/haml/scaffold/#{view}.html.haml"
39
+ assert_no_file "lib/templates/erb/scaffold/#{view}.html.erb"
40
+ }
41
+ end
42
+
43
+ test "should copy css and javascript files" do
44
+ run_generator
45
+
46
+ assert_file "app/assets/stylesheets/bootstrap-generators.css.scss"
47
+ assert_file "app/assets/javascripts/bootstrap-generators.js"
48
+ end
49
+
50
+ test "should create erb layout" do
29
51
  run_generator
30
52
 
31
- %w(index edit new show _form).each { |view| assert_file "lib/templates/haml/scaffold/#{view}.html.haml" }
53
+ assert_file "app/views/layouts/application.html.erb"
54
+ end
55
+
56
+ test "should create haml layout" do
57
+ run_generator %w(--template-engine haml)
58
+
59
+ assert_file "app/views/layouts/application.html.haml"
60
+ end
61
+
62
+ test "should create fluid erb layout" do
63
+ run_generator %w(--layout fluid)
64
+
65
+ assert_file "app/views/layouts/application.html.erb"
66
+ end
67
+
68
+ test "should create container-app erb layout" do
69
+ run_generator %w(--layout container-app)
70
+
71
+ assert_file "app/views/layouts/application.html.erb"
72
+ end
73
+
74
+ test "should create fluid haml layout" do
75
+ run_generator %w(--template-engine haml --layout fluid)
76
+
77
+ assert_file "app/views/layouts/application.html.haml"
78
+ end
79
+
80
+ test "should create container-app haml layout" do
81
+ run_generator %w(--template-engine haml --layout container-app)
82
+
83
+ assert_file "app/views/layouts/application.html.haml"
32
84
  end
33
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-13 00:00:00.000000000Z
12
+ date: 2011-10-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &2153119940 !ruby/object:Gem::Requirement
16
+ requirement: &2152225480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153119940
24
+ version_requirements: *2152225480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: test-unit
27
- requirement: &2153119500 !ruby/object:Gem::Requirement
27
+ requirement: &2152224800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153119500
35
+ version_requirements: *2152224800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &2153118560 !ruby/object:Gem::Requirement
38
+ requirement: &2152223280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153118560
46
+ version_requirements: *2152223280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: railties
49
- requirement: &2153117360 !ruby/object:Gem::Requirement
49
+ requirement: &2152222000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153117360
57
+ version_requirements: *2152222000
58
58
  description: Bootstrap-generators provides Twitter Bootstrap generators for Rails
59
59
  3. Bootstrap is a toolkit from Twitter designed to kickstart development of webapps
60
60
  and sites. Checkout http://twitter.github.com/bootstrap.
@@ -74,9 +74,16 @@ files:
74
74
  - lib/bootstrap/generators/railtie.rb
75
75
  - lib/bootstrap/generators/version.rb
76
76
  - lib/generators/bootstrap/install/install_generator.rb
77
- - lib/generators/bootstrap/install/templates/application.html.erb
78
- - lib/generators/bootstrap/install/templates/bootstrap-generators.css.scss
79
77
  - lib/generators/bootstrap/install/templates/bootstrap-generators.js
78
+ - lib/generators/bootstrap/install/templates/layouts/container-app.css.scss
79
+ - lib/generators/bootstrap/install/templates/layouts/container-app.html.erb
80
+ - lib/generators/bootstrap/install/templates/layouts/container-app.html.haml
81
+ - lib/generators/bootstrap/install/templates/layouts/fluid.css.scss
82
+ - lib/generators/bootstrap/install/templates/layouts/fluid.html.erb
83
+ - lib/generators/bootstrap/install/templates/layouts/fluid.html.haml
84
+ - lib/generators/bootstrap/install/templates/layouts/hero.css.scss
85
+ - lib/generators/bootstrap/install/templates/layouts/hero.html.erb
86
+ - lib/generators/bootstrap/install/templates/layouts/hero.html.haml
80
87
  - lib/generators/bootstrap/install/templates/lib/templates/erb/controller/view.html.erb
81
88
  - lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/_form.html.erb
82
89
  - lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/edit.html.erb