curldown 0.0.4 → 1.0.2

This diff has not been reviewed by any users.
Log in in order to be able to vote.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/curldown +31 -0
  3. data/lib/curldown.rb +2 -2
  4. metadata +28 -37
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: faf1037d47a00b4421406688e60aa4f76b38f698e05137fc7dae55658a47fb5d
4
+ data.tar.gz: 7f1a0b8e42701b2da7965b3c4abbd498b9e3561be6185859e60f946a10581f01
5
+ SHA512:
6
+ metadata.gz: a705f0ab5288aa9d00a59b7e793f89a24f6cb081beef8ebea6a4e5a50f768d208ece7c962f1e26690a47451638679e7cfeeb7ff7c5eb15bb23950815d2d5bed2
7
+ data.tar.gz: 48ad2e1973e4f36af20f62a10a64f521c5f3e52b88460cdf79149f683639f532a49ef4e6f4e529c4066cb9c613f15c6de27d494e49f3dd4a8f912e8de59508be
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'curldown'
3
+ args = ARGV.dup
4
+ ARGV.clear
5
+ def set_options(args)
6
+ @options = {}
7
+ flags = [["-u","user"],["-r","repo"],["-b","branch"],["-f","file"]]
8
+ if args.inspect.include?("--url=")
9
+ args.each do |arg|
10
+ if arg.include?("--url=")
11
+ @options[:url] = arg[6..-1]
12
+ end
13
+ end
14
+ else
15
+ flags.each do |flag|
16
+ if args.include?(flag[0])
17
+ @options[flag[1].to_sym] = args[args.index(flag[0]) + 1]
18
+ end
19
+ end
20
+ end
21
+ end
22
+ if args.inspect.include?("--copy")
23
+ set_options(args)
24
+ IO.popen 'pbcopy', 'w' do |io|
25
+ io.print Curldown.new.get(@options)
26
+ end
27
+ puts "HTML has been copied to the clipboard"
28
+ else
29
+ set_options(args)
30
+ puts Curldown.new.get(@options)
31
+ end
@@ -1,4 +1,4 @@
1
- ['curb','github/markup','nokogiri','pygments.rb'].each do |gem| require gem end
1
+ ['curb','github/markdown','nokogiri','pygments.rb'].each do |gem| require gem end
2
2
  class Curldown
3
3
  @@lexers = []
4
4
  Pygments.lexers.each do |a|
@@ -33,7 +33,7 @@ class Curldown
33
33
  end
34
34
  def fetch(url)
35
35
  if check_response_code(url)
36
- html = GitHub::Markup.render("markdown.md", Curl.get(url).body_str)
36
+ html = GitHub::Markdown.render_gfm(Curl.get(url).body_str)
37
37
  doc = Nokogiri::HTML(html)
38
38
  doc.css("pre").each do |pre|
39
39
  if @@lexers.include?(pre.attributes["lang"].value)
metadata CHANGED
@@ -1,110 +1,101 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curldown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ian Kent
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: curb
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 0.8.0
19
+ version: '0.8'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 0.8.0
26
+ version: '0.8'
30
27
  - !ruby/object:Gem::Dependency
31
- name: github-markup
28
+ name: github-markdown
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 0.7.5
33
+ version: '0.5'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 0.7.5
40
+ version: '0.5'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: 1.5.0
47
+ version: '1.6'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 1.5.0
54
+ version: '1.6'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pygments.rb
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: 0.5.0
61
+ version: '0.5'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
- version: 0.5.0
68
+ version: '0.5'
78
69
  description: A simple tool to parse hosted markdown files into html
79
70
  email: ian@iankent.me
80
- executables: []
71
+ executables:
72
+ - curldown
81
73
  extensions: []
82
74
  extra_rdoc_files: []
83
75
  files:
76
+ - bin/curldown
84
77
  - lib/curldown.rb
85
- homepage: http://code.iankent.me/curldown
78
+ homepage: https://bitbucket.org/iankentforrestbrown/curldown
86
79
  licenses:
87
80
  - MIT
81
+ metadata: {}
88
82
  post_install_message:
89
83
  rdoc_options: []
90
84
  require_paths:
91
85
  - lib
92
86
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
87
  requirements:
95
- - - ! '>='
88
+ - - ">="
96
89
  - !ruby/object:Gem::Version
97
90
  version: '0'
98
91
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
92
  requirements:
101
- - - ! '>='
93
+ - - ">="
102
94
  - !ruby/object:Gem::Version
103
95
  version: '0'
104
96
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 1.8.25
97
+ rubygems_version: 3.1.2
107
98
  signing_key:
108
- specification_version: 3
99
+ specification_version: 4
109
100
  summary: Curldown
110
101
  test_files: []