cheatset 1.2.1 → 1.2.2
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 +4 -4
- data/.gitignore +2 -1
- data/lib/cheatset/creator.rb +9 -2
- data/lib/cheatset/dsl/base.rb +17 -0
- data/lib/cheatset/dsl/category.rb +1 -0
- data/lib/cheatset/dsl/cheatsheet.rb +1 -1
- data/lib/cheatset/dsl/context.rb +2 -1
- data/lib/cheatset/dsl/entry.rb +1 -0
- data/lib/cheatset/templates/{res → cheatset_resources}/Open_Sans.woff +0 -0
- data/lib/cheatset/templates/style.css +12 -1
- data/lib/cheatset/templates/style.scss +15 -1
- data/lib/cheatset/templates/template.haml +11 -1
- data/lib/cheatset/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca0cc24cddcf9d78987370b974069d22aaa56dde
|
|
4
|
+
data.tar.gz: 0ec86bb8bad352172f30840555d225ba06206473
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 898463cb1e2e65dd9b2e6f621a203e90a6eb97e783fcf04ee7cba96a90b24b205f321b656e8d099290a179d9d855d599a128594210395944dfa892501adbe6b0
|
|
7
|
+
data.tar.gz: 25f4ae59942847c6752b5f2de490d472a83375590f02422dee821bed83f8072751a015735d68d106818d12cf6940f16c90f9566344161673ff6f0c8e66f0734e
|
data/.gitignore
CHANGED
data/lib/cheatset/creator.rb
CHANGED
|
@@ -6,8 +6,9 @@ require 'ostruct'
|
|
|
6
6
|
require 'uri'
|
|
7
7
|
|
|
8
8
|
class Cheatset::Creator
|
|
9
|
-
def initialize(cheatsheet)
|
|
9
|
+
def initialize(cheatsheet, filename)
|
|
10
10
|
@cheatsheet = cheatsheet
|
|
11
|
+
@filename = filename
|
|
11
12
|
@docset_path = "#{@cheatsheet.docset_file_name}.docset"
|
|
12
13
|
@path = "#{@docset_path}/Contents/"
|
|
13
14
|
end
|
|
@@ -39,7 +40,13 @@ class Cheatset::Creator
|
|
|
39
40
|
FileUtils.cp("#{tpl_path}/style.css", doc_path)
|
|
40
41
|
|
|
41
42
|
# resources
|
|
42
|
-
FileUtils.cp_r("#{tpl_path}/
|
|
43
|
+
FileUtils.cp_r("#{tpl_path}/cheatset_resources", doc_path)
|
|
44
|
+
resources = @cheatsheet.resources
|
|
45
|
+
if !resources.empty?
|
|
46
|
+
base_dir = File.dirname(@filename)
|
|
47
|
+
resources_path = "#{base_dir}/#{resources}"
|
|
48
|
+
FileUtils.cp_r(resources_path, doc_path)
|
|
49
|
+
end
|
|
43
50
|
end
|
|
44
51
|
|
|
45
52
|
def generate_plist_file
|
data/lib/cheatset/dsl/base.rb
CHANGED
|
@@ -45,6 +45,23 @@ module Cheatset
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
+
def self.define_markdown_list_attrs(*names)
|
|
49
|
+
names.each do |name|
|
|
50
|
+
define_method(name) do |val = nil|
|
|
51
|
+
if val
|
|
52
|
+
val = val.unindent
|
|
53
|
+
val = parse_markdown(val)
|
|
54
|
+
array = instance_variable_get("@#{name}")
|
|
55
|
+
if !array
|
|
56
|
+
instance_variable_set("@#{name}", [val])
|
|
57
|
+
else
|
|
58
|
+
instance_variable_set("@#{name}", array << val)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
instance_variable_get("@#{name}")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
48
65
|
def self.define_markdown_attrs(*names)
|
|
49
66
|
names.each do |name|
|
|
50
67
|
define_method(name) do |val = nil|
|
|
@@ -2,7 +2,7 @@ module Cheatset
|
|
|
2
2
|
module DSL
|
|
3
3
|
class Cheatsheet < Base
|
|
4
4
|
attr_reader :categories
|
|
5
|
-
define_attrs :title, :docset_file_name, :keyword, :source_url, :platform, :style
|
|
5
|
+
define_attrs :title, :docset_file_name, :keyword, :source_url, :platform, :style, :resources
|
|
6
6
|
define_markdown_attrs :introduction, :notes
|
|
7
7
|
|
|
8
8
|
def initialize(&block)
|
data/lib/cheatset/dsl/context.rb
CHANGED
data/lib/cheatset/dsl/entry.rb
CHANGED
|
File without changes
|
|
@@ -6,7 +6,7 @@ h1, h2, h3, p, blockquote {
|
|
|
6
6
|
font-family: 'Open Sans';
|
|
7
7
|
font-style: normal;
|
|
8
8
|
font-weight: 400;
|
|
9
|
-
src: local("Open Sans"), local("OpenSans"), url(
|
|
9
|
+
src: local("Open Sans"), local("OpenSans"), url(cheatset_resources/Open_Sans.woff) format("woff"); }
|
|
10
10
|
body {
|
|
11
11
|
font-family: 'Open Sans', sans-serif;
|
|
12
12
|
font-size: 14px;
|
|
@@ -95,12 +95,23 @@ td.td_command {
|
|
|
95
95
|
text-align: center;
|
|
96
96
|
border-right: 1px solid #666666; }
|
|
97
97
|
|
|
98
|
+
td.td_notes {
|
|
99
|
+
border-left: 1px solid #666666; }
|
|
100
|
+
|
|
98
101
|
td.description .name {
|
|
99
102
|
font-size: 1.2em; }
|
|
100
103
|
|
|
101
104
|
tr:nth-child(even) {
|
|
102
105
|
background: #efefef; }
|
|
103
106
|
|
|
107
|
+
th {
|
|
108
|
+
padding: 5px 2px 5px 8px;
|
|
109
|
+
text-align: left;
|
|
110
|
+
border-left: 1px solid #666666; }
|
|
111
|
+
|
|
112
|
+
th:nth-child(1) {
|
|
113
|
+
border: none; }
|
|
114
|
+
|
|
104
115
|
a {
|
|
105
116
|
color: #666666; }
|
|
106
117
|
|
|
@@ -11,7 +11,7 @@ h1, h2, h3, p, blockquote {
|
|
|
11
11
|
font-family: 'Open Sans';
|
|
12
12
|
font-style: normal;
|
|
13
13
|
font-weight: 400;
|
|
14
|
-
src: local('Open Sans'), local('OpenSans'), url(
|
|
14
|
+
src: local('Open Sans'), local('OpenSans'), url(cheatset_resources/Open_Sans.woff) format('woff');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
body {
|
|
@@ -121,6 +121,10 @@ td.td_command {
|
|
|
121
121
|
border-right: 1px solid $dark_gray;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
td.td_notes {
|
|
125
|
+
border-left: 1px solid $dark_gray;
|
|
126
|
+
}
|
|
127
|
+
|
|
124
128
|
td.description {
|
|
125
129
|
.name {
|
|
126
130
|
font-size: 1.2em;
|
|
@@ -130,6 +134,16 @@ tr:nth-child(even) {
|
|
|
130
134
|
background: $light_gray;
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
th {
|
|
138
|
+
padding:5px 2px 5px 8px;
|
|
139
|
+
text-align: left;
|
|
140
|
+
border-left: 1px solid $dark_gray;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
th:nth-child(1) {
|
|
144
|
+
border:none;
|
|
145
|
+
}
|
|
146
|
+
|
|
133
147
|
a {
|
|
134
148
|
color: $dark_gray;
|
|
135
149
|
}
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
%h2{id:"//dash_ref/Category/#{category.id.strip.gsub(/\//, '%2F')}/1"}
|
|
31
31
|
= category.id
|
|
32
32
|
%table
|
|
33
|
+
- if category.header
|
|
34
|
+
%tr
|
|
35
|
+
- category.header.each do |header|
|
|
36
|
+
%th~ header
|
|
37
|
+
|
|
33
38
|
- category.entries.each_with_index do |entry, index|
|
|
34
39
|
%tr{id: ("//dash_ref_#{category.id.strip.gsub(/\//, '%2F')}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0" if entry.name)}
|
|
35
40
|
- if entry.command
|
|
@@ -42,9 +47,14 @@
|
|
|
42
47
|
%td.td_command
|
|
43
48
|
- if !command.empty?
|
|
44
49
|
%code= CGI.escapeHTML(command)
|
|
45
|
-
%td.description{:colspan => ("2" unless entry.command || entry.td_command)}
|
|
50
|
+
%td.description{:colspan => ("2" unless entry.command || entry.td_command || entry.td_notes)}
|
|
46
51
|
.name~ entry.name
|
|
47
52
|
.notes~ entry.notes
|
|
53
|
+
- if entry.td_notes
|
|
54
|
+
- entry.td_notes.each do |notes|
|
|
55
|
+
%td.td_notes
|
|
56
|
+
- if !notes.empty?
|
|
57
|
+
.td_notes~ notes
|
|
48
58
|
- if notes
|
|
49
59
|
%section.notes
|
|
50
60
|
%h2 Notes
|
data/lib/cheatset/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cheatset
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bogdan Popescu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-03-
|
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -173,7 +173,7 @@ files:
|
|
|
173
173
|
- lib/cheatset/dsl/context.rb
|
|
174
174
|
- lib/cheatset/dsl/entry.rb
|
|
175
175
|
- lib/cheatset/templates/.sass-cache/c0630dfea9543a0a71b68aca4887e98819b89684/style.scssc
|
|
176
|
-
- lib/cheatset/templates/
|
|
176
|
+
- lib/cheatset/templates/cheatset_resources/Open_Sans.woff
|
|
177
177
|
- lib/cheatset/templates/style.css
|
|
178
178
|
- lib/cheatset/templates/style.scss
|
|
179
179
|
- lib/cheatset/templates/template.haml
|