-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e6188a9
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* | ||
.rvmrc | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in middleman-remote-data.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Middleman | ||
module RemoteData | ||
VERSION = "0.1.0" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "middleman-remote-data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |