glsnip 0.0.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 +7 -0
- data/bin/glsnip +34 -0
- data/lib/glsnip/base.rb +101 -0
- data/lib/glsnip/delete_request.rb +38 -0
- data/lib/glsnip/get_request.rb +38 -0
- data/lib/glsnip/post_request.rb +38 -0
- data/lib/glsnip/put_request.rb +38 -0
- data/lib/glsnip/request.rb +48 -0
- data/lib/glsnip/snippets.rb +58 -0
- data/lib/glsnip/version.rb +31 -0
- data/lib/glsnip.rb +31 -0
- data/test/test_hello.rb +43 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8f69b22040947b27c7417047e508eb1c658eb501a1426424d8bb513ba363e1a
|
4
|
+
data.tar.gz: 38e66543c5668ae786027789b7a11ad7cd337552acf5e07473fa85a3fda1c80b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b9a0bab0bf94697fddc05512d9dc4ae95bfdad1de40d4961ec5be235b41426bc9c589097d983b6cefb52ba9e89356ab598b5eff5c5ba2549ef412b6dde3a1f94
|
7
|
+
data.tar.gz: a8d418ab4677b82643be5adb62b5f794a9614be82de0994b9bb97a2dbf3472be1809d8f4d45b465c8b81711e49fce0be9ed1f2682d1fcbb3d0de8a42d53789a2
|
data/bin/glsnip
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby'
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright 2019 Richard Davis
|
5
|
+
#
|
6
|
+
# This file is part of glsnip.
|
7
|
+
#
|
8
|
+
# glsnip is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# glsnip is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
##
|
23
|
+
# = /bin/glsnip
|
24
|
+
# Author:: Richard Davis
|
25
|
+
# Copyright:: Copyright 2019 Richard Davis
|
26
|
+
# License:: GNU Public License 3
|
27
|
+
#
|
28
|
+
# Project executable file.
|
29
|
+
begin
|
30
|
+
require 'glsnip'
|
31
|
+
rescue LoadError
|
32
|
+
require 'rubygems'
|
33
|
+
require 'glsnip'
|
34
|
+
end
|
data/lib/glsnip/base.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
##
|
21
|
+
# = /lib/glsnip.rb
|
22
|
+
# Author:: Richard Davis
|
23
|
+
# Copyright:: Copyright 2019 Richard Davis
|
24
|
+
# License:: GNU Public License 3
|
25
|
+
#
|
26
|
+
# Main application file that loads other files.
|
27
|
+
|
28
|
+
require 'optparse'
|
29
|
+
require 'English'
|
30
|
+
|
31
|
+
require 'glsnip/version'
|
32
|
+
require 'glsnip/snippets'
|
33
|
+
|
34
|
+
trap('INT') do
|
35
|
+
puts "\nTerminating..."
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
|
39
|
+
options = {}
|
40
|
+
|
41
|
+
optparse = OptionParser.new do |opts|
|
42
|
+
opts.banner = 'Usage: glsnip [filename(s) | options]'
|
43
|
+
|
44
|
+
opts.on('-a', '--all', 'Lists all of the snippets for a user') do
|
45
|
+
gl_response = Glsnip::Snippets.list
|
46
|
+
puts gl_response.body
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.on('-n', '--new FILE', 'Creates a new snippet for a user') do |file_name|
|
51
|
+
puts 'File does not exist' && exit unless File.exist?(file_name)
|
52
|
+
|
53
|
+
print 'Enter a title for the snippet -> '
|
54
|
+
title = gets.chomp
|
55
|
+
print 'Is this snippet private? (y/n) -> '
|
56
|
+
visibility = gets.chomp.casecmp?('y') ? 'private' : 'public'
|
57
|
+
content = File.read(file_name)
|
58
|
+
gl_response = Glsnip::Snippets.create(title: title,
|
59
|
+
file_name: File.split(file_name).last,
|
60
|
+
content: content,
|
61
|
+
visibility: visibility)
|
62
|
+
puts gl_response.body
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
|
66
|
+
opts.on('-l', '--license', 'Displays the copyright notice') do
|
67
|
+
puts "This program is free software: you can redistribute it and/or modify
|
68
|
+
it under the terms of the GNU General Public License as published by
|
69
|
+
the Free Software Foundation, either version 3 of the License, or
|
70
|
+
(at your option) any later version.
|
71
|
+
"
|
72
|
+
end
|
73
|
+
|
74
|
+
opts.on('-w', '--warranty', 'Displays the warranty statement') do
|
75
|
+
puts "This program is distributed in the hope that it will be useful,
|
76
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
77
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
78
|
+
GNU General Public License for more details.
|
79
|
+
"
|
80
|
+
end
|
81
|
+
|
82
|
+
opts.on('-v', '--version', 'Displays the program version') do
|
83
|
+
puts "glsnip v#{Glsnip::VERSION}"
|
84
|
+
end
|
85
|
+
|
86
|
+
opts.on_tail('-h', '--help', 'Displays the help screen') do
|
87
|
+
puts opts
|
88
|
+
exit
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
begin
|
93
|
+
optparse.parse!
|
94
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
95
|
+
puts $ERROR_INFO.to_s
|
96
|
+
puts 'Use -h or --help for options.'
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
|
100
|
+
ARGV.each do |filename|
|
101
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'glsnip/request'
|
21
|
+
|
22
|
+
module Glsnip
|
23
|
+
##
|
24
|
+
# = DeleteRequest
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Generic wrapper for DELETE requests to the GitLab API
|
30
|
+
class DeleteRequest < Request
|
31
|
+
def send
|
32
|
+
@response = Faraday.delete(@url) do |req|
|
33
|
+
req.headers['Private-Token'] = TOKEN
|
34
|
+
req.params = @params
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'glsnip/request'
|
21
|
+
|
22
|
+
module Glsnip
|
23
|
+
##
|
24
|
+
# = GetRequest
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Generic wrapper for GET requests to the GitLab API
|
30
|
+
class GetRequest < Request
|
31
|
+
def send
|
32
|
+
@response = Faraday.get(@url) do |req|
|
33
|
+
req.headers['Private-Token'] = TOKEN
|
34
|
+
req.params = @params
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'glsnip/request'
|
21
|
+
|
22
|
+
module Glsnip
|
23
|
+
##
|
24
|
+
# = PostRequest
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Generic wrapper for POST requests to the GitLab API
|
30
|
+
class PostRequest < Request
|
31
|
+
def send
|
32
|
+
@response = Faraday.post(@url) do |req|
|
33
|
+
req.headers['Private-Token'] = TOKEN
|
34
|
+
req.params = @params
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'glsnip/request'
|
21
|
+
|
22
|
+
module Glsnip
|
23
|
+
##
|
24
|
+
# = PutRequest
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Generic wrapper for PUT requests to the GitLab API
|
30
|
+
class PutRequest < Request
|
31
|
+
def send
|
32
|
+
@response = Faraday.put(@url) do |req|
|
33
|
+
req.headers['Private-Token'] = TOKEN
|
34
|
+
req.params = @params
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'faraday'
|
21
|
+
|
22
|
+
module Glsnip
|
23
|
+
##
|
24
|
+
# = Request
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Generic wrapper for requests to the GitLab API
|
30
|
+
class Request
|
31
|
+
BASE_URL = 'https://gitlab.com/api/v4'
|
32
|
+
private_constant :BASE_URL
|
33
|
+
|
34
|
+
TOKEN = ENV['GLSNIP_TOKEN']
|
35
|
+
private_constant :TOKEN
|
36
|
+
|
37
|
+
attr_reader :url, :params, :response
|
38
|
+
|
39
|
+
def initialize(endpoint, params = {})
|
40
|
+
@url = "#{BASE_URL}/#{endpoint}"
|
41
|
+
@params = params
|
42
|
+
end
|
43
|
+
|
44
|
+
def send
|
45
|
+
puts 'WARNING: Implemented in child classes.'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'glsnip/get_request'
|
21
|
+
require 'glsnip/post_request'
|
22
|
+
require 'glsnip/put_request'
|
23
|
+
require 'glsnip/delete_request'
|
24
|
+
|
25
|
+
module Glsnip
|
26
|
+
##
|
27
|
+
# = Request
|
28
|
+
# Author:: Richard Davis
|
29
|
+
# Copyright:: Copyright 2019 Richard Davis
|
30
|
+
# License:: GNU Public License 3
|
31
|
+
#
|
32
|
+
# Generic wrapper for requests to the GitLab API
|
33
|
+
class Snippets
|
34
|
+
ENDPOINT = 'snippets'
|
35
|
+
private_constant :ENDPOINT
|
36
|
+
|
37
|
+
def self.list
|
38
|
+
req = Glsnip::GetRequest.new(ENDPOINT)
|
39
|
+
req.send
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.read
|
43
|
+
req = GetRequest.new(ENDPOINT)
|
44
|
+
req.send
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.create(params = {})
|
48
|
+
req = PostRequest.new(ENDPOINT, params)
|
49
|
+
req.send
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.update
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.delete
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
# = version.rb
|
23
|
+
# Author:: Richard Davis
|
24
|
+
# Copyright:: Copyright 2019 Richard Davis
|
25
|
+
# License:: GNU Public License 3
|
26
|
+
#
|
27
|
+
# Module for namespacing application classes.
|
28
|
+
module Glsnip
|
29
|
+
# Program version number
|
30
|
+
VERSION = '0.0.1'
|
31
|
+
end
|
data/lib/glsnip.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
|
21
|
+
require 'glsnip/base'
|
22
|
+
|
23
|
+
##
|
24
|
+
# = Glsnip
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2019 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Module for namespacing application classes.
|
30
|
+
module Glsnip
|
31
|
+
end
|
data/test/test_hello.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 Richard Davis
|
4
|
+
#
|
5
|
+
# This file is part of glsnip.
|
6
|
+
#
|
7
|
+
# glsnip is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# glsnip is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with glsnip. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
|
21
|
+
require 'minitest/autorun'
|
22
|
+
require_relative '../lib/glsnip/hello'
|
23
|
+
|
24
|
+
##
|
25
|
+
# = HelloTest
|
26
|
+
# Author:: Richard Davis
|
27
|
+
# Copyright:: Copyright 2019 Richard Davis
|
28
|
+
# License:: GNU Public License 3
|
29
|
+
#
|
30
|
+
# Contains tests for Hello class.
|
31
|
+
class HelloTest < Minitest::Test
|
32
|
+
##
|
33
|
+
# Initializes test with sample data
|
34
|
+
def setup
|
35
|
+
@name = 'friend'
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Ensures the greeter is behaving as expected
|
40
|
+
def test_hello
|
41
|
+
assert_equal('Hello, friend.', Glsnip::Hello.greeting(@name))
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glsnip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.15.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.15.4
|
27
|
+
description: 'This gem allows users to post snippets to GitLab directly from the command
|
28
|
+
line.
|
29
|
+
|
30
|
+
'
|
31
|
+
email: rdavis@mushaka.solutions
|
32
|
+
executables:
|
33
|
+
- glsnip
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- bin/glsnip
|
38
|
+
- lib/glsnip.rb
|
39
|
+
- lib/glsnip/base.rb
|
40
|
+
- lib/glsnip/delete_request.rb
|
41
|
+
- lib/glsnip/get_request.rb
|
42
|
+
- lib/glsnip/post_request.rb
|
43
|
+
- lib/glsnip/put_request.rb
|
44
|
+
- lib/glsnip/request.rb
|
45
|
+
- lib/glsnip/snippets.rb
|
46
|
+
- lib/glsnip/version.rb
|
47
|
+
- test/test_hello.rb
|
48
|
+
homepage: https://gitlab.com/d3d1rty/glsnip
|
49
|
+
licenses:
|
50
|
+
- GPL-3.0
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.0.3
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Post GitLab snippets from the command line.
|
71
|
+
test_files:
|
72
|
+
- test/test_hello.rb
|