russpeeddev 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5490b3102fee15a4831022ddd0d2df59817d2b42
4
- data.tar.gz: 4cd404d9676630c0b77baa6e246b1a20239741db
3
+ metadata.gz: 896433a33c0fd25c7e4bca8c02a304490a713dd7
4
+ data.tar.gz: 70c5d29b35e61b1fdef63f58349d08c368ab8ec7
5
5
  SHA512:
6
- metadata.gz: 3339dc1ba6ad711fd9e245e45a541b51ae1f411ec17cceb76821d95aadac97cd4b3330290d66de4df344570fd049f60bc31bc43c7f7c72c53fc034ff7b674fc0
7
- data.tar.gz: 85cb3f93efe3762a94a9b71bf4090a05bf3521fad64b48a07adfc6acdfd6907f35db45cbb14c77810ac2f4d3aa4f6efb881e17a4dfd0ad033eec4109c79af443
6
+ metadata.gz: 7853ee6a065ddf27524ce1eae1348e96dfcae4b012792b0b1ada1e64c58f1b2d8ec599a9849239dcf55cd2a63a1b0803860dfc1151baff3484ec932f3e79d99d
7
+ data.tar.gz: 78ddfac43e25b2768ef311c4cd322176e6f633dff5ed0ffc2c08c864a73c1c99a9cdb95447af6f4bc8d3d53ee11e9f7e143c92bbc65044d5f3079a73866d80b1
data/CHANGELOG.MD CHANGED
@@ -1,6 +1,13 @@
1
1
 
2
2
  # Русский
3
3
 
4
+ ## v0.0.5
5
+ * Убраны гемы: slim, tilt
6
+ * Добавлен инициализатор slim.rb
7
+ * Bootstrap теперь без версии. Шаблон http://getbootstrap.com/examples/sticky-footer-navbar/
8
+ * Добавлены методы в ApplicationHelper
9
+
10
+
4
11
  ## v0.0.4
5
12
 
6
13
  * Добавлен код в custom.css.scss
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Генерирует куски кода для быстрого старта разработки нового приложения (russian edition).
4
4
 
5
- При создании использовался rails 4.0.0.rc1.
5
+ Версия 0.0.5 для rails 4.1.6
6
6
 
7
7
  ## Что это такое?
8
8
 
@@ -19,15 +19,18 @@
19
19
  * config.time_zone = 'Moscow'
20
20
  * config.active_record.default_timezone = :local
21
21
  * config.i18n.default_locale = :ru
22
- * Используется шаблон Sticky footer with fixed navbar (http://twitter.github.io/bootstrap/examples/sticky-footer-navbar.html)
22
+ * Используется шаблон Sticky footer with fixed navbar (http://getbootstrap.com/examples/sticky-footer-navbar)
23
23
 
24
24
  ### Список гемов
25
+
25
26
  * gem 'russian'
26
- * gem 'slim', '~> 1.3.8'
27
- * gem 'slim-rails', '~> 1.1.1'
28
- * gem 'tilt', '~> 1.3.7'
27
+ * gem 'slim-rails'
28
+ * gem 'rails_best_practices', group: :development, require: false
29
29
  * gem 'kaminari'
30
30
  * gem 'bootstrap-sass'
31
+ * gem 'simple_form'
32
+ * gem 'jquery-turbolinks'
33
+
31
34
 
32
35
  #### группа тест:
33
36
 
@@ -41,6 +44,7 @@
41
44
  * gem 'quiet_assets'
42
45
 
43
46
  #### гемы в комментариях:
47
+ * gem 'tilt', '~> 1.3.7'
44
48
  * gem 'thinking-sphinx'
45
49
  * gem 'delayed_job_active_record'
46
50
  * gem 'devise'
@@ -53,7 +57,11 @@
53
57
 
54
58
  Добавить строку в Gemfile:
55
59
 
56
- gem 'russpeeddev'
60
+ gem 'russpeeddev', github: 'vasche/russpeeddev', branch: 'master'
61
+
62
+ или
63
+
64
+ gem 'russpeeddev', git: 'https://github.com/vasche/russpeeddev.git', branch: 'master'
57
65
 
58
66
  Затем выполнить:
59
67
 
@@ -65,13 +73,10 @@
65
73
 
66
74
  ## Использование
67
75
 
68
- Создать новое приложение, установить этот гем в Gemfile (выполнить bundle) , выполнить команду:
76
+ Создать новое приложение, прописать этот гем в Gemfile (выполнить bundle) , выполнить команду:
69
77
 
70
78
  $ rails g russpeeddev
71
79
 
72
- ## Баги rails 4.0.0.rc1
73
-
74
- Есть проблема с зависимостями slim-rails, slim и tilt 1.4.0. Решается запуском bundle update и повторной генерацией russpeeddev
75
80
 
76
81
 
77
82
  ## Contributing
@@ -16,29 +16,29 @@ module Russpeeddev
16
16
  # uncomment what you need
17
17
  #-------------------------------
18
18
  gem 'russian'
19
- gem 'slim', '~> 1.3.8'
20
- gem 'slim-rails', '~> 1.1.1'
21
- gem 'tilt', '~> 1.3.7'
19
+ gem 'slim-rails'
22
20
  gem 'kaminari'
23
21
  gem 'bootstrap-sass'
24
- #gem 'thinking-sphinx'
25
- #gem 'delayed_job_active_record'
26
- #gem 'devise'
27
- #gem 'devise-russian', '~> 2.0.1.1'
28
- #gem 'activeadmin'
29
- #gem 'meta_search', '>= 1.1.0.pre'
22
+ gem 'simple_form'
23
+ gem 'jquery-turbolinks'
24
+ gem 'auto_strip_attributes', '~> 2.0'
30
25
 
31
- group :test do
32
- gem 'rspec-rails'
33
- gem 'webrat'
34
- gem 'factory_girl_rails'
35
- end
26
+ # gem 'thinking-sphinx'
27
+ # gem 'delayed_job_active_record'
28
+ # gem 'devise'
29
+ # gem 'devise-russian', '~> 2.0.1.1'
30
+ # gem 'activeadmin'
31
+ # gem 'meta_search', '>= 1.1.0.pre'
32
+ # gem 'tilt', '~> 1.3.7'
33
+ # gem 'carrierwave'
34
+ # gem 'mini_magick'
35
+ # gem 'awesome_nested_fields'
36
36
 
37
- group :development do
38
- gem 'rspec-rails'
39
- gem 'quiet_assets' #hide logs
40
- #gem 'rails_best_practices'
41
- end
37
+ gem 'rspec-rails', group: [:development, :test]
38
+ gem 'webrat', group: :test
39
+ gem 'factory_girl_rails', group: :test
40
+ gem 'quiet_assets', group: :development #hide logs
41
+ gem 'rails_best_practices', group: :development, require: false
42
42
 
43
43
  #-------------------------------
44
44
  # End gem russpeeddev.
@@ -56,12 +56,12 @@ end
56
56
  end
57
57
 
58
58
  def add_root_to_routes
59
- insert_into_file "config/routes.rb" , after: "#{Rails.application.class.parent_name}::Application.routes.draw do" do
59
+ insert_into_file "config/routes.rb" , after: "Rails.application.routes.draw do" do
60
60
  "\n root 'pages#index'\n get 'about' => 'pages#about'\n get 'contact' => 'pages#contact'"
61
61
  end
62
- comment_lines 'config/routes.rb', 'get "pages/index"'
63
- comment_lines 'config/routes.rb', 'get "pages/about"'
64
- comment_lines 'config/routes.rb', 'get "pages/contact"'
62
+ comment_lines 'config/routes.rb', "get 'pages/index'"
63
+ comment_lines 'config/routes.rb', "get 'pages/about'"
64
+ comment_lines 'config/routes.rb', "get 'pages/contact'"
65
65
  end
66
66
 
67
67
  def create_custom_css_scss
@@ -84,9 +84,6 @@ end
84
84
  template "application.html.slim", "app/views/layouts/application.html.slim"
85
85
  end
86
86
 
87
- def remove_old_version_files
88
- remove_file 'app/views/shared/_outdate.html'
89
- end
90
87
 
91
88
  def edit_application_rb
92
89
  insert_into_file "config/application.rb" , after: "# config.i18n.default_locale = :de" do
@@ -96,6 +93,14 @@ end
96
93
  "\n config.time_zone = 'Moscow'\n config.active_record.default_timezone = :local\n"
97
94
  end
98
95
  end
96
+ #0.0.5
97
+ def copy_slim_rb_to_initializers
98
+ template "slim.rb", "config/initializers/slim.rb"
99
+ remove_file "app/assets/javascripts/application.js"
100
+ template "application.js", "app/assets/javascripts/application.js"
101
+ template "html5shiv.min.js", "lib/assets/html5shiv.min.js"
102
+ template "respond.js", "lib/assets/respond.js"
103
+ end
99
104
 
100
105
  end
101
106
  end
@@ -1,3 +1,4 @@
1
1
  .container
2
2
  .copyright
3
- |© Company #{Time.now.year} #{mail_to 'info@changedomainhere.ru'} | #{link_to 'bootstrap', 'http://twitter.github.io/bootstrap'}
3
+ |© Company #{year} - #{author} - #{mail_to 'info@changedomainhere.ru'} | #{link_to 'bootstrap', 'http://getbootstrap.com/'}
4
+ p.text-muted Place sticky footer content here.
@@ -1,13 +1,14 @@
1
- .navbar.navbar-inverse.navbar-fixed-top
2
- .navbar-inner
3
- .container
4
- button.btn.btn-navbar type="button" data-toggle="collapse" data-target=".nav-collapse"
1
+ .navbar.navbar-default.navbar-fixed-top@navigation
2
+ .container
3
+ .navbar-header
4
+ button.navbar-toggle.collapsed type="button" data-toggle="collapse" data-target=".navbar-collapse"
5
+ span.sr-only Toggle navigation
5
6
  span.icon-bar
6
7
  span.icon-bar
7
8
  span.icon-bar
8
- =link_to "RusSpeedDev", root_url, class: 'brand'
9
- .nav-collapse.collapse
10
- ul.nav
11
- li.main-link =link_to "Главная", root_url
12
- li.main-link =link_to "О нас", about_url
13
- li.main-link =link_to "Контакты", contact_url
9
+ =link_to "RusSpeedDev", root_path, class: 'navbar-brand'
10
+ .collapse.navbar-collapse
11
+ ul.nav.navbar-nav
12
+ li.main-link =link_to "Главная", root_path
13
+ li.main-link =link_to "О нас", about_path
14
+ li.main-link =link_to "Контакты", contact_path
@@ -3,19 +3,23 @@ doctype html
3
3
  html
4
4
  head
5
5
  title = title
6
- = stylesheet_link_tag "application", media: "all"
6
+ = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
7
7
  = csrf_meta_tags
8
8
  = render 'shared/meta'
9
+ /! HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
10
+ /[if lt IE 9]
11
+ =javascript_include_tag "/assets/html5shiv.min.js", "data-turbolinks-track" => true
12
+ =javascript_include_tag "/assets/respond.min.js", "data-turbolinks-track" => true
9
13
 
10
14
  body *{class: controller.controller_name}
11
15
  =render 'shared/outdate'
12
- #wrap
13
- header
14
- = render 'shared/mainmenu'
15
- .container
16
- = yield
17
- #push
18
- footer#footer
16
+ header
17
+ = render 'shared/mainmenu'
18
+ .container
19
+ .page-header
20
+ h1 Sticky footer with fixed navbar
21
+ = yield
22
+ footer#footer.footer
19
23
  =render 'shared/footer'
20
24
  /!javascript include here
21
- =javascript_include_tag "application"
25
+ =javascript_include_tag "application", "data-turbolinks-track" => true
@@ -0,0 +1,18 @@
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
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery.turbolinks
15
+ //= require jquery_ujs
16
+ //= require turbolinks
17
+ //= require bootstrap
18
+ // require_tree .
@@ -9,4 +9,16 @@ module ApplicationHelper
9
9
  "#{base_title} | #{@title}"
10
10
  end
11
11
  end
12
+
13
+ def year
14
+ Time.now.year
15
+ end
16
+
17
+ def cp(path)
18
+ "active" if request.url.include?(path)
19
+ end
20
+
21
+ def author
22
+ "Vasche"
23
+ end
12
24
  end
@@ -1,44 +1,41 @@
1
1
  @import "bootstrap";
2
- @import "bootstrap-responsive";
3
-
4
2
 
5
3
  /* Sticky footer styles
6
4
  -------------------------------------------------- */
7
-
8
- html,
5
+ html {
6
+ position: relative;
7
+ min-height: 100%;
8
+ }
9
9
  body {
10
- height: 100%;
11
- /* The html and body elements cannot have any padding or margin. */
10
+ /* Margin bottom by footer height */
11
+ margin-bottom: 100px;
12
12
  }
13
-
14
- /* Wrapper for page content to push down footer */
15
- #wrap {
16
- min-height: 100%;
17
- height: auto !important;
18
- height: 100%;
19
- /* Negative indent footer by it's height */
20
- margin: 0 auto -60px;
13
+ .footer {
14
+ position: absolute;
15
+ bottom: 0;
16
+ width: 100%;
17
+ /* Set the fixed height of the footer here */
18
+ height: 100px;
19
+ background-color: #f5f5f5;
21
20
  }
22
21
 
23
- /* Set the fixed height of the footer here */
24
- #push,
25
- #footer {
26
- height: 60px;
22
+
23
+ /* Custom page CSS
24
+ -------------------------------------------------- */
25
+ /* Not required for template or sticky footer method. */
26
+
27
+ body > .container {
28
+ padding: 60px 15px 0;
27
29
  }
28
- #footer {
29
- background-color: #f5f5f5;
30
+ .container .text-muted {
31
+ margin: 20px 0;
30
32
  }
31
33
 
32
- /* Lastly, apply responsive CSS fixes as necessary */
33
- @media (max-width: 767px) {
34
- #footer {
35
- margin-left: -20px;
36
- margin-right: -20px;
37
- padding-left: 20px;
38
- padding-right: 20px;
39
- }
34
+ .footer > .container {
35
+ padding-right: 15px;
36
+ padding-left: 15px;
40
37
  }
41
38
 
42
- #wrap > .container {
43
- padding-top: 60px;
39
+ code {
40
+ font-size: 80%;
44
41
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3
+ */
4
+ !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
@@ -0,0 +1,353 @@
1
+ /* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
2
+ (function( w ){
3
+
4
+ "use strict";
5
+
6
+ //exposed namespace
7
+ var respond = {};
8
+ w.respond = respond;
9
+
10
+ //define update even in native-mq-supporting browsers, to avoid errors
11
+ respond.update = function(){};
12
+
13
+ //define ajax obj
14
+ var requestQueue = [],
15
+ xmlHttp = (function() {
16
+ var xmlhttpmethod = false;
17
+ try {
18
+ xmlhttpmethod = new w.XMLHttpRequest();
19
+ }
20
+ catch( e ){
21
+ xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" );
22
+ }
23
+ return function(){
24
+ return xmlhttpmethod;
25
+ };
26
+ })(),
27
+
28
+ //tweaked Ajax functions from Quirksmode
29
+ ajax = function( url, callback ) {
30
+ var req = xmlHttp();
31
+ if (!req){
32
+ return;
33
+ }
34
+ req.open( "GET", url, true );
35
+ req.onreadystatechange = function () {
36
+ if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){
37
+ return;
38
+ }
39
+ callback( req.responseText );
40
+ };
41
+ if ( req.readyState === 4 ){
42
+ return;
43
+ }
44
+ req.send( null );
45
+ },
46
+ isUnsupportedMediaQuery = function( query ) {
47
+ return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other );
48
+ };
49
+
50
+ //expose for testing
51
+ respond.ajax = ajax;
52
+ respond.queue = requestQueue;
53
+ respond.unsupportedmq = isUnsupportedMediaQuery;
54
+ respond.regex = {
55
+ media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
56
+ keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
57
+ comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
58
+ urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
59
+ findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
60
+ only: /(only\s+)?([a-zA-Z]+)\s?/,
61
+ minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
62
+ maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
63
+ minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
64
+ other: /\([^\)]*\)/g
65
+ };
66
+
67
+ //expose media query support flag for external use
68
+ respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches;
69
+
70
+ //if media queries are supported, exit here
71
+ if( respond.mediaQueriesSupported ){
72
+ return;
73
+ }
74
+
75
+ //define vars
76
+ var doc = w.document,
77
+ docElem = doc.documentElement,
78
+ mediastyles = [],
79
+ rules = [],
80
+ appendedEls = [],
81
+ parsedSheets = {},
82
+ resizeThrottle = 30,
83
+ head = doc.getElementsByTagName( "head" )[0] || docElem,
84
+ base = doc.getElementsByTagName( "base" )[0],
85
+ links = head.getElementsByTagName( "link" ),
86
+
87
+ lastCall,
88
+ resizeDefer,
89
+
90
+ //cached container for 1em value, populated the first time it's needed
91
+ eminpx,
92
+
93
+ // returns the value of 1em in pixels
94
+ getEmValue = function() {
95
+ var ret,
96
+ div = doc.createElement('div'),
97
+ body = doc.body,
98
+ originalHTMLFontSize = docElem.style.fontSize,
99
+ originalBodyFontSize = body && body.style.fontSize,
100
+ fakeUsed = false;
101
+
102
+ div.style.cssText = "position:absolute;font-size:1em;width:1em";
103
+
104
+ if( !body ){
105
+ body = fakeUsed = doc.createElement( "body" );
106
+ body.style.background = "none";
107
+ }
108
+
109
+ // 1em in a media query is the value of the default font size of the browser
110
+ // reset docElem and body to ensure the correct value is returned
111
+ docElem.style.fontSize = "100%";
112
+ body.style.fontSize = "100%";
113
+
114
+ body.appendChild( div );
115
+
116
+ if( fakeUsed ){
117
+ docElem.insertBefore( body, docElem.firstChild );
118
+ }
119
+
120
+ ret = div.offsetWidth;
121
+
122
+ if( fakeUsed ){
123
+ docElem.removeChild( body );
124
+ }
125
+ else {
126
+ body.removeChild( div );
127
+ }
128
+
129
+ // restore the original values
130
+ docElem.style.fontSize = originalHTMLFontSize;
131
+ if( originalBodyFontSize ) {
132
+ body.style.fontSize = originalBodyFontSize;
133
+ }
134
+
135
+
136
+ //also update eminpx before returning
137
+ ret = eminpx = parseFloat(ret);
138
+
139
+ return ret;
140
+ },
141
+
142
+ //enable/disable styles
143
+ applyMedia = function( fromResize ){
144
+ var name = "clientWidth",
145
+ docElemProp = docElem[ name ],
146
+ currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
147
+ styleBlocks = {},
148
+ lastLink = links[ links.length-1 ],
149
+ now = (new Date()).getTime();
150
+
151
+ //throttle resize calls
152
+ if( fromResize && lastCall && now - lastCall < resizeThrottle ){
153
+ w.clearTimeout( resizeDefer );
154
+ resizeDefer = w.setTimeout( applyMedia, resizeThrottle );
155
+ return;
156
+ }
157
+ else {
158
+ lastCall = now;
159
+ }
160
+
161
+ for( var i in mediastyles ){
162
+ if( mediastyles.hasOwnProperty( i ) ){
163
+ var thisstyle = mediastyles[ i ],
164
+ min = thisstyle.minw,
165
+ max = thisstyle.maxw,
166
+ minnull = min === null,
167
+ maxnull = max === null,
168
+ em = "em";
169
+
170
+ if( !!min ){
171
+ min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
172
+ }
173
+ if( !!max ){
174
+ max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
175
+ }
176
+
177
+ // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
178
+ if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
179
+ if( !styleBlocks[ thisstyle.media ] ){
180
+ styleBlocks[ thisstyle.media ] = [];
181
+ }
182
+ styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
183
+ }
184
+ }
185
+ }
186
+
187
+ //remove any existing respond style element(s)
188
+ for( var j in appendedEls ){
189
+ if( appendedEls.hasOwnProperty( j ) ){
190
+ if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){
191
+ head.removeChild( appendedEls[ j ] );
192
+ }
193
+ }
194
+ }
195
+ appendedEls.length = 0;
196
+
197
+ //inject active styles, grouped by media type
198
+ for( var k in styleBlocks ){
199
+ if( styleBlocks.hasOwnProperty( k ) ){
200
+ var ss = doc.createElement( "style" ),
201
+ css = styleBlocks[ k ].join( "\n" );
202
+
203
+ ss.type = "text/css";
204
+ ss.media = k;
205
+
206
+ //originally, ss was appended to a documentFragment and sheets were appended in bulk.
207
+ //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
208
+ head.insertBefore( ss, lastLink.nextSibling );
209
+
210
+ if ( ss.styleSheet ){
211
+ ss.styleSheet.cssText = css;
212
+ }
213
+ else {
214
+ ss.appendChild( doc.createTextNode( css ) );
215
+ }
216
+
217
+ //push to appendedEls to track for later removal
218
+ appendedEls.push( ss );
219
+ }
220
+ }
221
+ },
222
+ //find media blocks in css text, convert to style blocks
223
+ translate = function( styles, href, media ){
224
+ var qs = styles.replace( respond.regex.comments, '' )
225
+ .replace( respond.regex.keyframes, '' )
226
+ .match( respond.regex.media ),
227
+ ql = qs && qs.length || 0;
228
+
229
+ //try to get CSS path
230
+ href = href.substring( 0, href.lastIndexOf( "/" ) );
231
+
232
+ var repUrls = function( css ){
233
+ return css.replace( respond.regex.urls, "$1" + href + "$2$3" );
234
+ },
235
+ useMedia = !ql && media;
236
+
237
+ //if path exists, tack on trailing slash
238
+ if( href.length ){ href += "/"; }
239
+
240
+ //if no internal queries exist, but media attr does, use that
241
+ //note: this currently lacks support for situations where a media attr is specified on a link AND
242
+ //its associated stylesheet has internal CSS media queries.
243
+ //In those cases, the media attribute will currently be ignored.
244
+ if( useMedia ){
245
+ ql = 1;
246
+ }
247
+
248
+ for( var i = 0; i < ql; i++ ){
249
+ var fullq, thisq, eachq, eql;
250
+
251
+ //media attr
252
+ if( useMedia ){
253
+ fullq = media;
254
+ rules.push( repUrls( styles ) );
255
+ }
256
+ //parse for styles
257
+ else{
258
+ fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1;
259
+ rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
260
+ }
261
+
262
+ eachq = fullq.split( "," );
263
+ eql = eachq.length;
264
+
265
+ for( var j = 0; j < eql; j++ ){
266
+ thisq = eachq[ j ];
267
+
268
+ if( isUnsupportedMediaQuery( thisq ) ) {
269
+ continue;
270
+ }
271
+
272
+ mediastyles.push( {
273
+ media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all",
274
+ rules : rules.length - 1,
275
+ hasquery : thisq.indexOf("(") > -1,
276
+ minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
277
+ maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
278
+ } );
279
+ }
280
+ }
281
+
282
+ applyMedia();
283
+ },
284
+
285
+ //recurse through request queue, get css text
286
+ makeRequests = function(){
287
+ if( requestQueue.length ){
288
+ var thisRequest = requestQueue.shift();
289
+
290
+ ajax( thisRequest.href, function( styles ){
291
+ translate( styles, thisRequest.href, thisRequest.media );
292
+ parsedSheets[ thisRequest.href ] = true;
293
+
294
+ // by wrapping recursive function call in setTimeout
295
+ // we prevent "Stack overflow" error in IE7
296
+ w.setTimeout(function(){ makeRequests(); },0);
297
+ } );
298
+ }
299
+ },
300
+
301
+ //loop stylesheets, send text content to translate
302
+ ripCSS = function(){
303
+
304
+ for( var i = 0; i < links.length; i++ ){
305
+ var sheet = links[ i ],
306
+ href = sheet.href,
307
+ media = sheet.media,
308
+ isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
309
+
310
+ //only links plz and prevent re-parsing
311
+ if( !!href && isCSS && !parsedSheets[ href ] ){
312
+ // selectivizr exposes css through the rawCssText expando
313
+ if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
314
+ translate( sheet.styleSheet.rawCssText, href, media );
315
+ parsedSheets[ href ] = true;
316
+ } else {
317
+ if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) ||
318
+ href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){
319
+ // IE7 doesn't handle urls that start with '//' for ajax request
320
+ // manually add in the protocol
321
+ if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; }
322
+ requestQueue.push( {
323
+ href: href,
324
+ media: media
325
+ } );
326
+ }
327
+ }
328
+ }
329
+ }
330
+ makeRequests();
331
+ };
332
+
333
+ //translate CSS
334
+ ripCSS();
335
+
336
+ //expose update for re-running respond later on
337
+ respond.update = ripCSS;
338
+
339
+ //expose getEmValue
340
+ respond.getEmValue = getEmValue;
341
+
342
+ //adjust on resize
343
+ function callMedia(){
344
+ applyMedia( true );
345
+ }
346
+
347
+ if( w.addEventListener ){
348
+ w.addEventListener( "resize", callMedia, false );
349
+ }
350
+ else if( w.attachEvent ){
351
+ w.attachEvent( "onresize", callMedia );
352
+ }
353
+ })(this);
@@ -0,0 +1 @@
1
+ Slim::Engine.set_default_options :shortcut => {'@' => {:attr => 'role'}, '#' => {:attr => 'id'}, '.' => {:attr => 'class'}}
@@ -2,7 +2,7 @@
2
2
  module Russpeeddev
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
  PRE = nil
7
7
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  end
data/russpeeddev.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
+ # spec.files = ["lib/russpeeddev.rb"]
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: russpeeddev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - vasche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Add shared layou teplates to speed up development new application
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - CHANGELOG.MD
50
50
  - Gemfile
51
51
  - LICENSE.txt
@@ -59,8 +59,12 @@ files:
59
59
  - lib/generators/russpeeddev/templates/_nojs.html
60
60
  - lib/generators/russpeeddev/templates/_outdate.html.slim
61
61
  - lib/generators/russpeeddev/templates/application.html.slim
62
+ - lib/generators/russpeeddev/templates/application.js
62
63
  - lib/generators/russpeeddev/templates/application_helper.rb
63
64
  - lib/generators/russpeeddev/templates/custom.css.scss
65
+ - lib/generators/russpeeddev/templates/html5shiv.min.js
66
+ - lib/generators/russpeeddev/templates/respond.js
67
+ - lib/generators/russpeeddev/templates/slim.rb
64
68
  - lib/russpeeddev.rb
65
69
  - lib/russpeeddev/version.rb
66
70
  - russpeeddev.gemspec
@@ -74,17 +78,17 @@ require_paths:
74
78
  - lib
75
79
  required_ruby_version: !ruby/object:Gem::Requirement
76
80
  requirements:
77
- - - '>='
81
+ - - ">="
78
82
  - !ruby/object:Gem::Version
79
83
  version: '0'
80
84
  required_rubygems_version: !ruby/object:Gem::Requirement
81
85
  requirements:
82
- - - '>='
86
+ - - ">="
83
87
  - !ruby/object:Gem::Version
84
88
  version: '0'
85
89
  requirements: []
86
90
  rubyforge_project: russpeeddev
87
- rubygems_version: 2.0.3
91
+ rubygems_version: 2.0.14
88
92
  signing_key:
89
93
  specification_version: 4
90
94
  summary: Add shared layou teplates to speed up development new application