curldown 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/curldown.rb +23 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd34990555dba2ca9080852dd6dd644f4e5a670c
|
4
|
+
data.tar.gz: c4238ccb846010581dee8d52550bd73adf7e722e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 07471912c8c6eb2bd465135c53631c9a8f70c1e8ac86ccc5ec51b6bd109ff5212c72e7fca663b6b54e261804ed0696046a9454f81306d4b54293e94f218846ed
|
7
|
+
data.tar.gz: 0d98440e0b0216a2812d1e187e6f269d8f9168bb9d108df4f75e726df04490be6e8c30c2f04181e03c96f243cd53113ea006812f86da14640ae1ae88bd83c656
|
data/lib/curldown.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
['curb','kramdown'].each do |gem| require gem end
|
2
|
+
class Curldown
|
3
|
+
# attr_accessor :options
|
4
|
+
def initialize
|
5
|
+
@options = {:user => nil, :repo => nil, :branch => "master", :file => "readme.md", :url => nil}
|
6
|
+
end
|
7
|
+
def options
|
8
|
+
@options
|
9
|
+
end
|
10
|
+
def options=(options)
|
11
|
+
@options.merge!(options)
|
12
|
+
end
|
13
|
+
def get(*options)
|
14
|
+
if !options.empty?
|
15
|
+
@options.merge!(options[0])
|
16
|
+
end
|
17
|
+
if @options[:url]
|
18
|
+
Kramdown::Document.new(Curl.get(@options[:url]).body_str).to_html
|
19
|
+
else
|
20
|
+
Kramdown::Document.new(Curl.get("https://raw.github.com/#{@options[:user]}/#{@options[:repo]}/#{@options[:branch]}/#{@options[:file]}").body_str).to_html
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: curldown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ian Kent
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple tool to parse hosted markdown files into html
|
14
|
+
email: ian@iankent.me
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/curldown.rb
|
20
|
+
homepage: http://code.iankent.me/curldown
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.3
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Curldown
|
44
|
+
test_files: []
|