toronto 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +28 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +179 -0
  7. data/Rakefile +147 -0
  8. data/lib/generators/toronto/install/install_generator.rb +68 -0
  9. data/lib/generators/toronto/install/templates/assets/stylesheets/bootstrap-variables.less +861 -0
  10. data/lib/generators/toronto/install/templates/assets/stylesheets/bootstrap-variables.scss +866 -0
  11. data/lib/generators/toronto/install/templates/assets/stylesheets/starter.css +22 -0
  12. data/lib/generators/toronto/install/templates/assets/stylesheets/starter.less +23 -0
  13. data/lib/generators/toronto/install/templates/assets/stylesheets/starter.scss +23 -0
  14. data/lib/generators/toronto/install/templates/config/initializers/locales.rb +4 -0
  15. data/lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.erb +39 -0
  16. data/lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.haml +26 -0
  17. data/lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.slim +21 -0
  18. data/lib/generators/toronto/install/templates/helpers/menu_helper.rb +7 -0
  19. data/lib/generators/toronto/install/templates/layouts/starter.html.erb +57 -0
  20. data/lib/generators/toronto/install/templates/layouts/starter.html.haml +48 -0
  21. data/lib/generators/toronto/install/templates/layouts/starter.html.slim +53 -0
  22. data/lib/generators/toronto/install/templates/lib/rails/generators/haml/scaffold/scaffold_generator.rb +51 -0
  23. data/lib/generators/toronto/install/templates/lib/templates/erb/controller/view.html.erb +4 -0
  24. data/lib/generators/toronto/install/templates/lib/templates/erb/scaffold/edit.html.erb +13 -0
  25. data/lib/generators/toronto/install/templates/lib/templates/erb/scaffold/index.html.erb +33 -0
  26. data/lib/generators/toronto/install/templates/lib/templates/erb/scaffold/new.html.erb +9 -0
  27. data/lib/generators/toronto/install/templates/lib/templates/erb/scaffold/show.html.erb +19 -0
  28. data/lib/generators/toronto/install/templates/lib/templates/haml/controller/view.html.haml +3 -0
  29. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/edit.html.haml +10 -0
  30. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/en.yml +23 -0
  31. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/fr.yml +23 -0
  32. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/index.html.haml +30 -0
  33. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/new.html.haml +7 -0
  34. data/lib/generators/toronto/install/templates/lib/templates/haml/scaffold/show.html.haml +18 -0
  35. data/lib/generators/toronto/install/templates/lib/templates/slim/controller/view.html.slim +5 -0
  36. data/lib/generators/toronto/install/templates/lib/templates/slim/scaffold/edit.html.slim +12 -0
  37. data/lib/generators/toronto/install/templates/lib/templates/slim/scaffold/index.html.slim +31 -0
  38. data/lib/generators/toronto/install/templates/lib/templates/slim/scaffold/new.html.slim +9 -0
  39. data/lib/generators/toronto/install/templates/lib/templates/slim/scaffold/show.html.slim +16 -0
  40. data/lib/toronto/version.rb +3 -0
  41. data/lib/toronto.rb +22 -0
  42. data/readme-template.md.erb +163 -0
  43. data/test/dummy/Rakefile +7 -0
  44. data/test/dummy/app/assets/javascripts/application.js +13 -0
  45. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  46. data/test/dummy/config/application.rb +68 -0
  47. data/test/dummy/config/boot.rb +6 -0
  48. data/test/dummy/config/environment.rb +5 -0
  49. data/test/dummy/config/environments/test.rb +39 -0
  50. data/test/dummy/config.ru +4 -0
  51. data/test/generators/bootstrap/install_generator_test.rb +104 -0
  52. data/test/test_helper.rb +7 -0
  53. data/toronto.gemspec +30 -0
  54. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  55. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  56. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  57. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  58. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  59. data/vendor/assets/javascripts/bootstrap/affix.js +162 -0
  60. data/vendor/assets/javascripts/bootstrap/alert.js +94 -0
  61. data/vendor/assets/javascripts/bootstrap/button.js +116 -0
  62. data/vendor/assets/javascripts/bootstrap/carousel.js +237 -0
  63. data/vendor/assets/javascripts/bootstrap/collapse.js +211 -0
  64. data/vendor/assets/javascripts/bootstrap/dropdown.js +161 -0
  65. data/vendor/assets/javascripts/bootstrap/modal.js +339 -0
  66. data/vendor/assets/javascripts/bootstrap/popover.js +108 -0
  67. data/vendor/assets/javascripts/bootstrap/scrollspy.js +172 -0
  68. data/vendor/assets/javascripts/bootstrap/tab.js +153 -0
  69. data/vendor/assets/javascripts/bootstrap/tooltip.js +476 -0
  70. data/vendor/assets/javascripts/bootstrap/transition.js +59 -0
  71. data/vendor/assets/javascripts/bootstrap.js +12 -0
  72. data/vendor/assets/stylesheets/bootstrap.css.erb +6584 -0
  73. data/vendor/assets/stylesheets/bootstrap.css.map +1 -0
  74. data/vendor/twitter/bootstrap/less/alerts.less +73 -0
  75. data/vendor/twitter/bootstrap/less/badges.less +66 -0
  76. data/vendor/twitter/bootstrap/less/bootstrap.less +50 -0
  77. data/vendor/twitter/bootstrap/less/breadcrumbs.less +26 -0
  78. data/vendor/twitter/bootstrap/less/button-groups.less +243 -0
  79. data/vendor/twitter/bootstrap/less/buttons.less +160 -0
  80. data/vendor/twitter/bootstrap/less/carousel.less +269 -0
  81. data/vendor/twitter/bootstrap/less/close.less +34 -0
  82. data/vendor/twitter/bootstrap/less/code.less +69 -0
  83. data/vendor/twitter/bootstrap/less/component-animations.less +33 -0
  84. data/vendor/twitter/bootstrap/less/dropdowns.less +214 -0
  85. data/vendor/twitter/bootstrap/less/forms.less +574 -0
  86. data/vendor/twitter/bootstrap/less/glyphicons.less +305 -0
  87. data/vendor/twitter/bootstrap/less/grid.less +84 -0
  88. data/vendor/twitter/bootstrap/less/input-groups.less +166 -0
  89. data/vendor/twitter/bootstrap/less/jumbotron.less +50 -0
  90. data/vendor/twitter/bootstrap/less/labels.less +64 -0
  91. data/vendor/twitter/bootstrap/less/list-group.less +124 -0
  92. data/vendor/twitter/bootstrap/less/media.less +61 -0
  93. data/vendor/twitter/bootstrap/less/mixins/alerts.less +14 -0
  94. data/vendor/twitter/bootstrap/less/mixins/background-variant.less +8 -0
  95. data/vendor/twitter/bootstrap/less/mixins/border-radius.less +18 -0
  96. data/vendor/twitter/bootstrap/less/mixins/buttons.less +52 -0
  97. data/vendor/twitter/bootstrap/less/mixins/center-block.less +7 -0
  98. data/vendor/twitter/bootstrap/less/mixins/clearfix.less +22 -0
  99. data/vendor/twitter/bootstrap/less/mixins/forms.less +85 -0
  100. data/vendor/twitter/bootstrap/less/mixins/gradients.less +59 -0
  101. data/vendor/twitter/bootstrap/less/mixins/grid-framework.less +91 -0
  102. data/vendor/twitter/bootstrap/less/mixins/grid.less +122 -0
  103. data/vendor/twitter/bootstrap/less/mixins/hide-text.less +21 -0
  104. data/vendor/twitter/bootstrap/less/mixins/image.less +33 -0
  105. data/vendor/twitter/bootstrap/less/mixins/labels.less +12 -0
  106. data/vendor/twitter/bootstrap/less/mixins/list-group.less +29 -0
  107. data/vendor/twitter/bootstrap/less/mixins/nav-divider.less +10 -0
  108. data/vendor/twitter/bootstrap/less/mixins/nav-vertical-align.less +9 -0
  109. data/vendor/twitter/bootstrap/less/mixins/opacity.less +8 -0
  110. data/vendor/twitter/bootstrap/less/mixins/pagination.less +23 -0
  111. data/vendor/twitter/bootstrap/less/mixins/panels.less +24 -0
  112. data/vendor/twitter/bootstrap/less/mixins/progress-bar.less +10 -0
  113. data/vendor/twitter/bootstrap/less/mixins/reset-filter.less +8 -0
  114. data/vendor/twitter/bootstrap/less/mixins/resize.less +6 -0
  115. data/vendor/twitter/bootstrap/less/mixins/responsive-visibility.less +15 -0
  116. data/vendor/twitter/bootstrap/less/mixins/size.less +10 -0
  117. data/vendor/twitter/bootstrap/less/mixins/tab-focus.less +9 -0
  118. data/vendor/twitter/bootstrap/less/mixins/table-row.less +28 -0
  119. data/vendor/twitter/bootstrap/less/mixins/text-emphasis.less +8 -0
  120. data/vendor/twitter/bootstrap/less/mixins/text-overflow.less +8 -0
  121. data/vendor/twitter/bootstrap/less/mixins/vendor-prefixes.less +227 -0
  122. data/vendor/twitter/bootstrap/less/mixins.less +39 -0
  123. data/vendor/twitter/bootstrap/less/modals.less +150 -0
  124. data/vendor/twitter/bootstrap/less/navbar.less +660 -0
  125. data/vendor/twitter/bootstrap/less/navs.less +242 -0
  126. data/vendor/twitter/bootstrap/less/normalize.less +427 -0
  127. data/vendor/twitter/bootstrap/less/pager.less +54 -0
  128. data/vendor/twitter/bootstrap/less/pagination.less +88 -0
  129. data/vendor/twitter/bootstrap/less/panels.less +265 -0
  130. data/vendor/twitter/bootstrap/less/popovers.less +135 -0
  131. data/vendor/twitter/bootstrap/less/print.less +107 -0
  132. data/vendor/twitter/bootstrap/less/progress-bars.less +87 -0
  133. data/vendor/twitter/bootstrap/less/responsive-embed.less +35 -0
  134. data/vendor/twitter/bootstrap/less/responsive-utilities.less +194 -0
  135. data/vendor/twitter/bootstrap/less/scaffolding.less +162 -0
  136. data/vendor/twitter/bootstrap/less/tables.less +234 -0
  137. data/vendor/twitter/bootstrap/less/theme.less +273 -0
  138. data/vendor/twitter/bootstrap/less/thumbnails.less +36 -0
  139. data/vendor/twitter/bootstrap/less/tooltip.less +102 -0
  140. data/vendor/twitter/bootstrap/less/type.less +302 -0
  141. data/vendor/twitter/bootstrap/less/utilities.less +55 -0
  142. data/vendor/twitter/bootstrap/less/variables.less +861 -0
  143. data/vendor/twitter/bootstrap/less/wells.less +29 -0
  144. data/vendor/twitter/bootstrap/sass/_bootstrap-compass.scss +9 -0
  145. data/vendor/twitter/bootstrap/sass/_bootstrap-mincer.scss +19 -0
  146. data/vendor/twitter/bootstrap/sass/_bootstrap-sprockets.scss +9 -0
  147. data/vendor/twitter/bootstrap/sass/_bootstrap.scss +50 -0
  148. data/vendor/twitter/bootstrap/sass/bootstrap/_alerts.scss +73 -0
  149. data/vendor/twitter/bootstrap/sass/bootstrap/_badges.scss +68 -0
  150. data/vendor/twitter/bootstrap/sass/bootstrap/_breadcrumbs.scss +26 -0
  151. data/vendor/twitter/bootstrap/sass/bootstrap/_button-groups.scss +243 -0
  152. data/vendor/twitter/bootstrap/sass/bootstrap/_buttons.scss +160 -0
  153. data/vendor/twitter/bootstrap/sass/bootstrap/_carousel.scss +269 -0
  154. data/vendor/twitter/bootstrap/sass/bootstrap/_close.scss +36 -0
  155. data/vendor/twitter/bootstrap/sass/bootstrap/_code.scss +69 -0
  156. data/vendor/twitter/bootstrap/sass/bootstrap/_component-animations.scss +37 -0
  157. data/vendor/twitter/bootstrap/sass/bootstrap/_dropdowns.scss +214 -0
  158. data/vendor/twitter/bootstrap/sass/bootstrap/_forms.scss +578 -0
  159. data/vendor/twitter/bootstrap/sass/bootstrap/_glyphicons.scss +305 -0
  160. data/vendor/twitter/bootstrap/sass/bootstrap/_grid.scss +84 -0
  161. data/vendor/twitter/bootstrap/sass/bootstrap/_input-groups.scss +166 -0
  162. data/vendor/twitter/bootstrap/sass/bootstrap/_jumbotron.scss +50 -0
  163. data/vendor/twitter/bootstrap/sass/bootstrap/_labels.scss +66 -0
  164. data/vendor/twitter/bootstrap/sass/bootstrap/_list-group.scss +124 -0
  165. data/vendor/twitter/bootstrap/sass/bootstrap/_media.scss +61 -0
  166. data/vendor/twitter/bootstrap/sass/bootstrap/_mixins.scss +39 -0
  167. data/vendor/twitter/bootstrap/sass/bootstrap/_modals.scss +150 -0
  168. data/vendor/twitter/bootstrap/sass/bootstrap/_navbar.scss +662 -0
  169. data/vendor/twitter/bootstrap/sass/bootstrap/_navs.scss +242 -0
  170. data/vendor/twitter/bootstrap/sass/bootstrap/_normalize.scss +427 -0
  171. data/vendor/twitter/bootstrap/sass/bootstrap/_pager.scss +54 -0
  172. data/vendor/twitter/bootstrap/sass/bootstrap/_pagination.scss +88 -0
  173. data/vendor/twitter/bootstrap/sass/bootstrap/_panels.scss +265 -0
  174. data/vendor/twitter/bootstrap/sass/bootstrap/_popovers.scss +135 -0
  175. data/vendor/twitter/bootstrap/sass/bootstrap/_print.scss +107 -0
  176. data/vendor/twitter/bootstrap/sass/bootstrap/_progress-bars.scss +87 -0
  177. data/vendor/twitter/bootstrap/sass/bootstrap/_responsive-embed.scss +35 -0
  178. data/vendor/twitter/bootstrap/sass/bootstrap/_responsive-utilities.scss +177 -0
  179. data/vendor/twitter/bootstrap/sass/bootstrap/_scaffolding.scss +162 -0
  180. data/vendor/twitter/bootstrap/sass/bootstrap/_tables.scss +234 -0
  181. data/vendor/twitter/bootstrap/sass/bootstrap/_theme.scss +273 -0
  182. data/vendor/twitter/bootstrap/sass/bootstrap/_thumbnails.scss +38 -0
  183. data/vendor/twitter/bootstrap/sass/bootstrap/_tooltip.scss +102 -0
  184. data/vendor/twitter/bootstrap/sass/bootstrap/_type.scss +298 -0
  185. data/vendor/twitter/bootstrap/sass/bootstrap/_utilities.scss +55 -0
  186. data/vendor/twitter/bootstrap/sass/bootstrap/_variables.scss +866 -0
  187. data/vendor/twitter/bootstrap/sass/bootstrap/_wells.scss +29 -0
  188. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_alerts.scss +14 -0
  189. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_background-variant.scss +11 -0
  190. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_border-radius.scss +18 -0
  191. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_buttons.scss +52 -0
  192. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_center-block.scss +7 -0
  193. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_clearfix.scss +22 -0
  194. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_forms.scss +88 -0
  195. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_gradients.scss +58 -0
  196. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_grid-framework.scss +81 -0
  197. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_grid.scss +122 -0
  198. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_hide-text.scss +21 -0
  199. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_image.scss +33 -0
  200. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_labels.scss +12 -0
  201. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_list-group.scss +31 -0
  202. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_nav-divider.scss +10 -0
  203. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  204. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_opacity.scss +8 -0
  205. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_pagination.scss +23 -0
  206. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_panels.scss +24 -0
  207. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_progress-bar.scss +10 -0
  208. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_reset-filter.scss +8 -0
  209. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_resize.scss +6 -0
  210. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_responsive-visibility.scss +21 -0
  211. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_size.scss +10 -0
  212. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_tab-focus.scss +9 -0
  213. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_table-row.scss +28 -0
  214. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_text-emphasis.scss +11 -0
  215. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_text-overflow.scss +8 -0
  216. data/vendor/twitter/bootstrap/sass/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  217. metadata +312 -0
@@ -0,0 +1,16 @@
1
+ .page-header
2
+ = link_to <%= index_helper %>_path, class: 'btn btn-default' do
3
+ span.glyphicon.glyphicon-list-alt
4
+ | Back
5
+ = link_to edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-primary' do
6
+ span.glyphicon.glyphicon-pencil
7
+ | Edit
8
+ h1
9
+ | Show <%= singular_table_name %>
10
+ dl.dl-horizontal
11
+ <%- for attribute in attributes -%>
12
+ dt
13
+ | <%= attribute.human_name %>:
14
+ dd
15
+ = @<%= singular_table_name %>.<%= attribute.name %>
16
+ <%- end -%>
@@ -0,0 +1,3 @@
1
+ module Toronto
2
+ VERSION = '0.0.1'
3
+ end
data/lib/toronto.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'rails'
2
+
3
+ module Toronto
4
+
5
+ class Engine < ::Rails::Engine
6
+ config.app_generators.stylesheets false
7
+
8
+ initializer 'toronto.setup', group: :all do |app|
9
+ app.config.less.paths << ::File.expand_path('../../vendor/twitter/bootstrap/less', __FILE__) if app.config.respond_to?(:less)
10
+ app.config.assets.paths << ::File.expand_path('../../vendor/twitter/bootstrap/sass', __FILE__) if app.config.respond_to?(:sass)
11
+
12
+ app.config.assets.paths << ::Rails.root.join('app', 'assets', 'fonts')
13
+
14
+ app.config.assets.precompile << /\.(?:svg|eot|woff|woff2|ttf)$/
15
+ end
16
+ end
17
+
18
+ class Railtie < ::Rails::Railtie
19
+ config.app_generators.template_engine :haml
20
+ end
21
+
22
+ end
@@ -0,0 +1,163 @@
1
+ # Bootstrap Generators
2
+
3
+ [![Build Status](https://travis-ci.org/decioferreira/bootstrap-generators.png?branch=master)](https://travis-ci.org/decioferreira/bootstrap-generators)
4
+
5
+ Bootstrap-generators provides [Twitter Bootstrap](http://getbootstrap.com/) generators for Rails 4 (supported Rails >= 3.1). Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
6
+
7
+ ## Current Twitter Bootstrap version
8
+
9
+ The current supported version of Twitter Bootstrap is <%= bootstrap_version %>.
10
+
11
+ ## Installing Gem
12
+
13
+ In your Gemfile, add this line:
14
+
15
+ gem 'bootstrap-generators', '~> <%= striped_bootstrap_generators_version %>'
16
+
17
+ Or you can install from latest build:
18
+
19
+ gem 'bootstrap-generators', git: 'git://github.com/decioferreira/bootstrap-generators.git'
20
+
21
+ Run bundle install:
22
+
23
+ bundle install
24
+
25
+ ## Generators
26
+
27
+ Get started:
28
+
29
+ rails generate bootstrap:install
30
+
31
+ To overwrite files that already exist, pass the `--force` (`-f`) option.
32
+
33
+ Once you've done that, any time you generate a controller or scaffold, you'll get [Bootstrap](http://twitter.github.com/bootstrap/) templates.
34
+
35
+ ### Give it a try
36
+
37
+ rails generate scaffold post title body:text published:boolean
38
+
39
+ You can easily customize colors, grid system, fonts, and much more by editing `bootstrap-variables.[less|scss]` on your application assets folder.
40
+
41
+ ## Usage
42
+
43
+ To print the options and usage run the command `rails generate bootstrap:install --help`
44
+
45
+ Usage:
46
+ rails generate bootstrap:install [options]
47
+
48
+ Options:
49
+ -e, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
50
+ # Default: erb
51
+ -se, [--stylesheet-engine=STYLESHEET_ENGINE] # Indicates when to generate stylesheet engine
52
+ # Default: scss
53
+ [--skip-turbolinks], [--no-skip-turbolinks] # Indicates when to generate skip turbolinks
54
+
55
+ Runtime options:
56
+ -f, [--force] # Overwrite files that already exist
57
+ -p, [--pretend], [--no-pretend] # Run but do not make any changes
58
+ -q, [--quiet], [--no-quiet] # Suppress status output
59
+ -s, [--skip], [--no-skip] # Skip files that already exist
60
+
61
+ Copy BootstrapGenerators default files
62
+
63
+ ### Options
64
+
65
+ #### Template engines
66
+
67
+ Supported template engines:
68
+
69
+ * ERB
70
+ * Haml
71
+ * Slim
72
+
73
+ ##### Haml
74
+
75
+ Add the dependency on your Gemfile:
76
+
77
+ gem 'haml-rails'
78
+
79
+ And then run:
80
+
81
+ rails generate bootstrap:install --template-engine=haml
82
+
83
+ ##### Slim
84
+
85
+ Add the dependency on your Gemfile:
86
+
87
+ gem 'slim-rails'
88
+
89
+ And then run:
90
+
91
+ rails generate bootstrap:install --template-engine=slim
92
+
93
+
94
+ #### Stylesheet engines
95
+
96
+ Supported stylesheet engines:
97
+
98
+ * CSS
99
+ * SCSS
100
+ * LESS
101
+
102
+ ##### SCSS
103
+
104
+ Make sure you have `sass-rails` dependency on your Gemfile:
105
+
106
+ gem 'sass-rails'
107
+
108
+ And then run:
109
+
110
+ rails generate bootstrap:install --stylesheet-engine=scss
111
+
112
+ Now you can customize the look and feel of Bootstrap.
113
+
114
+ ##### LESS
115
+
116
+ Add the dependency on your Gemfile:
117
+
118
+ gem 'therubyracer', platforms: :ruby
119
+ gem 'less-rails'
120
+
121
+ And then run:
122
+
123
+ rails generate bootstrap:install --stylesheet-engine=less
124
+
125
+ Now you can customize the look and feel of Bootstrap.
126
+
127
+ #### Skip turbolinks
128
+
129
+ Run the generator with option `--skip-turbolinks` to remove turbolinks references from the generated layout.
130
+
131
+ ## Assets
132
+
133
+ ### Customize and extend Bootstrap
134
+
135
+ If you select LESS or SCSS as your stylesheet engine, you will get an `app/assets/stylesheets/bootstrap-variables.[less|scss]` file with all of the default variables of Bootstrap. This way you can customize the look and feel of Bootstrap without having to download any extra file.
136
+
137
+ ### Javascript
138
+
139
+ Select all jQuery plugins (`app/assets/javascripts/bootstrap.js`)
140
+
141
+ //= require bootstrap
142
+
143
+ Or quickly add only the necessary javascript (Transitions: required for any animation; Popovers: requires Tooltips)
144
+
145
+ <%= javascript_bootstrap_content_code %>
146
+
147
+ ## Customizing Templates
148
+
149
+ In Rails 3.0 and above, generators don’t just look in the source root for templates, they also search for templates in other paths. And one of them is lib/templates.
150
+
151
+ Since Bootstrap Generators installs its templates under lib/templates, you can go and customize them.
152
+
153
+ ## Update Bootstrap Version
154
+
155
+ To update the version of Bootstrap on this Gem you can run the following command:
156
+
157
+ rake bootstrap:update
158
+
159
+ There might be some manual changes needed after running this command. But most of the process is automatic.
160
+
161
+ ## Credits
162
+
163
+ * [Twitter Bootstrap](http://getbootstrap.com)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,68 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ # require 'active_record/railtie'
5
+ require 'action_controller/railtie'
6
+ require 'action_mailer/railtie'
7
+ # require 'active_resource/railtie'
8
+ require 'sprockets/railtie'
9
+ # require 'rails/test_unit/railtie'
10
+
11
+ if defined?(Bundler)
12
+ # If you precompile assets before deploying to production, use this line
13
+ Bundler.require(*Rails.groups(assets: %w(development test)))
14
+ # If you want your assets lazily compiled in production, use this line
15
+ # Bundler.require(:default, :assets, Rails.env)
16
+ end
17
+
18
+ module Dummy
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Custom directories with classes and modules you want to be autoloadable.
25
+ # config.autoload_paths += %W(#{config.root}/extras)
26
+
27
+ # Only load the plugins named here, in the order given (default is alphabetical).
28
+ # :all can be used as a placeholder for all plugins not explicitly named.
29
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
30
+
31
+ # Activate observers that should always be running.
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
36
+ # config.time_zone = 'Central Time (US & Canada)'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40
+ # config.i18n.default_locale = :de
41
+
42
+ # Configure the default encoding used in templates for Ruby 1.9.
43
+ config.encoding = 'utf-8'
44
+
45
+ # Configure sensitive parameters which will be filtered from the log file.
46
+ config.filter_parameters += [:password]
47
+
48
+ # Enable escaping HTML in JSON.
49
+ config.active_support.escape_html_entities_in_json = true
50
+
51
+ # Use SQL instead of Active Record's schema dumper when creating the database.
52
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
53
+ # like if you have constraints or database-specific column types
54
+ # config.active_record.schema_format = :sql
55
+
56
+ # Enforce whitelist mode for mass assignment.
57
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
58
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
59
+ # parameters by using an attr_accessible or attr_protected declaration.
60
+ # config.active_record.whitelist_attributes = true
61
+
62
+ # Enable the asset pipeline
63
+ config.assets.enabled = true
64
+
65
+ # Version of your assets, change this if you want to expire all your assets
66
+ config.assets.version = '1.0'
67
+ end
68
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,39 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Log error messages when you accidentally call methods on nil
20
+ config.whiny_nils = true
21
+
22
+ # Show full error reports and disable caching
23
+ config.consider_all_requests_local = true
24
+ config.action_controller.perform_caching = false
25
+
26
+ # Raise exceptions instead of rendering exception templates
27
+ config.action_dispatch.show_exceptions = false
28
+
29
+ # Disable request forgery protection in test environment
30
+ config.action_controller.allow_forgery_protection = false
31
+
32
+ # Tell Action Mailer not to deliver emails to the real world.
33
+ # The :test delivery method accumulates sent emails in the
34
+ # ActionMailer::Base.deliveries array.
35
+ config.action_mailer.delivery_method = :test
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,104 @@
1
+ require 'test_helper'
2
+ require 'generators/bootstrap/install/install_generator'
3
+
4
+ class InstallGeneratorTest < Rails::Generators::TestCase
5
+ tests Bootstrap::Generators::InstallGenerator
6
+ destination File.expand_path('../../../../tmp', __FILE__)
7
+ arguments %w(-f)
8
+
9
+ setup do
10
+ prepare_destination
11
+ prepare_dummy_app
12
+ end
13
+
14
+ test 'precompile assets' do
15
+ generator.application 'config.assets.initialize_on_precompile = false'
16
+ run_generator %W(-f --stylesheet-engine scss)
17
+ # quietly { generator.rake 'assets:precompile' }
18
+ generator.rake 'assets:precompile' # temporarily display errors
19
+ assert_equal 0, $?.exitstatus
20
+ end
21
+
22
+ templating_systems = %w{erb haml slim}
23
+ templating_systems.each do |templating_system|
24
+ test "should copy controller #{templating_system} templates" do
25
+ run_generator %W(-f --template-engine #{templating_system})
26
+
27
+ assert_file "lib/templates/#{templating_system}/controller/view.html.#{templating_system}"
28
+ (templating_systems - [templating_system]).each do |other_templating_system|
29
+ assert_no_file "lib/templates/#{other_templating_system}/controller/view.html.#{other_templating_system}"
30
+ end
31
+ end
32
+
33
+ test "should copy scaffold #{templating_system} templates" do
34
+ run_generator %W(-f --template-engine #{templating_system})
35
+
36
+ %w(index edit new show _form).each do |view|
37
+ assert_file "lib/templates/#{templating_system}/scaffold/#{view}.html.#{templating_system}"
38
+ (templating_systems - [templating_system]).each do |other_templating_system|
39
+ assert_no_file "lib/templates/#{other_templating_system}/scaffold/#{view}.html.#{other_templating_system}"
40
+ end
41
+ end
42
+ end
43
+
44
+ test "should create #{templating_system} layout" do
45
+ run_generator %W(-f --template-engine #{templating_system})
46
+
47
+ assert_file "app/views/layouts/application.html.#{templating_system}"
48
+ end
49
+
50
+ test "should not skip turbolinks by default (#{templating_system} layout)" do
51
+ run_generator %W(-f --template-engine #{templating_system})
52
+
53
+ assert_file "app/views/layouts/application.html.#{templating_system}" do |contents|
54
+ assert_match(/stylesheet_link_tag\s+'application', media: 'all', 'data-turbolinks-track' => true/, contents)
55
+ assert_match(/javascript_include_tag\s+'application', 'data-turbolinks-track' => true/, contents)
56
+ end
57
+ end
58
+
59
+ test "should skip turbolinks (#{templating_system} layout)" do
60
+ run_generator %W(-f --template-engine #{templating_system} --skip-turbolinks)
61
+
62
+ assert_file "app/views/layouts/application.html.#{templating_system}" do |contents|
63
+ assert_no_match(/stylesheet_link_tag\s+'application', media: 'all', 'data-turbolinks-track' => true/, contents)
64
+ assert_no_match(/javascript_include_tag\s+'application', 'data-turbolinks-track' => true/, contents)
65
+ end
66
+ end
67
+ end
68
+
69
+ test 'should copy css files' do
70
+ run_generator %w(-f --stylesheet-engine css)
71
+
72
+ assert_file 'app/assets/stylesheets/bootstrap-generators.css'
73
+ end
74
+
75
+ css_preprocessors = %w{scss less}
76
+ css_preprocessors.each do |css_preprocessor|
77
+ test "should copy #{css_preprocessor} files" do
78
+ run_generator %W(-f --stylesheet-engine #{css_preprocessor})
79
+
80
+ assert_file "app/assets/stylesheets/bootstrap-generators.#{css_preprocessor}"
81
+ assert_file "app/assets/stylesheets/bootstrap-variables.#{css_preprocessor}"
82
+ end
83
+ end
84
+
85
+ test 'should require javascript bootstrap file' do
86
+ run_generator
87
+
88
+ assert_file 'app/assets/javascripts/application.js', /require bootstrap/
89
+ end
90
+
91
+ test 'should work when there is no application.js file' do
92
+ File.delete(File.join(destination_root, 'app/assets/javascripts/application.js'))
93
+
94
+ assert_nothing_raised Errno::ENOENT do
95
+ run_generator
96
+ end
97
+ end
98
+
99
+ private
100
+
101
+ def prepare_dummy_app
102
+ FileUtils.cp_r('test/dummy/.', destination_root)
103
+ end
104
+ end
@@ -0,0 +1,7 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+ require 'rails/test_help'
5
+ require 'rails/generators/test_case'
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
data/toronto.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'toronto/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'toronto'
8
+ spec.version = Toronto::VERSION
9
+ spec.authors = ['Cédric Zuger']
10
+ spec.email = ['zuger.cedric@gmail.com']
11
+ spec.summary = 'inTernatiOnalization Ready bOotstrap geNeraTOr'
12
+ spec.description = 'This is a fork of Twitter Bootstrap generators where static fields are translated fields.'
13
+ spec.homepage = 'https://github.com/czuger/toronto'
14
+ spec.license = 'MIT'
15
+
16
+ # spec.rubyforge_project = "bootstrap-generators"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.5'
24
+ spec.add_development_dependency 'rake'
25
+ # spec.add_development_dependency 'haml-rails', '>= 0.9.0'
26
+
27
+ spec.add_runtime_dependency 'railties', '>= 3.1.0'
28
+ # spec.add_runtime_dependency 'haml-rails', '>= 0.9.0'
29
+
30
+ end