mxm-boilerplate 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +9 -0
  3. data/Readme.md +2 -0
  4. data/lib/generators/mxm/assets/assets_generator.rb +27 -0
  5. data/lib/generators/mxm/assets/templates/javascripts/application.js +3 -0
  6. data/lib/generators/mxm/assets/templates/javascripts/controllers/.empty_directory +0 -0
  7. data/lib/generators/mxm/assets/templates/javascripts/views/.empty_directory +0 -0
  8. data/lib/generators/mxm/assets/templates/stylesheets/_helpers/.empty_directory +0 -0
  9. data/lib/generators/mxm/assets/templates/stylesheets/_variables.css.scss +2 -0
  10. data/lib/generators/mxm/assets/templates/stylesheets/application.css.scss +31 -0
  11. data/lib/generators/mxm/assets/templates/stylesheets/base/default.css.scss +49 -0
  12. data/lib/generators/mxm/assets/templates/stylesheets/base/grid.css.scss +131 -0
  13. data/lib/generators/mxm/assets/templates/stylesheets/base/helpers.css.scss +93 -0
  14. data/lib/generators/mxm/assets/templates/stylesheets/base/lists.css.scss +25 -0
  15. data/lib/generators/mxm/assets/templates/stylesheets/base/typography.css.scss +33 -0
  16. data/lib/generators/mxm/assets/templates/stylesheets/layout/.empty_directory +0 -0
  17. data/lib/generators/mxm/assets/templates/stylesheets/modules/.empty_directory +0 -0
  18. data/lib/generators/mxm/assets/templates/stylesheets/states/.empty_directory +0 -0
  19. data/lib/generators/mxm/generator_helper.rb +6 -0
  20. data/lib/generators/mxm/layout/layout_generator.rb +12 -0
  21. data/lib/generators/mxm/layout/templates/layouts/_footer.html.erb +3 -0
  22. data/lib/generators/mxm/layout/templates/layouts/_header.html.erb +3 -0
  23. data/lib/generators/mxm/layout/templates/layouts/_tracking.html.erb +7 -0
  24. data/lib/generators/mxm/layout/templates/layouts/application.html.erb +36 -0
  25. data/lib/generators/mxm/setup/USAGE +5 -0
  26. data/lib/generators/mxm/setup/setup_generator.rb +12 -0
  27. data/lib/mxm/rails/engine.rb +6 -0
  28. data/lib/mxm/rails/version.rb +5 -0
  29. data/lib/mxm/rails.rb +7 -0
  30. data/lib/mxm-boilerplate.rb +1 -0
  31. data/mxm-boilerplate.gemspec +24 -0
  32. data/vendor/assets/javascripts/bigbird.js +285 -0
  33. data/vendor/assets/javascripts/jquery-1.9.0.min.js +4 -0
  34. data/vendor/assets/javascripts/modernizr-2.6.2.min.js +4 -0
  35. data/vendor/assets/stylesheets/normalize.css +527 -0
  36. metadata +112 -0
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'lib'
6
+ t.libs << 'test'
7
+ t.pattern = 'test/**/*_test.rb'
8
+ t.verbose = true
9
+ end
data/Readme.md ADDED
@@ -0,0 +1,2 @@
1
+ # MxM Boilerplate Rails
2
+
@@ -0,0 +1,27 @@
1
+ module Mxm
2
+ module Generators
3
+ class AssetsGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_stylesheets
7
+ remove_file "app/assets/stylesheets/application.css"
8
+ directory "stylesheets", "app/assets/stylesheets"
9
+ end
10
+
11
+ def generate_javascripts
12
+ remove_file "app/assets/javascripts/application.js"
13
+ directory "javascripts", "app/assets/javascripts"
14
+ end
15
+
16
+ protected
17
+
18
+ def application_name
19
+ if defined?(::Rails) && ::Rails.application
20
+ ::Rails.application.class.name.split('::').first.downcase.parameterize
21
+ else
22
+ "intializer"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ // This file was generated by the MxM Base Generator
2
+ //= require jquery_ujs
3
+ //= require bigbird
@@ -0,0 +1,2 @@
1
+ // Any variables should be placed in here
2
+ // $white-colour = #fff
@@ -0,0 +1,31 @@
1
+ // This file was generated by the MxM Base Generator
2
+
3
+ //-----------------------------------------
4
+ // Variables come first
5
+ //-----------------------------------------
6
+ @import "variables";
7
+ @import "normalize";
8
+
9
+ //-----------------------------------------
10
+ // Base
11
+ //-----------------------------------------
12
+
13
+ @import "base/default"
14
+ @import "base/grid"
15
+ @import "base/typography"
16
+ @import "base/lists"
17
+ @import "base/helpers"
18
+
19
+ //-----------------------------------------
20
+ // Layout
21
+ //-----------------------------------------
22
+
23
+
24
+ //-----------------------------------------
25
+ // Modules
26
+ //-----------------------------------------
27
+
28
+
29
+ //-----------------------------------------
30
+ // States
31
+ //-----------------------------------------
@@ -0,0 +1,49 @@
1
+ //-----------------------------------------
2
+ // Sensible Application Defaults
3
+ // Some taken from: https://github.com/h5bp/html5-boilerplate
4
+ //-----------------------------------------
5
+
6
+ html,
7
+ button,
8
+ input,
9
+ select,
10
+ textarea {
11
+ color: #222;
12
+ }
13
+
14
+ body {
15
+ font-size: 1em;
16
+ line-height: 1.4;
17
+ }
18
+
19
+ ::-moz-selection {
20
+ background: #FFF0A0;
21
+ text-shadow: none;
22
+ }
23
+
24
+ ::selection {
25
+ background: #FFF0A0;
26
+ text-shadow: none;
27
+ }
28
+
29
+ img {
30
+ vertical-align: middle;
31
+ }
32
+
33
+ fieldset {
34
+ border: 0;
35
+ margin: 0;
36
+ padding: 0;
37
+ }
38
+
39
+ textarea {
40
+ resize: vertical;
41
+ }
42
+
43
+ a,
44
+ a:hover,
45
+ a:focus {
46
+ color: #222;
47
+ }
48
+
49
+ a:hover { text-decoration: underline; }
@@ -0,0 +1,131 @@
1
+ //-----------------------------------------
2
+ // Simple CSS Grid
3
+ // https://github.com/callum-/flynn
4
+ //-----------------------------------------
5
+
6
+ .l-sixteen-columns,
7
+ .l-twelve-columns,
8
+ .l-column {
9
+ margin: 0;
10
+ padding: 0;
11
+ -webkit-box-sizing: border-box;
12
+ -moz-box-sizing: border-box;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ .l-sixteen-columns:after,
17
+ .l-twelve-columns:after,
18
+ .l-column:after {
19
+ content: "";
20
+ display: table;
21
+ clear: both;
22
+ }
23
+
24
+ .l-column {
25
+ float: left;
26
+ padding: .5em;
27
+ }
28
+
29
+ .no-gutter {
30
+ padding: 0 !important;
31
+ }
32
+
33
+
34
+ /*
35
+ 16x column sizes
36
+ ================
37
+ 1. 6.25%
38
+ 2. 12.5%
39
+ 3. 18.75%
40
+ 4. 25%
41
+ 5. 31.25%
42
+ 6. 37.5%
43
+ 7. 43.75%
44
+ 8. 50%
45
+ 9. 56.25%
46
+ 10. 62.5%
47
+ 11. 68.75%
48
+ 12. 75%
49
+ 13. 81.25%
50
+ 14. 87.5%
51
+ 15. 93.75%
52
+ 16. 100%
53
+ */
54
+
55
+ .l-sixteen-columns .l-column {
56
+ width: 6.25%;}
57
+
58
+ .l-sixteen-columns .l-span-two {
59
+ width: 12.5%;}
60
+ .l-sixteen-columns .l-span-three {
61
+ width: 18.75%;}
62
+ .l-sixteen-columns .l-span-four {
63
+ width: 25%;}
64
+ .l-sixteen-columns .l-span-five {
65
+ width: 31.25%;}
66
+ .l-sixteen-columns .l-span-six {
67
+ width: 37.5%;}
68
+ .l-sixteen-columns .l-span-seven {
69
+ width: 43.75%;}
70
+ .l-sixteen-columns .l-span-eight {
71
+ width: 50%;}
72
+ .l-sixteen-columns .l-span-nine {
73
+ width: 56.25%;}
74
+ .l-sixteen-columns .l-span-ten {
75
+ width: 62.5%;}
76
+ .l-sixteen-columns .l-span-eleven {
77
+ width: 68.75%;}
78
+ .l-sixteen-columns .l-span-twelve {
79
+ width: 75%;}
80
+ .l-sixteen-columns .l-span-thirteen {
81
+ width: 81.25%;}
82
+ .l-sixteen-columns .l-span-fourteen {
83
+ width: 87.5%;}
84
+ .l-sixteen-columns .l-span-fifteen {
85
+ width: 93.75%;}
86
+ .l-sixteen-columns .l-span-sixteen {
87
+ width: 100%;}
88
+
89
+
90
+ /*
91
+ 12x column sizes
92
+ ================
93
+ 1. 8.333333333333334%
94
+ 2. 16.666666666666668%
95
+ 3. 25%
96
+ 4. 33.333333333333336%
97
+ 5. 41.66666666666667%
98
+ 6. 50%
99
+ 7. 58.333333333333336%
100
+ 8. 66.66666666666667%
101
+ 9. 75%
102
+ 10. 83.33333333333334%
103
+ 11. 91.66666666666667%
104
+ 12. 100%
105
+ */
106
+
107
+ .l-twelve-columns .l-column {
108
+ width: 8.333333333333334%;}
109
+
110
+ .l-twelve-columns .l-span-two {
111
+ width: 16.666666666666668%;}
112
+ .l-twelve-columns .l-span-three {
113
+ width: 25%;}
114
+ .l-twelve-columns .l-span-four {
115
+ width: 33.333333333333336%;}
116
+ .l-twelve-columns .l-span-five {
117
+ width: 41.66666666666667%;}
118
+ .l-twelve-columns .l-span-six {
119
+ width: 50%;}
120
+ .l-twelve-columns .l-span-seven {
121
+ width: 58.333333333333336%;}
122
+ .l-twelve-columns .l-span-eight {
123
+ width: 66.66666666666667%;}
124
+ .l-twelve-columns .l-span-nine {
125
+ width: 75%;}
126
+ .l-twelve-columns .l-span-ten {
127
+ width: 83.33333333333334%;}
128
+ .l-twelve-columns .l-span-eleven {
129
+ width: 91.66666666666667%;}
130
+ .l-twelve-columns .l-span-twelve {
131
+ width: 100%;}
@@ -0,0 +1,93 @@
1
+ //-----------------------------------------
2
+ // Sensible Application Helpers
3
+ // Some taken from: https://github.com/h5bp/html5-boilerplate
4
+ //-----------------------------------------
5
+
6
+ .chromeframe {
7
+ margin: 0.2em 0;
8
+ background: #ccc;
9
+ color: #000;
10
+ padding: 0.2em 0;
11
+ }
12
+
13
+ .ir {
14
+ background-color: transparent;
15
+ border: 0;
16
+ overflow: hidden;
17
+ /* IE 6/7 fallback */
18
+ *text-indent: -9999px;
19
+ }
20
+
21
+ .ir:before {
22
+ content: "";
23
+ display: block;
24
+ width: 0;
25
+ height: 150%;
26
+ }
27
+
28
+ .visuallyhidden {
29
+ border: 0;
30
+ clip: rect(0 0 0 0);
31
+ height: 1px;
32
+ margin: -1px;
33
+ overflow: hidden;
34
+ padding: 0;
35
+ position: absolute;
36
+ width: 1px;
37
+ }
38
+
39
+ .visuallyhidden.focusable:active,
40
+ .visuallyhidden.focusable:focus {
41
+ clip: auto;
42
+ height: auto;
43
+ margin: 0;
44
+ overflow: visible;
45
+ position: static;
46
+ width: auto;
47
+ }
48
+
49
+ .clearfix:before,
50
+ .clearfix:after {
51
+ content: " "; /* 1 */
52
+ display: table; /* 2 */
53
+ }
54
+
55
+ .clearfix:after {
56
+ clear: both;
57
+ }
58
+
59
+ /*
60
+ * For IE 6/7 only
61
+ * Include this rule to trigger hasLayout and contain floats.
62
+ */
63
+
64
+ .clearfix {
65
+ *zoom: 1;
66
+ }
67
+
68
+ // Media Box, from Stubbornella (http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/)
69
+ .l-media { margin: 1.6em; }
70
+
71
+ .l-media,
72
+ .l-media-body { overflow:hidden; _overflow:visible; zoom:1; }
73
+
74
+ .l-media-img { float:left; margin-right: 1.6em; }
75
+ .l-media-img-right { float:right; margin-left: 1.6em; }
76
+
77
+ .l-media-img img { display:block; }
78
+
79
+ // Responsive media
80
+ .l-sixteen-by-nine {
81
+ padding-top: 56.25%; /* 16:9 */
82
+ height: 0;
83
+ position: relative;
84
+ width: 100%;
85
+ }
86
+
87
+ .l-sixteen-by-nine iframe,
88
+ .l-sixteen-by-nine video {
89
+ height: 100%; width: 100%;
90
+ left: 0; top: 0;
91
+ position: absolute;
92
+ }
93
+
@@ -0,0 +1,25 @@
1
+ //-----------------------------------------
2
+ // Simple list helper classes
3
+ //-----------------------------------------
4
+
5
+ .unstyled-list,
6
+ .inline-list,
7
+ .float-list,
8
+ .unstyled-list li,
9
+ .inline-list li,
10
+ .float-list li {
11
+ margin: 0; padding: 0;
12
+ }
13
+
14
+ .unstyled-list li {
15
+ list-style: none;
16
+ }
17
+
18
+ .inline-list li {
19
+ display: inline-block;
20
+ }
21
+
22
+ .float-list li {
23
+ display: block;
24
+ float: left;
25
+ }
@@ -0,0 +1,33 @@
1
+ //-----------------------------------------
2
+ // Typography Basics
3
+ //-----------------------------------------
4
+
5
+ html, body {
6
+ font-family: Helvetica, Arial, sans-serif;
7
+ -webkit-font-smoothing: antialiased;
8
+ }
9
+
10
+ // From @andyhume: https://speakerdeck.com/andyhume/css-for-grown-ups-maturing-best-practises
11
+ h1, h2, h3, h4, h5, h6,
12
+ .h-headline, .h-subheadline, .h-byline,
13
+ .h-standfirst, .h-related, .h-promo {
14
+ line-height: 1.1;
15
+ margin-bottom: 0.25em;
16
+ }
17
+
18
+ h1, .h-headline { font-size: 3em }
19
+ h2, .h-subheadline { font-size: 2.3em; }
20
+ h3, .h-byline { font-size: 2.1em; }
21
+ h4, .h-standfirst { font-size: 1.8em; }
22
+ h5, .h-related { font-size: 1.3em; }
23
+ h6, .h-promo { font-size: 1.1em; }
24
+
25
+ p {
26
+ font-size: 1.33em;
27
+ line-height: 1;
28
+ margin-bottom: 0.25em;
29
+ }
30
+
31
+ p:last-child {
32
+ margin-bottom: 0;
33
+ }
@@ -0,0 +1,6 @@
1
+ module Mxm
2
+ module Generators
3
+ module GeneratorHelpers
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ module Mxm
2
+ module Generators
3
+ class LayoutGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_layout
7
+ remove_file "app/views/layouts/application.html.erb"
8
+ directory "layouts", "app/views/layouts"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ <footer class="l-site-footer">
2
+
3
+ </footer>
@@ -0,0 +1,3 @@
1
+ <header class="l-side-header">
2
+
3
+ </header>
@@ -0,0 +1,7 @@
1
+ <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
2
+ <script>
3
+ var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
4
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
5
+ g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
6
+ s.parentNode.insertBefore(g,s)}(document,'script'));
7
+ </script>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3
+ <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4
+ <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5
+ <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6
+ <head>
7
+ <meta charset="utf-8">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+ <title></title>
10
+ <meta name="description" content="">
11
+ <meta name="viewport" content="width=device-width">
12
+
13
+ <%%= stylesheet_link_tag "application" %>
14
+ <%%= javascript_include_tag "modernizr-2.6.2.js" %>
15
+ <%%= csrf_meta_tags %>
16
+ </head>
17
+ <body data-module="<%%= controller_name %>" data-action="<%%= action_name %>">
18
+ <!--[if lt IE 7]>
19
+ <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
20
+ <![endif]-->
21
+
22
+ <%%= render "header" %>
23
+
24
+ <div class="l-site-content" role="main">
25
+ <%%= yield %>
26
+ </div>
27
+
28
+ <%%= render "footer" %>
29
+
30
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
31
+ <script>window.jQuery || document.write('<script src="<%%= asset_path 'jquery-1.9.0.js' %>"><\/script>')</script>
32
+ <%%= javascript_include_tag "application" %>
33
+
34
+ <%%= render "tracking" %>
35
+ </body>
36
+ </html>
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Installs MxM Defaults on your application. Warning. Will wipe your application.js and application.css files.
3
+
4
+ Example:
5
+ rails generate mxm:setup
@@ -0,0 +1,12 @@
1
+ module Mxm
2
+ module Generators
3
+ class SetupGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_all
7
+ invoke "mxm:assets", ["application"]
8
+ invoke "mxm:layout", ["application"]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ module Mxm
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Mxm
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/mxm/rails.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "mxm/rails/version"
2
+ require "mxm/rails/engine"
3
+
4
+ module Mxm
5
+ module Rails
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require "mxm/rails"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mxm/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mxm-boilerplate"
7
+ s.version = Mxm::Rails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Chris Bell"]
10
+ s.email = ["chris@madebymany.co.uk"]
11
+ s.homepage = "http://github.com/madebymany/mxm-boilerplate"
12
+ s.summary = %q{ Sensible front-end defaults for MxM Rails projects }
13
+ s.description = %q{}
14
+
15
+ s.rubyforge_project = "html5-rails"
16
+
17
+ s.add_dependency "railties", "~> 3.1"
18
+ s.add_dependency "thor", "~> 0.14"
19
+
20
+ s.files = `git ls-files`.split("\n")
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+ end