mountain_view 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mountain_view/prism.js +7 -5
- data/app/assets/stylesheets/mountain_view/prism.css +137 -129
- data/app/assets/stylesheets/mountain_view/styleguide.css +11 -0
- data/app/views/mountain_view/styleguide/_example.html.erb +11 -0
- data/app/views/mountain_view/styleguide/show.html.erb +39 -14
- data/lib/mountain_view/component.rb +36 -4
- data/lib/mountain_view/version.rb +1 -1
- data/test/dummy/app/components/header/header.yml +9 -7
- data/test/generators/component_generator_test.rb +4 -0
- data/test/mountain_view/component_test.rb +93 -7
- metadata +4 -13
- data/test/dummy/log/test.log +0 -2775
- data/test/tmp/app/components/widget/_widget.html.haml +0 -0
- data/test/tmp/app/components/widget/widget.coffee +0 -0
- data/test/tmp/app/components/widget/widget.scss +0 -0
- data/test/tmp/app/components/widget/widget.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48440d3d9b61479fd626bb86f549fd3420f6f7de
|
4
|
+
data.tar.gz: ae42aa4bff08fb3e264b74e65799576432386a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bd1af8db259ac3aa85718456e917516cedd9768cc5bfd278e025e69623a001d1fe5f5b22d9d0be775a61544f1196ca3d3550f3ac08d2b64d9482029108fd136
|
7
|
+
data.tar.gz: 8180bc5af346fdb2ed0c207c90aabe57d79b2cedbb188151fddc88352845df8af8656b03413a4a79a078403139631da62161382391c8e00fe2c740248ef40a64
|
@@ -1,5 +1,7 @@
|
|
1
|
-
/* http://prismjs.com/download.html?themes=prism&languages=clike+javascript+ruby */
|
2
|
-
|
3
|
-
Prism.languages.
|
4
|
-
Prism.languages.
|
5
|
-
Prism.languages.
|
1
|
+
/* http://prismjs.com/download.html?themes=prism&languages=markup+clike+javascript+ruby+yaml */
|
2
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=t.languages[l]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run("complete",u),void 0;if(t.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,g?t.tokenize(m,g):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var l={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
3
|
+
Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
|
4
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
|
5
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
|
6
|
+
!function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var n={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:n}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:n}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:n}}]}(Prism);
|
7
|
+
Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
|
@@ -5,133 +5,141 @@
|
|
5
5
|
* @author Lea Verou
|
6
6
|
*/
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
.
|
79
|
-
|
80
|
-
}
|
81
|
-
|
82
|
-
.token.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
.
|
87
|
-
.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
.token.
|
93
|
-
.token.
|
94
|
-
.token.
|
95
|
-
.token.
|
96
|
-
.token.
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
.token.
|
102
|
-
.token.
|
103
|
-
.token.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
.token.
|
111
|
-
.token.
|
112
|
-
.token.
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
.token.
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
.token.
|
131
|
-
|
132
|
-
}
|
133
|
-
|
134
|
-
.token.
|
135
|
-
|
136
|
-
|
8
|
+
/* http://prismjs.com/download.html?themes=prism&languages=markup+clike+javascript+ruby+yaml */
|
9
|
+
/**
|
10
|
+
* prism.js default theme for JavaScript, CSS and HTML
|
11
|
+
* Based on dabblet (http://dabblet.com)
|
12
|
+
* @author Lea Verou
|
13
|
+
*/
|
14
|
+
|
15
|
+
code[class*="language-"],
|
16
|
+
pre[class*="language-"] {
|
17
|
+
color: black;
|
18
|
+
text-shadow: 0 1px white;
|
19
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
20
|
+
direction: ltr;
|
21
|
+
text-align: left;
|
22
|
+
white-space: pre;
|
23
|
+
word-spacing: normal;
|
24
|
+
word-break: normal;
|
25
|
+
word-wrap: normal;
|
26
|
+
line-height: 1.5;
|
27
|
+
|
28
|
+
-moz-tab-size: 4;
|
29
|
+
-o-tab-size: 4;
|
30
|
+
tab-size: 4;
|
31
|
+
|
32
|
+
-webkit-hyphens: none;
|
33
|
+
-moz-hyphens: none;
|
34
|
+
-ms-hyphens: none;
|
35
|
+
hyphens: none;
|
36
|
+
}
|
37
|
+
|
38
|
+
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
39
|
+
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
40
|
+
text-shadow: none;
|
41
|
+
background: #b3d4fc;
|
42
|
+
}
|
43
|
+
|
44
|
+
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
45
|
+
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
46
|
+
text-shadow: none;
|
47
|
+
background: #b3d4fc;
|
48
|
+
}
|
49
|
+
|
50
|
+
@media print {
|
51
|
+
code[class*="language-"],
|
52
|
+
pre[class*="language-"] {
|
53
|
+
text-shadow: none;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
/* Code blocks */
|
58
|
+
pre[class*="language-"] {
|
59
|
+
padding: 1em;
|
60
|
+
margin: .5em 0;
|
61
|
+
overflow: auto;
|
62
|
+
}
|
63
|
+
|
64
|
+
:not(pre) > code[class*="language-"],
|
65
|
+
pre[class*="language-"] {
|
66
|
+
background: #f5f2f0;
|
67
|
+
}
|
68
|
+
|
69
|
+
/* Inline code */
|
70
|
+
:not(pre) > code[class*="language-"] {
|
71
|
+
padding: .1em;
|
72
|
+
border-radius: .3em;
|
73
|
+
}
|
74
|
+
|
75
|
+
.token.comment,
|
76
|
+
.token.prolog,
|
77
|
+
.token.doctype,
|
78
|
+
.token.cdata {
|
79
|
+
color: slategray;
|
80
|
+
}
|
81
|
+
|
82
|
+
.token.punctuation {
|
83
|
+
color: #999;
|
84
|
+
}
|
85
|
+
|
86
|
+
.namespace {
|
87
|
+
opacity: .7;
|
88
|
+
}
|
89
|
+
|
90
|
+
.token.property,
|
91
|
+
.token.tag,
|
92
|
+
.token.boolean,
|
93
|
+
.token.number,
|
94
|
+
.token.constant,
|
95
|
+
.token.symbol,
|
96
|
+
.token.deleted {
|
97
|
+
color: #905;
|
98
|
+
}
|
99
|
+
|
100
|
+
.token.selector,
|
101
|
+
.token.attr-name,
|
102
|
+
.token.string,
|
103
|
+
.token.char,
|
104
|
+
.token.builtin,
|
105
|
+
.token.inserted {
|
106
|
+
color: #690;
|
107
|
+
}
|
108
|
+
|
109
|
+
.token.operator,
|
110
|
+
.token.entity,
|
111
|
+
.token.url,
|
112
|
+
.language-css .token.string,
|
113
|
+
.style .token.string {
|
114
|
+
color: #a67f59;
|
115
|
+
background: hsla(0, 0%, 100%, .5);
|
116
|
+
}
|
117
|
+
|
118
|
+
.token.atrule,
|
119
|
+
.token.attr-value,
|
120
|
+
.token.keyword {
|
121
|
+
color: #07a;
|
122
|
+
}
|
123
|
+
|
124
|
+
.token.function {
|
125
|
+
color: #DD4A68;
|
126
|
+
}
|
127
|
+
|
128
|
+
.token.regex,
|
129
|
+
.token.important,
|
130
|
+
.token.variable {
|
131
|
+
color: #e90;
|
132
|
+
}
|
133
|
+
|
134
|
+
.token.important,
|
135
|
+
.token.bold {
|
136
|
+
font-weight: bold;
|
137
|
+
}
|
138
|
+
.token.italic {
|
139
|
+
font-style: italic;
|
140
|
+
}
|
141
|
+
|
142
|
+
.token.entity {
|
143
|
+
cursor: help;
|
144
|
+
}
|
137
145
|
|
@@ -95,6 +95,17 @@ body{
|
|
95
95
|
.mv-component__item{
|
96
96
|
}
|
97
97
|
|
98
|
+
.mv-component__meta{
|
99
|
+
padding: 25px;
|
100
|
+
margin-bottom: 20px;
|
101
|
+
background: #F7F7F7;
|
102
|
+
border: 1px solid #E4E4E4;
|
103
|
+
}
|
104
|
+
|
105
|
+
.mv-component__meta p{
|
106
|
+
color: #000;
|
107
|
+
}
|
108
|
+
|
98
109
|
.mv-component__description{
|
99
110
|
padding: 25px;
|
100
111
|
background: #F7F7F7;
|
@@ -3,21 +3,43 @@
|
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<% if @component.stubs? %>
|
6
|
-
<% @component.
|
7
|
-
|
8
|
-
<div class="mv-
|
9
|
-
|
10
|
-
</div>
|
11
|
-
<div class="mv-component__description">
|
12
|
-
<h2><%= @component.title %> <%= index + 1 %></h2>
|
13
|
-
<div class="mv-component__description__definition">
|
14
|
-
<code class="language-ruby"><%= render_component("<%= @component.name %>", {properties as below}) %></code>
|
15
|
-
</div>
|
16
|
-
<%- formatted = JSON.pretty_generate component_properties %>
|
17
|
-
<div class="mv-component__description__properties">
|
18
|
-
<code class="language-ruby"><%= formatted.gsub(/\"(\S+)?\":/, '\1:') %></code>
|
19
|
-
</div>
|
6
|
+
<% if @component.stubs_correct_format? %>
|
7
|
+
<% if @component.stubs_extra_info? %>
|
8
|
+
<div class="mv-component__meta">
|
9
|
+
<p><%= @component.stubs_extra_info %></p>
|
20
10
|
</div>
|
11
|
+
<% end %>
|
12
|
+
<% if @component.component_stubs? %>
|
13
|
+
<% @component.component_stubs.each_with_index do |component_properties, index| %>
|
14
|
+
<div class="mv-component">
|
15
|
+
<div class="mv-component__item">
|
16
|
+
<%= render_component @component.name, component_properties %>
|
17
|
+
</div>
|
18
|
+
<div class="mv-component__description">
|
19
|
+
<h2><%= @component.title %> <%= index + 1 %></h2>
|
20
|
+
<div class="mv-component__description__definition">
|
21
|
+
<code class="language-ruby"><%= render_component("<%= @component.name %>", {properties as below}) %></code>
|
22
|
+
</div>
|
23
|
+
<%- formatted = JSON.pretty_generate component_properties %>
|
24
|
+
<div class="mv-component__description__properties">
|
25
|
+
<code class="language-ruby"><%= formatted.gsub(/\"(\S+)?\":/, '\1:') %></code>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% else %>
|
32
|
+
<div class="mv-hint">
|
33
|
+
<h2><span>Hint:</span>You have Stubs but they don't follow the correct format</h2>
|
34
|
+
<ul>
|
35
|
+
<li>
|
36
|
+
You should write stub examples like this:
|
37
|
+
<br>
|
38
|
+
<div class="mv-component__description__properties">
|
39
|
+
<code class="language-yaml"><%= render 'example', component_name: @component.name %></code>
|
40
|
+
</div>
|
41
|
+
</li>
|
42
|
+
</ul>
|
21
43
|
</div>
|
22
44
|
<% end %>
|
23
45
|
<% else %>
|
@@ -28,6 +50,9 @@
|
|
28
50
|
You should write stub examples here:
|
29
51
|
<br>
|
30
52
|
<strong><%= @component.stubs_file %></strong>
|
53
|
+
<div class="mv-component__description__properties">
|
54
|
+
<code class="language-yaml"><%= render 'example', component_name: @component.name %></code>
|
55
|
+
</div>
|
31
56
|
</li>
|
32
57
|
</ul>
|
33
58
|
</div>
|
@@ -11,7 +11,21 @@ module MountainView
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def styleguide_stubs
|
14
|
-
YAML.load_file
|
14
|
+
YAML.load_file(stubs_file) || {}
|
15
|
+
rescue Errno::ENOENT
|
16
|
+
{}
|
17
|
+
end
|
18
|
+
|
19
|
+
def component_stubs
|
20
|
+
if styleguide_stubs.is_a?(Hash)
|
21
|
+
styleguide_stubs[:stubs] || {}
|
22
|
+
elsif styleguide_stubs.is_a?(Array)
|
23
|
+
styleguide_stubs
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def component_stubs?
|
28
|
+
component_stubs.any?
|
15
29
|
end
|
16
30
|
|
17
31
|
def stubs_file
|
@@ -19,9 +33,27 @@ module MountainView
|
|
19
33
|
end
|
20
34
|
|
21
35
|
def stubs?
|
22
|
-
styleguide_stubs.
|
23
|
-
|
24
|
-
|
36
|
+
styleguide_stubs.any?
|
37
|
+
end
|
38
|
+
|
39
|
+
def stubs_extra_info?
|
40
|
+
!stubs_extra_info.empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def stubs_extra_info
|
44
|
+
if styleguide_stubs.is_a?(Hash) && styleguide_stubs.key?(:meta)
|
45
|
+
styleguide_stubs[:meta]
|
46
|
+
else
|
47
|
+
{}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def stubs_correct_format?
|
52
|
+
stubs_are_a_hash_with_info? || styleguide_stubs.is_a?(Array)
|
53
|
+
end
|
54
|
+
|
55
|
+
def stubs_are_a_hash_with_info?
|
56
|
+
styleguide_stubs.is_a?(Hash) && styleguide_stubs.key?(:stubs)
|
25
57
|
end
|
26
58
|
end
|
27
59
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
:meta: 'There is this different classes'
|
2
|
+
:stubs:
|
3
|
+
-
|
4
|
+
:id: 1
|
5
|
+
:title: "20 Mountains you didn't know they even existed"
|
6
|
+
:subtitle: "Buzzfeed title"
|
7
|
+
-
|
8
|
+
:id: 2
|
9
|
+
:title: "You won't believe what happened to this man at Aspen"
|
@@ -13,6 +13,8 @@ class ComponentGeneratorTest < Rails::Generators::TestCase
|
|
13
13
|
assert_file "app/components/widget/widget.css"
|
14
14
|
assert_file "app/components/widget/widget.js"
|
15
15
|
assert_file "app/components/widget/widget.yml"
|
16
|
+
# Delete generated files so the test don't fail if the order is random
|
17
|
+
FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
|
16
18
|
end
|
17
19
|
|
18
20
|
test "Generates different engines" do
|
@@ -26,5 +28,7 @@ class ComponentGeneratorTest < Rails::Generators::TestCase
|
|
26
28
|
assert_file "app/components/widget/widget.scss"
|
27
29
|
assert_file "app/components/widget/widget.coffee"
|
28
30
|
assert_file "app/components/widget/widget.yml"
|
31
|
+
# Delete generated files so the test don't fail if the order is random
|
32
|
+
FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
|
29
33
|
end
|
30
34
|
end
|
@@ -15,15 +15,101 @@ class MountainViewComponentTest < ActiveSupport::TestCase
|
|
15
15
|
|
16
16
|
def test_styleguide_stubs
|
17
17
|
component = MountainView::Component.new("header")
|
18
|
+
expected_stub =
|
19
|
+
{
|
20
|
+
meta: "There is this different classes",
|
21
|
+
stubs:
|
22
|
+
[
|
23
|
+
{
|
24
|
+
id: 1,
|
25
|
+
title: "20 Mountains you didn't know they even existed",
|
26
|
+
subtitle: "Buzzfeed title"
|
27
|
+
},
|
28
|
+
{ id: 2,
|
29
|
+
title: "You won't believe what happened to this man at Aspen"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
18
33
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
34
|
+
assert_instance_of Hash, component.styleguide_stubs
|
35
|
+
assert_equal expected_stub, component.styleguide_stubs
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_component_stubs
|
39
|
+
component = MountainView::Component.new("header")
|
40
|
+
expected_stub =
|
41
|
+
[
|
42
|
+
{
|
43
|
+
id: 1,
|
44
|
+
title: "20 Mountains you didn't know they even existed",
|
45
|
+
subtitle: "Buzzfeed title"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
id: 2,
|
49
|
+
title: "You won't believe what happened to this man at Aspen"
|
50
|
+
}
|
51
|
+
]
|
52
|
+
assert_instance_of Array, component.component_stubs
|
53
|
+
assert_equal expected_stub, component.component_stubs
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_component_stubs?
|
57
|
+
component_with_stubs = MountainView::Component.new("header")
|
58
|
+
component_with_empty_stub_file = MountainView::Component.new("breadcrumbs")
|
59
|
+
component_without_stub_file =
|
60
|
+
MountainView::Component.new("social_media_icons")
|
61
|
+
compoenet_with_stubs_but_incorrect_format =
|
62
|
+
MountainView::Component.new("card")
|
63
|
+
assert_equal true, component_with_stubs.component_stubs?
|
64
|
+
assert_equal false, component_without_stub_file.component_stubs?
|
65
|
+
assert_equal false, component_with_empty_stub_file.component_stubs?
|
66
|
+
assert_equal true, compoenet_with_stubs_but_incorrect_format.
|
67
|
+
component_stubs?
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_stubs_extra_info
|
71
|
+
component_with_extra_info = MountainView::Component.new("header")
|
72
|
+
component_with_empty_stub_file =
|
73
|
+
MountainView::Component.new("breadcrumbs")
|
74
|
+
component_without_stub_file =
|
75
|
+
MountainView::Component.new("paragraph")
|
76
|
+
expected_extra_info_stub = "There is this different classes"
|
77
|
+
|
78
|
+
assert_equal expected_extra_info_stub, component_with_extra_info.
|
79
|
+
stubs_extra_info
|
80
|
+
assert_equal true, component_with_empty_stub_file.stubs_extra_info.empty?
|
81
|
+
assert_equal true, component_without_stub_file.stubs_extra_info.empty?
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_stubs_extra_info?
|
85
|
+
component_with_stubs = MountainView::Component.new("header")
|
86
|
+
component_with_empty_stub_file =
|
87
|
+
MountainView::Component.new("breadcrumbs")
|
88
|
+
component_without_stub_file =
|
89
|
+
MountainView::Component.new("social_media_icons")
|
90
|
+
component_with_stubs_but_no_extra_info =
|
91
|
+
MountainView::Component.new("card")
|
92
|
+
|
93
|
+
assert_equal true, component_with_stubs.stubs_extra_info?
|
94
|
+
assert_equal false, component_without_stub_file.stubs_extra_info?
|
95
|
+
assert_equal false, component_with_empty_stub_file.stubs_extra_info?
|
96
|
+
assert_equal false, component_with_stubs_but_no_extra_info.
|
97
|
+
stubs_extra_info?
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_stubs_correct_format?
|
101
|
+
component_with_correct_stubs = MountainView::Component.new("header")
|
102
|
+
component_with_empty_stub_file = MountainView::Component.new("breadcrumbs")
|
103
|
+
component_without_stub_file =
|
104
|
+
MountainView::Component.new("social_media_icons")
|
105
|
+
component_with_stubs_but_old_syntax =
|
106
|
+
MountainView::Component.new("card")
|
24
107
|
|
25
|
-
|
26
|
-
assert_equal
|
108
|
+
assert_equal true, component_with_correct_stubs.stubs_correct_format?
|
109
|
+
assert_equal false, component_without_stub_file.stubs_correct_format?
|
110
|
+
assert_equal false, component_with_empty_stub_file.stubs_correct_format?
|
111
|
+
assert_equal true, component_with_stubs_but_old_syntax.
|
112
|
+
stubs_correct_format?
|
27
113
|
end
|
28
114
|
|
29
115
|
def test_stubs_file
|