directlink 0.0.1.0 → 0.0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/bin/directlink +23 -5
- data/directlink.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb866e5434320eaffc9fd5710d3bde5e545a839
|
4
|
+
data.tar.gz: b40150fd4692b0bd37dda34d4af95e7384300bc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68365c9e4c1877461d38208949d90bf028f3d39857799bf8a53071f7ddf31cd01bb70351f91b88afe5ab81d016254d56d7d600c0483979fccc717f7743c0444a
|
7
|
+
data.tar.gz: 75ac07d1012bc49508e296ba77f3a134218c9ae8f2cf5640cee5097916a26220dedc91df6c918a8e3b8bfb49cb37f3d44ac2dbe77602014ab92b5981982b277d
|
data/README.md
CHANGED
@@ -77,6 +77,10 @@ $ directlink --json https://imgur.com/a/oacI3gl https://avatars1.githubuserconte
|
|
77
77
|
}
|
78
78
|
]
|
79
79
|
```
|
80
|
+
Downloads master:HEAD version of `lib/directlink.rb` from GitHub and uses it once instead of installed one (this is easier than installing gem from repo):
|
81
|
+
```
|
82
|
+
$ directlink --github <url>
|
83
|
+
```
|
80
84
|
|
81
85
|
### As library
|
82
86
|
|
data/bin/directlink
CHANGED
@@ -9,22 +9,40 @@ end
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
-
require "directlink"
|
13
|
-
DirectLink.silent = true
|
14
12
|
|
15
|
-
# TODO: use OptionParser
|
16
|
-
debug = json = nil
|
13
|
+
# TODO: use OptionParser?
|
14
|
+
debug = json = github = nil
|
17
15
|
loop do
|
18
16
|
case ARGV.first
|
19
17
|
when "--debug"
|
20
18
|
debug = ARGV.shift
|
21
|
-
DirectLink.silent = false
|
22
19
|
when "--json"
|
23
20
|
json = ARGV.shift
|
21
|
+
when "--github"
|
22
|
+
github = ARGV.shift
|
24
23
|
else
|
25
24
|
break
|
26
25
|
end
|
27
26
|
end
|
27
|
+
if github
|
28
|
+
require "tmpdir"
|
29
|
+
require "nethttputils"
|
30
|
+
begin
|
31
|
+
dir = Dir.mktmpdir "directlink"
|
32
|
+
src = File.join dir, "directlink.rb"
|
33
|
+
puts "downloaded directlink.rb from GitHub (#{
|
34
|
+
File.write src, NetHTTPUtils.request_data("https://github.com/nakilon/directlink/blob/master/lib/directlink.rb", form: {raw: true})
|
35
|
+
} bytes)"
|
36
|
+
require_relative src
|
37
|
+
ensure
|
38
|
+
# puts "deleting #{dir}"
|
39
|
+
# require "fileutils"
|
40
|
+
# FileUtils.rm_rf dir
|
41
|
+
end
|
42
|
+
else
|
43
|
+
require "directlink"
|
44
|
+
end
|
45
|
+
DirectLink.silent = !debug
|
28
46
|
abort "usage: directlink [--debug] [--json] <link1> <link2> <link3> ..." if [nil, "-h", "--help"].include? ARGV.first
|
29
47
|
|
30
48
|
begin
|
data/directlink.gemspec
CHANGED