gisture 0.0.2 → 0.0.3
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/lib/gisture/gist.rb +12 -5
- data/lib/gisture/version.rb +1 -1
- data/lib/gisture.rb +4 -4
- data/lib/github_api/client/gists.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3a20fe2d04688228edbaa5cf0b7ea1fdc9ad66
|
4
|
+
data.tar.gz: 79062e1a7cfeb4c58a1add028f90195d987fb953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9ed38b608e1f52182cf2a23ab18f301eb80d70de804f9b8de1716bb4c057f3a8b884c8ce4704da69aa5e836704f38091f69af728c399d269a38616aaca96dc
|
7
|
+
data.tar.gz: bfcaf28ea0329a488fc232785980c3cf14eb90fa1999b5722bc6bc6adbfa17f31024dade585a453addde02f4c7e12398fa0f49003560fa4c1eaf91ee4dcfc78b
|
data/lib/gisture/gist.rb
CHANGED
@@ -6,8 +6,8 @@ module Gisture
|
|
6
6
|
|
7
7
|
STRATEGIES = [:eval, :load, :require]
|
8
8
|
|
9
|
-
def self.run!(gist_id: nil, strategy: nil, filename: nil, &block)
|
10
|
-
new(gist_id: gist_id, strategy: strategy, filename: filename).run!(&block)
|
9
|
+
def self.run!(gist_id: nil, strategy: nil, filename: nil, version: nil, &block)
|
10
|
+
new(gist_id: gist_id, strategy: strategy, filename: filename, version: version).run!(&block)
|
11
11
|
end
|
12
12
|
|
13
13
|
def run!(&block)
|
@@ -40,7 +40,13 @@ module Gisture
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def gist
|
43
|
-
@gist ||=
|
43
|
+
@gist ||= begin
|
44
|
+
if @version.nil?
|
45
|
+
github.gists.get(gist_id)
|
46
|
+
else
|
47
|
+
github.gists.version(gist_id, @version)
|
48
|
+
end
|
49
|
+
end
|
44
50
|
end
|
45
51
|
|
46
52
|
def gist_file
|
@@ -70,7 +76,7 @@ module Gisture
|
|
70
76
|
|
71
77
|
def tempfile
|
72
78
|
@tempfile ||= begin
|
73
|
-
file = Tempfile.new([gist_id,
|
79
|
+
file = Tempfile.new([gist_id, File.extname(gist_file[0])], Gisture.configuration.tmpdir)
|
74
80
|
file.write(raw)
|
75
81
|
file.close
|
76
82
|
file
|
@@ -85,10 +91,11 @@ module Gisture
|
|
85
91
|
|
86
92
|
protected
|
87
93
|
|
88
|
-
def initialize(gist_id: nil, strategy: nil, filename: nil)
|
94
|
+
def initialize(gist_id: nil, strategy: nil, filename: nil, version: nil)
|
89
95
|
raise ArgumentError, "Invalid gist_id" if gist_id.nil?
|
90
96
|
@gist_id = gist_id
|
91
97
|
@filename = filename
|
98
|
+
@version = version
|
92
99
|
self.strategy = strategy || :eval
|
93
100
|
end
|
94
101
|
|
data/lib/gisture/version.rb
CHANGED
data/lib/gisture.rb
CHANGED
@@ -22,11 +22,11 @@ module Gisture
|
|
22
22
|
config.tmpdir = Dir.tmpdir # location to store gist tempfiles
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.new(gist_id, strategy=nil, filename=nil)
|
26
|
-
Gisture::Gist.new(gist_id: gist_id, strategy: strategy, filename: filename)
|
25
|
+
def self.new(gist_id, strategy=nil, filename=nil, version=nil)
|
26
|
+
Gisture::Gist.new(gist_id: gist_id, strategy: strategy, filename: filename, version: version)
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.run(gist_id, strategy=nil, filename=nil, &block)
|
30
|
-
new(gist_id, strategy, filename).run!(&block)
|
29
|
+
def self.run(gist_id, strategy=nil, filename=nil, version=nil, &block)
|
30
|
+
new(gist_id, strategy, filename, version).run!(&block)
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gisture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: canfig
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/gisture/gist.rb
|
79
79
|
- lib/gisture/railtie.rb
|
80
80
|
- lib/gisture/version.rb
|
81
|
+
- lib/github_api/client/gists.rb
|
81
82
|
- lib/tasks/gisture.rake
|
82
83
|
- spec/gists/called_class.rb
|
83
84
|
- spec/gists/called_method.rb
|