Browse files

initial

  • Loading branch information...
0 parents commit e6188a9c12583a6a049bcb93de36db747e671e1d @tdreyno tdreyno committed Aug 20, 2011
Showing with 67 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +4 −0 Gemfile
  3. +2 −0 Rakefile
  4. +25 −0 lib/middleman-remote-data.rb
  5. +5 −0 lib/middleman-remote-data/version.rb
  6. +1 −0 lib/middleman_init.rb
  7. +24 −0 middleman-remote-data.gemspec
6 .gitignore
@@ -0,0 +1,6 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
+.rvmrc
+.DS_Store
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in middleman-remote-data.gemspec
+gemspec
2 Rakefile
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
25 lib/middleman-remote-data.rb
@@ -0,0 +1,25 @@
+require "httparty"
+
+module Middleman::Features::RemoteData
+ class << self
+ def registered(app)
+ app.extend ClassMethods
+ end
+ alias :included :registered
+ end
+
+ module ClassMethods
+ # Makes HTTP json data available in the data object
+ #
+ # data_source :my_json, "http://my/file.json"
+ #
+ # Available in templates as:
+ #
+ # data.my_json
+ def data_source(name, url)
+ data_callback(name) do
+ HTTParty.get(url).parsed_response
+ end
+ end
+ end
+end
5 lib/middleman-remote-data/version.rb
@@ -0,0 +1,5 @@
+module Middleman
+ module RemoteData
+ VERSION = "0.1.0"
+ end
+end
1 lib/middleman_init.rb
@@ -0,0 +1 @@
+require "middleman-remote-data"
24 middleman-remote-data.gemspec
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "middleman-remote-data/version"
+
+Gem::Specification.new do |s|
+ s.name = "middleman-remote-data"
+ s.version = Middleman::RemoteData::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Thomas Reynolds"]
+ s.email = ["me@tdreyno.com"]
+ s.homepage = "https://github.com/tdreyno/middleman-remote-data"
+ s.summary = %q{Adds remote JSON and XML data sources to Middleman}
+ s.description = %q{Adds remote JSON and XML data sources to Middleman}
+
+ s.rubyforge_project = "middleman-remote-data"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_runtime_dependency("middleman", ["~> 2.0.4"])
+ s.add_runtime_dependency("httparty", ["~> 0.7.8"])
+end

0 comments on commit e6188a9

Please sign in to comment.