octopress-debugger 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +38 -0
- data/lib/octopress-debugger.rb +1 -3
- data/lib/octopress-debugger/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c131591fc3151c379b8e994522ae21562e2ad2e
|
4
|
+
data.tar.gz: cfdd31bb6f9f2bfc89444a8b53613ab0c0f1acb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d976963a417013811726685d5d9fd4c129202a9585d0619b9c354787689eadc90daa2932fd1ea1ad3d8de971e42199711dd8af55f1cc0b1d8df97fc70c4ea65d
|
7
|
+
data.tar.gz: dbb5ab3b0c1141e77a207941229af982d385bf4d57887b457c3ce329712810e9c0e81b9c4b60373bd7e80464f979ab857fe84dae902a925473b6093738290141
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -30,6 +30,44 @@ Then add the gem to your Jekyll configuration.
|
|
30
30
|
|
31
31
|
Add the `{% debug %}` tag to any page to get access to the `site` and `page` instance from the debugger console.
|
32
32
|
|
33
|
+
This will launch an interactive debugging console where you can do some cool things.
|
34
|
+
|
35
|
+
- Type `site` to interact with the site instance.
|
36
|
+
- Type `page` to interact with the current page instance.
|
37
|
+
- Type `page_hash` to view the page instance as a hash.
|
38
|
+
- Type `scopes` to view current template variables.
|
39
|
+
|
40
|
+
### Example:
|
41
|
+
|
42
|
+
Debugging is a great way to learn about how Jekyll works. For example, you can step through a for loop like this.
|
43
|
+
|
44
|
+
```
|
45
|
+
{% assign test='awesome' %}
|
46
|
+
{% for post in site.posts %}
|
47
|
+
{% debug %}
|
48
|
+
{% endfor %}
|
49
|
+
```
|
50
|
+
|
51
|
+
In the debugger you can type `scopes` to see a hash representing variables in the for loop. Here's a look at what you might see:
|
52
|
+
|
53
|
+
```
|
54
|
+
[
|
55
|
+
{
|
56
|
+
"post"=><Post: /2015/01/12/posts-are-cool>,
|
57
|
+
"forloop"=>{
|
58
|
+
{ "name"=>"post-site.posts", "length"=>3, "index"=>1, … }
|
59
|
+
},
|
60
|
+
{
|
61
|
+
test=>'awesome'
|
62
|
+
}
|
63
|
+
]
|
64
|
+
```
|
65
|
+
|
66
|
+
You can see the value of post and interact with the post instance with `scopes.first['post']` and even see all the available data on
|
67
|
+
the for loop.
|
68
|
+
|
69
|
+
Then you can enter `continue` or `c` to step through the loop.
|
70
|
+
|
33
71
|
## Contributing
|
34
72
|
|
35
73
|
1. Fork it ( https://github.com/octopress/debugger/fork )
|
data/lib/octopress-debugger.rb
CHANGED
@@ -14,11 +14,9 @@ module Octopress
|
|
14
14
|
site = context.registers[:site]
|
15
15
|
page_hash = context.registers[:page]
|
16
16
|
page = site.pages.find{|p| p.url == page_hash['url'] }
|
17
|
+
scopes = context.scopes
|
17
18
|
|
18
19
|
binding.pry
|
19
|
-
# site: site instance
|
20
|
-
# page_hash: page instance in hash form
|
21
|
-
# page: page instance
|
22
20
|
|
23
21
|
return ''
|
24
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octopress
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- brandon@imathis.com
|
@@ -73,6 +87,7 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- CHANGELOG.md
|
76
91
|
- LICENSE.txt
|
77
92
|
- README.md
|
78
93
|
- lib/octopress-debugger.rb
|