gisture 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gisture/evaluator.rb +7 -3
- data/lib/gisture/gist.rb +30 -9
- data/lib/{github_api → gisture/github_api}/client/gists.rb +0 -0
- data/lib/gisture/version.rb +1 -1
- data/lib/gisture.rb +5 -4
- data/lib/tasks/gisture.rake +2 -2
- data/spec/gisture/evaluator_spec.rb +24 -1
- data/spec/gisture/gist_spec.rb +191 -1
- data/spec/gisture_spec.rb +5 -1
- data/spec/spec_helper.rb +5 -1
- data/spec/support/gists.rb +5 -0
- data/spec/support/github_api.rb +16 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 204135cbcc13305754d2b3a0558222ec220eae6b
|
4
|
+
data.tar.gz: 068ea799d72c1678747b1cef3a7c93a48a2ebd5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b53b53175b706be880fae8e9e32609edae8909bcc6dc3d3076a698c1f6e05b3463402ce7958fcc578f5bd48e9830a386d666546f60643f8424a52788c83263b0
|
7
|
+
data.tar.gz: 2e8a7e5565c63d09cb28ec6df0e229c399f0836b33a5a7c14f2286509e57adde000845d35947ed6183fec3e80b6476d07147ccf99f5ea51e5d9609d3b2eed435
|
data/lib/gisture/evaluator.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
module Gisture
|
2
2
|
class Evaluator
|
3
|
-
attr_reader :raw
|
3
|
+
attr_reader :raw, :result
|
4
|
+
|
5
|
+
def evaluate
|
6
|
+
instance_eval { @result = eval raw }
|
7
|
+
end
|
4
8
|
|
5
9
|
protected
|
6
10
|
|
7
11
|
def initialize(raw)
|
8
|
-
@raw = raw
|
9
|
-
|
12
|
+
@raw = raw.to_s
|
13
|
+
evaluate
|
10
14
|
end
|
11
15
|
end
|
12
16
|
end
|
data/lib/gisture/gist.rb
CHANGED
@@ -2,12 +2,14 @@ require 'tempfile'
|
|
2
2
|
|
3
3
|
module Gisture
|
4
4
|
class Gist
|
5
|
-
attr_reader :filename, :gist_id, :strategy
|
5
|
+
attr_reader :filename, :gist_id, :strategy, :version
|
6
6
|
|
7
7
|
STRATEGIES = [:eval, :load, :require]
|
8
|
+
GIST_URL_REGEX = /\Ahttp.+([0-9a-f]{20,20})\/?\Z/
|
9
|
+
GIST_URL_WITH_VERSION_REGEX = /\Ahttp.+([0-9a-f]{20,20})\/([0-9a-f]{40,40})\/?\Z/
|
8
10
|
|
9
|
-
def self.run!(
|
10
|
-
new(
|
11
|
+
def self.run!(gist, strategy: nil, filename: nil, version: nil, &block)
|
12
|
+
new(gist, strategy: strategy, filename: filename, version: version).run!(&block)
|
11
13
|
end
|
12
14
|
|
13
15
|
def run!(&block)
|
@@ -34,7 +36,7 @@ module Gisture
|
|
34
36
|
|
35
37
|
def github
|
36
38
|
@github ||= begin
|
37
|
-
github_config = Gisture::GITHUB_CONFIG_OPTS.map { |key| [key, Gisture.configuration.send(key)] }
|
39
|
+
github_config = Hash[Gisture::GITHUB_CONFIG_OPTS.map { |key| [key, Gisture.configuration.send(key)] }]
|
38
40
|
Github.new(github_config)
|
39
41
|
end
|
40
42
|
end
|
@@ -85,23 +87,42 @@ module Gisture
|
|
85
87
|
|
86
88
|
def to_h
|
87
89
|
{ gist_id: gist_id,
|
90
|
+
version: version,
|
88
91
|
strategy: strategy,
|
89
92
|
filename: filename }
|
90
93
|
end
|
91
94
|
|
92
95
|
protected
|
93
96
|
|
94
|
-
def initialize(
|
95
|
-
raise ArgumentError, "Invalid gist_id" if gist_id.nil?
|
96
|
-
@gist_id = gist_id
|
97
|
-
@filename = filename
|
98
|
-
@version = version
|
97
|
+
def initialize(gist, strategy: nil, filename: nil, version: nil)
|
99
98
|
self.strategy = strategy || :eval
|
99
|
+
@filename = filename
|
100
|
+
|
101
|
+
if gist.match(/[^a-f0-9]+/i) # non-hex chars, probably a URL
|
102
|
+
@gist_id, @version = parse_gist_url(gist)
|
103
|
+
@version = version unless version.nil?
|
104
|
+
else
|
105
|
+
@gist_id = gist
|
106
|
+
@version = version
|
107
|
+
end
|
108
|
+
|
100
109
|
end
|
101
110
|
|
102
111
|
def unlink_tempfile
|
103
112
|
tempfile.unlink
|
104
113
|
@tempfile = nil
|
105
114
|
end
|
115
|
+
|
116
|
+
def parse_gist_url(gist_url)
|
117
|
+
case gist_url.to_s
|
118
|
+
when GIST_URL_WITH_VERSION_REGEX
|
119
|
+
matches = gist_url.match(GIST_URL_WITH_VERSION_REGEX)
|
120
|
+
return [matches[1], matches[2]]
|
121
|
+
when GIST_URL_REGEX
|
122
|
+
return [gist_url.match(GIST_URL_REGEX)[1], nil]
|
123
|
+
else
|
124
|
+
raise ArgumentError, "Invalid argument: #{gist_url} is not a valid gist URL."
|
125
|
+
end
|
126
|
+
end
|
106
127
|
end
|
107
128
|
end
|
File without changes
|
data/lib/gisture/version.rb
CHANGED
data/lib/gisture.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'canfig'
|
2
2
|
require 'github_api'
|
3
|
+
require 'gisture/github_api/client/gists'
|
3
4
|
require 'gisture/version'
|
4
5
|
require 'gisture/evaluator'
|
5
6
|
require 'gisture/gist'
|
@@ -22,11 +23,11 @@ module Gisture
|
|
22
23
|
config.tmpdir = Dir.tmpdir # location to store gist tempfiles
|
23
24
|
end
|
24
25
|
|
25
|
-
def self.new(
|
26
|
-
Gisture::Gist.new(
|
26
|
+
def self.new(gist, strategy: nil, filename: nil, version: nil)
|
27
|
+
Gisture::Gist.new(gist, strategy: strategy, filename: filename, version: version)
|
27
28
|
end
|
28
29
|
|
29
|
-
def self.run(
|
30
|
-
new(
|
30
|
+
def self.run(gist, strategy: nil, filename: nil, version: nil, &block)
|
31
|
+
new(gist, strategy, filename, version).run!(&block)
|
31
32
|
end
|
32
33
|
end
|
data/lib/tasks/gisture.rake
CHANGED
@@ -2,8 +2,8 @@ require 'gisture'
|
|
2
2
|
|
3
3
|
namespace 'gisture' do
|
4
4
|
desc 'Run a github gist in a rake task'
|
5
|
-
task :run, [:gist_id, :strategy, :filename, :runner] => :environment do |t,args|
|
5
|
+
task :run, [:gist_id, :strategy, :filename, :version, :runner] => :environment do |t,args|
|
6
6
|
runner = Proc.new { eval(args.runner.to_s) }
|
7
|
-
Gisture.run(args.gist_id, args.strategy, args.filename, &runner)
|
7
|
+
Gisture.run(args.gist_id, strategy: args.strategy, filename: args.filename, version: args.version, &runner)
|
8
8
|
end
|
9
9
|
end
|
@@ -1,4 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Gisture::Evaluator do
|
4
|
+
it "requires a string to be eval'd" do
|
5
|
+
expect { Gisture::Evaluator.new }.to raise_exception(ArgumentError)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "converts raw input to a string" do
|
9
|
+
expect { Gisture::Evaluator.new(nil) }.to_not raise_exception
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#raw" do
|
13
|
+
subject { Gisture::Evaluator.new("1+1") }
|
14
|
+
|
15
|
+
it "stores the raw string passed on init" do
|
16
|
+
expect(subject.raw).to eql("1+1")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#result" do
|
21
|
+
subject { Gisture::Evaluator.new("1+1") }
|
22
|
+
|
23
|
+
it "stores the result returned by evaluating the block" do
|
24
|
+
expect(subject.result).to eql(2)
|
25
|
+
end
|
26
|
+
end
|
4
27
|
end
|
data/spec/gisture/gist_spec.rb
CHANGED
@@ -1,4 +1,194 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
TEST_GIST_ID = "520b474ea0248d1a0a74"
|
4
|
+
TEST_GIST_URL = "https://gist.github.com/markrebec/520b474ea0248d1a0a74"
|
5
|
+
TEST_GIST_VERSION = "49a9d887eeb8c723ab23deddfbbb75d4b70e8014"
|
6
|
+
TEST_GIST_VERSION_URL = "https://gist.github.com/markrebec/520b474ea0248d1a0a74/49a9d887eeb8c723ab23deddfbbb75d4b70e8014"
|
7
|
+
TEST_GIST_FILENAME = "test.rb"
|
8
|
+
MULTI_FILE_TEST_GIST_ID = "0417bf78a7c2b825b4ef"
|
9
|
+
MULTI_FILE_TEST_GIST_FILENAMES = ['file_one.rb', 'file_two.rb']
|
2
10
|
|
3
11
|
RSpec.describe Gisture::Gist do
|
12
|
+
context "when passing a gist ID" do
|
13
|
+
it "sets the gist ID as the gist_id" do
|
14
|
+
expect(Gisture::Gist.new(TEST_GIST_ID).gist_id).to eql(TEST_GIST_ID)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when passing a version" do
|
18
|
+
it "sets the version" do
|
19
|
+
expect(Gisture::Gist.new(TEST_GIST_ID, version: TEST_GIST_VERSION).version).to eql(TEST_GIST_VERSION)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when passing a gist URL" do
|
25
|
+
context "without a version" do
|
26
|
+
it "extracts and sets the gist ID as the gist_id" do
|
27
|
+
expect(Gisture::Gist.new(TEST_GIST_URL).gist_id).to eql(TEST_GIST_ID)
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when passing a version separately" do
|
31
|
+
it "sets the version" do
|
32
|
+
expect(Gisture::Gist.new(TEST_GIST_URL, version: TEST_GIST_VERSION).version).to eql(TEST_GIST_VERSION)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with a version" do
|
38
|
+
it "extracts and sets the gist ID as the gist_id" do
|
39
|
+
expect(Gisture::Gist.new(TEST_GIST_VERSION_URL).gist_id).to eql(TEST_GIST_ID)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "extracts and sets the gist version as the version" do
|
43
|
+
expect(Gisture::Gist.new(TEST_GIST_VERSION_URL).version).to eql(TEST_GIST_VERSION)
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when passing a version separately" do
|
47
|
+
it "overrides the version with the one explicitly provided" do
|
48
|
+
expect(Gisture::Gist.new(TEST_GIST_VERSION_URL, version: "abc123").version).to eql("abc123")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "when passing a filename" do
|
55
|
+
it "sets the filename" do
|
56
|
+
expect(Gisture::Gist.new(TEST_GIST_ID, filename: TEST_GIST_FILENAME).filename).to eql(TEST_GIST_FILENAME)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when passing a strategy" do
|
61
|
+
context "which is a valid strategy" do
|
62
|
+
it "sets the requested strategy" do
|
63
|
+
expect(Gisture::Gist.new(TEST_GIST_ID, strategy: :load).strategy).to eql(:load)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "which is not a valid strategy" do
|
68
|
+
it "raises an ArgumentError" do
|
69
|
+
expect { Gisture::Gist.new(TEST_GIST_ID, strategy: :foo) }.to raise_exception(ArgumentError)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#github" do
|
75
|
+
subject { Gisture::Gist.new(TEST_GIST_ID) }
|
76
|
+
|
77
|
+
it "is a github_api client object" do
|
78
|
+
expect(subject.github).to be_a(Github::Client)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#gist" do
|
83
|
+
subject { Gisture::Gist.new(TEST_GIST_ID) }
|
84
|
+
|
85
|
+
it "is the gist that was requested" do
|
86
|
+
expect(subject.gist.id).to eql(TEST_GIST_ID)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "#gist_file" do
|
91
|
+
it "returns an array" do
|
92
|
+
expect(Gisture::Gist.new(TEST_GIST_ID).gist_file).to be_a(Array)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "contains the filename and file object" do
|
96
|
+
gist = Gisture::Gist.new(TEST_GIST_ID)
|
97
|
+
expect(gist.gist_file[0]).to eql(TEST_GIST_FILENAME)
|
98
|
+
expect(gist.gist_file[1]).to be_a(Hashie::Mash)
|
99
|
+
end
|
100
|
+
|
101
|
+
context "when a gist contains a single file" do
|
102
|
+
it "returns the file" do
|
103
|
+
expect(Gisture::Gist.new(TEST_GIST_ID).gist_file[0]).to eql(TEST_GIST_FILENAME)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when a gist contains more than one file" do
|
108
|
+
context "and a filename is present" do
|
109
|
+
subject { Gisture::Gist.new(MULTI_FILE_TEST_GIST_ID, filename: MULTI_FILE_TEST_GIST_FILENAMES.sample) }
|
110
|
+
|
111
|
+
it "returns the specified file" do
|
112
|
+
expect(subject.gist_file[0]).to eql(subject.filename)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "and no filename is present" do
|
117
|
+
subject { Gisture::Gist.new(MULTI_FILE_TEST_GIST_ID) }
|
118
|
+
|
119
|
+
it "raises an ArgumentError" do
|
120
|
+
expect { subject.gist_file }.to raise_exception(ArgumentError)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "#raw" do
|
127
|
+
subject { Gisture::Gist.new(TEST_GIST_ID) }
|
128
|
+
|
129
|
+
it "returns the raw gist content" do
|
130
|
+
expect(subject.raw).to eql(subject.gist_file[1].content)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "#strategy=" do
|
135
|
+
subject { Gisture::Gist.new(TEST_GIST_ID) }
|
136
|
+
|
137
|
+
context "when passed a valid strategy" do
|
138
|
+
it "sets the strategy" do
|
139
|
+
subject.strategy = :load
|
140
|
+
expect(subject.strategy).to eql(:load)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context "when passed an invalid strategy" do
|
145
|
+
it "raises an ArgumentError" do
|
146
|
+
expect { subject.strategy = :foo }.to raise_exception(ArgumentError)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "#tempfile" do
|
152
|
+
subject { Gisture::Gist.new(TEST_GIST_ID) }
|
153
|
+
|
154
|
+
it "creates and returns a tempfile" do
|
155
|
+
expect(subject.tempfile).to be_a(Tempfile)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "uses the gist_id as the base of the filename" do
|
159
|
+
matched = File.basename(subject.tempfile.path).match(/#{TEST_GIST_ID}/)
|
160
|
+
expect(matched).to_not be_nil
|
161
|
+
end
|
162
|
+
|
163
|
+
it "uses the same extension as the gist's filename" do
|
164
|
+
expect(File.extname(subject.tempfile.path)).to eql(File.extname(subject.gist_file[0]))
|
165
|
+
end
|
166
|
+
|
167
|
+
it "creates the file in the configured tempdir" do
|
168
|
+
tmp_path = File.join(File.dirname(__FILE__), '../', 'tmp')
|
169
|
+
begin
|
170
|
+
FileUtils.mkdir_p tmp_path
|
171
|
+
Gisture.configure do |config|
|
172
|
+
config.tmpdir = tmp_path
|
173
|
+
end
|
174
|
+
|
175
|
+
expect(File.dirname(subject.tempfile.path)).to eql(tmp_path)
|
176
|
+
rescue => e
|
177
|
+
raise e
|
178
|
+
ensure
|
179
|
+
Gisture.configure do |config|
|
180
|
+
config.tmpdir = Dir.tmpdir
|
181
|
+
end
|
182
|
+
FileUtils.rm_rf tmp_path
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "#to_h" do
|
188
|
+
subject { Gisture::Gist.new(TEST_GIST_ID, filename: "test.rb") }
|
189
|
+
|
190
|
+
it "returns a hash of the gist attributes" do
|
191
|
+
expect(subject.to_h).to eql({gist_id: TEST_GIST_ID, strategy: :eval, filename: "test.rb", version: nil})
|
192
|
+
end
|
193
|
+
end
|
4
194
|
end
|
data/spec/gisture_spec.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Gisture do
|
4
|
+
SAMPLE_GIST_ID = "c3b478ef0592eacad361".freeze
|
5
|
+
SAMPLE_GIST_VERSION = "7714df11a3babaa78f27027844ac2f0c1a8348c1".freeze
|
6
|
+
SAMPLE_GIST_URL = "https://gist.github.com/markrebec/#{SAMPLE_GIST_ID}".freeze
|
7
|
+
SAMPLE_GIST_URL_WITH_VERSION = "https://gist.github.com/markrebec/#{SAMPLE_GIST_ID}/#{SAMPLE_GIST_VERSION}".freeze
|
4
8
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,11 @@ require 'rspec'
|
|
3
3
|
require 'coveralls'
|
4
4
|
Coveralls.wear!
|
5
5
|
|
6
|
-
|
6
|
+
Dir[File.join(File.dirname(__FILE__), '..', "spec/support/**/*.rb")].each { |f| require f }
|
7
|
+
|
8
|
+
Gisture.configure do |config|
|
9
|
+
config.oauth_token = ENV['GITHUB_OAUTH_TOKEN']
|
10
|
+
end
|
7
11
|
|
8
12
|
RSpec.configure do |config|
|
9
13
|
#config.before(:suite) do
|
@@ -0,0 +1,5 @@
|
|
1
|
+
TEST_GISTS = {
|
2
|
+
"520b474ea0248d1a0a74" => Hashie::Mash.new({"url"=>"https://api.github.com/gists/520b474ea0248d1a0a74", "forks_url"=>"https://api.github.com/gists/520b474ea0248d1a0a74/forks", "commits_url"=>"https://api.github.com/gists/520b474ea0248d1a0a74/commits", "id"=>"520b474ea0248d1a0a74", "git_pull_url"=>"https://gist.github.com/520b474ea0248d1a0a74.git", "git_push_url"=>"https://gist.github.com/520b474ea0248d1a0a74.git", "html_url"=>"https://gist.github.com/520b474ea0248d1a0a74", "files"=>Hashie::Mash.new({"test.rb" => Hashie::Mash.new({"filename"=>"test.rb", "type"=>"application/x-ruby", "language"=>"Ruby", "raw_url"=>"https://gist.githubusercontent.com/markrebec/520b474ea0248d1a0a74/raw/dc57de4d96283efb9b40215c3882bf4658a504ea/test.rb", "size"=>26, "truncated"=>false, "content"=>"puts \"1+1 = \#{(1+1).to_s}\""})}), "owner"=>{"login"=>"markrebec", "id"=>231971, "avatar_url"=>"https://avatars.githubusercontent.com/u/231971?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/markrebec", "html_url"=>"https://github.com/markrebec", "followers_url"=>"https://api.github.com/users/markrebec/followers", "following_url"=>"https://api.github.com/users/markrebec/following{/other_user}", "gists_url"=>"https://api.github.com/users/markrebec/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/markrebec/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/markrebec/subscriptions", "organizations_url"=>"https://api.github.com/users/markrebec/orgs", "repos_url"=>"https://api.github.com/users/markrebec/repos", "events_url"=>"https://api.github.com/users/markrebec/events{/privacy}", "received_events_url"=>"https://api.github.com/users/markrebec/received_events", "type"=>"User", "site_admin"=>false}}),
|
3
|
+
|
4
|
+
"0417bf78a7c2b825b4ef" => Hashie::Mash.new({"url"=>"https://api.github.com/gists/0417bf78a7c2b825b4ef", "forks_url"=>"https://api.github.com/gists/0417bf78a7c2b825b4ef/forks", "commits_url"=>"https://api.github.com/gists/0417bf78a7c2b825b4ef/commits", "id"=>"0417bf78a7c2b825b4ef", "git_pull_url"=>"https://gist.github.com/0417bf78a7c2b825b4ef.git", "git_push_url"=>"https://gist.github.com/0417bf78a7c2b825b4ef.git", "html_url"=>"https://gist.github.com/0417bf78a7c2b825b4ef", "files"=>Hashie::Mash.new({"file_one.rb" => Hashie::Mash.new({"filename"=>"file_one.rb", "type"=>"application/x-ruby", "language"=>"Ruby", "raw_url"=>"https://gist.githubusercontent.com/markrebec/0417bf78a7c2b825b4ef/raw/6074958bbcc281096357a7d014983638bb09ed1f/file_one.rb", "size"=>27, "truncated"=>false, "content"=>"5.times { puts \"File One\" }"}), "file_two.rb" => Hashie::Mash.new({"filename"=>"file_two.rb", "type"=>"application/x-ruby", "language"=>"Ruby", "raw_url"=>"https://gist.githubusercontent.com/markrebec/0417bf78a7c2b825b4ef/raw/9e1aafc8007f427d386813896387c01848b6bb33/file_two.rb", "size"=>27, "truncated"=>false, "content"=>"5.times { puts \"File Two\" }"})}), "owner"=>{"login"=>"markrebec", "id"=>231971, "avatar_url"=>"https://avatars.githubusercontent.com/u/231971?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/markrebec", "html_url"=>"https://github.com/markrebec", "followers_url"=>"https://api.github.com/users/markrebec/followers", "following_url"=>"https://api.github.com/users/markrebec/following{/other_user}", "gists_url"=>"https://api.github.com/users/markrebec/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/markrebec/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/markrebec/subscriptions", "organizations_url"=>"https://api.github.com/users/markrebec/orgs", "repos_url"=>"https://api.github.com/users/markrebec/repos", "events_url"=>"https://api.github.com/users/markrebec/events{/privacy}", "received_events_url"=>"https://api.github.com/users/markrebec/received_events", "type"=>"User", "site_admin"=>false}})
|
5
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Github
|
2
|
+
class Client::Gists < API
|
3
|
+
def get(*args)
|
4
|
+
arguments(args, required: [:id])
|
5
|
+
|
6
|
+
TEST_GISTS.to_a.find { |g| g.first == arguments.id }.last
|
7
|
+
end
|
8
|
+
|
9
|
+
def version(*args)
|
10
|
+
arguments(args, required: [:id, :version])
|
11
|
+
|
12
|
+
# TODO implement this
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
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.5
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: canfig
|
@@ -76,9 +76,9 @@ files:
|
|
76
76
|
- lib/gisture.rb
|
77
77
|
- lib/gisture/evaluator.rb
|
78
78
|
- lib/gisture/gist.rb
|
79
|
+
- lib/gisture/github_api/client/gists.rb
|
79
80
|
- lib/gisture/railtie.rb
|
80
81
|
- lib/gisture/version.rb
|
81
|
-
- lib/github_api/client/gists.rb
|
82
82
|
- lib/tasks/gisture.rake
|
83
83
|
- spec/gists/called_class.rb
|
84
84
|
- spec/gists/called_method.rb
|
@@ -89,6 +89,8 @@ files:
|
|
89
89
|
- spec/gisture/gist_spec.rb
|
90
90
|
- spec/gisture_spec.rb
|
91
91
|
- spec/spec_helper.rb
|
92
|
+
- spec/support/gists.rb
|
93
|
+
- spec/support/github_api.rb
|
92
94
|
homepage: http://github.com/markrebec/gisture
|
93
95
|
licenses: []
|
94
96
|
metadata: {}
|
@@ -122,3 +124,5 @@ test_files:
|
|
122
124
|
- spec/gisture/gist_spec.rb
|
123
125
|
- spec/gisture_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
127
|
+
- spec/support/gists.rb
|
128
|
+
- spec/support/github_api.rb
|