Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit dbe01486f7089e456d7abd33ae9bcf16a75faabb @imathis imathis committed Jan 12, 2015
Showing with 167 additions and 0 deletions.
  1. +15 −0 .gitignore
  2. +4 −0 Gemfile
  3. +22 −0 LICENSE.txt
  4. +36 −0 README.md
  5. +2 −0 Rakefile
  6. +40 −0 lib/octopress-debugger.rb
  7. +5 −0 lib/octopress-debugger/version.rb
  8. +29 −0 octopress-debugger.gemspec
  9. +2 −0 test/_config.yml
  10. +5 −0 test/_site/index.html
  11. +7 −0 test/index.html
@@ -0,0 +1,15 @@
+/.bundle/
+/.yardoc
+/Gemfile.lock
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
+*.bundle
+*.so
+*.o
+*.a
+mkmf.log
+_site
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in octopress-debugger.gemspec
+gemspec
@@ -0,0 +1,22 @@
+Copyright (c) 2015 Brandon Mathis
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,36 @@
+# Octopress Debugger
+
+A simple liquid tag for debugging Jekyll sites with a fancy debugger console.
+
+## Installation
+
+If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
+
+ group :jekyll_plugins do
+ gem 'octopress-debugger'
+ end
+
+Then install the gem with Bundler
+
+ $ bundle
+
+To install manually without bundler:
+
+ $ gem install octopress-debugger
+
+Then add the gem to your Jekyll configuration.
+
+ gems:
+ -octopress-debugger
+
+## Usage
+
+Add the `{% debug %}` tag to any page to get access to the `site` and `page` instance from the debugger console.
+
+## Contributing
+
+1. Fork it ( https://github.com/octopress/debugger/fork )
+2. Create your feature branch (`git checkout -b my-new-feature`)
+3. Commit your changes (`git commit -am 'Add some feature'`)
+4. Push to the branch (`git push origin my-new-feature`)
+5. Create a new Pull Request
@@ -0,0 +1,2 @@
+require "bundler/gem_tasks"
+
@@ -0,0 +1,40 @@
+require "octopress-debugger/version"
+require "jekyll"
+
+if RUBY_VERSION >= "2"
+ require 'pry-byebug'
+else
+ require 'pry-debugger'
+end
+
+module Octopress
+ module Debugger
+ class Tag < Liquid::Tag
+ def render(context)
+ site = context.registers[:site]
+ page_hash = context.registers[:page]
+ page = site.pages.find{|p| p.url == page_hash['url'] }
+
+ binding.pry
+ # site: site instance
+ # page_hash: page instance in hash form
+ # page: page instance
+
+ return ''
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('debug', Octopress::Debugger::Tag)
+
+if defined? Octopress::Docs
+ Octopress::Docs.add({
+ name: "Octopress Debugger",
+ gem: "octopress-debugger",
+ version: Octopress::Debugger::VERSION,
+ description: "Debug Jekyll sites with a fancy console.",
+ path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
+ source_url: "https://github.com/octopress/debugger"
+ })
+end
@@ -0,0 +1,5 @@
+module Octopress
+ module Debugger
+ VERSION = "1.0.0"
+ end
+end
@@ -0,0 +1,29 @@
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'octopress-debugger/version'
+
+Gem::Specification.new do |spec|
+ spec.name = "octopress-debugger"
+ spec.version = Octopress::Debugger::VERSION
+ spec.authors = ["Brandon Mathis"]
+ spec.email = ["brandon@imathis.com"]
+ spec.summary = %q{A debugger for Jekyll templates}
+ spec.homepage = "https://github.com/octopress/debugger"
+ spec.license = "MIT"
+
+ spec.files = `git ls-files`.split("\n").grep(%r{^(bin\/|lib\/|assets\/|changelog|readme|license)}i)
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.require_paths = ["lib"]
+
+ spec.add_runtime_dependency "jekyll"
+
+ if RUBY_VERSION >= "2"
+ spec.add_runtime_dependency "pry-byebug"
+ else
+ spec.add_runtime_dependency "pry-debugger"
+ end
+
+ spec.add_development_dependency "bundler", "~> 1.7"
+ spec.add_development_dependency "rake", "~> 10.0"
+end
@@ -0,0 +1,2 @@
+gems:
+ - octopress-debugger
@@ -0,0 +1,5 @@
+Hey Guys
+
+
+what's up?
+
@@ -0,0 +1,7 @@
+---
+info: whatever
+---
+
+Test
+{% debug %}
+This

0 comments on commit dbe0148

Please sign in to comment.