spigoter 0.2.2 → 0.3.0
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/.codeclimate.yml +20 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +1156 -0
- data/.travis.yml +4 -1
- data/Guardfile +1 -1
- data/README.md +41 -53
- data/exe/spigoter +65 -18
- data/lib/spigoter.rb +3 -1
- data/lib/spigoter/cli/cli.rb +12 -16
- data/lib/spigoter/cli/cli_compile.rb +31 -2
- data/lib/spigoter/cli/cli_start.rb +15 -17
- data/lib/spigoter/cli/cli_update.rb +37 -20
- data/lib/spigoter/plugins.rb +5 -6
- data/lib/spigoter/utils.rb +26 -0
- data/lib/spigoter/version.rb +1 -1
- data/lib/spigoter/webapi/curse.rb +2 -24
- data/lib/spigoter/webapi/devbukkit.rb +2 -25
- data/lib/spigoter/webapi/plugin.rb +29 -0
- data/spigoter.gemspec +1 -1
- metadata +9 -6
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Spigoter
|
4
|
+
module Utils
|
5
|
+
def self.download(url)
|
6
|
+
begin
|
7
|
+
file = open(url).read
|
8
|
+
rescue
|
9
|
+
raise "Can't download anything from #{url}, check internet?"
|
10
|
+
end
|
11
|
+
return file
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.which(cmd)
|
15
|
+
# http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
16
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
17
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
18
|
+
exts.each { |ext|
|
19
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
20
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
21
|
+
}
|
22
|
+
end
|
23
|
+
return nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/spigoter/version.rb
CHANGED
@@ -2,25 +2,12 @@ require 'open-uri'
|
|
2
2
|
require 'logging'
|
3
3
|
|
4
4
|
module Spigoter
|
5
|
-
class PluginCurse
|
5
|
+
class PluginCurse < Plugin
|
6
6
|
def initialize(website)
|
7
|
-
|
8
|
-
@main_page # Mainpage content
|
9
|
-
@name # Name of the plugin
|
10
|
-
@download_page # Content of the download page
|
11
|
-
@download_url # Download url of the plugin
|
7
|
+
super(website)
|
12
8
|
|
13
9
|
raise "Bad URL #{@url}" if @url.match(/^http:\/\/mods.curse.com\/bukkit-plugins\/minecraft\/[a-z\-]+$/).nil?
|
14
10
|
end
|
15
|
-
def main_page
|
16
|
-
return @main_page unless @main_page.nil?
|
17
|
-
begin
|
18
|
-
@main_page = open(@url).read
|
19
|
-
rescue
|
20
|
-
raise "404 Error, that plugin URL doesn't exists"
|
21
|
-
end
|
22
|
-
return @main_page
|
23
|
-
end
|
24
11
|
def download_page
|
25
12
|
return @download_page unless @download_page.nil?
|
26
13
|
begin
|
@@ -44,14 +31,5 @@ module Spigoter
|
|
44
31
|
return @name unless @name.nil?
|
45
32
|
@name = /minecraft\/(?<name>.+)/.match(@url)[:name]
|
46
33
|
end
|
47
|
-
def download
|
48
|
-
download_url
|
49
|
-
begin
|
50
|
-
file = open(@download_url).read
|
51
|
-
rescue
|
52
|
-
raise "Can't download file for #{name}, #{@download_url}, check internet?"
|
53
|
-
end
|
54
|
-
return file
|
55
|
-
end
|
56
34
|
end
|
57
35
|
end
|
@@ -2,32 +2,18 @@ require 'open-uri'
|
|
2
2
|
require 'logging'
|
3
3
|
|
4
4
|
module Spigoter
|
5
|
-
class PluginBukkit
|
5
|
+
class PluginBukkit < Plugin
|
6
6
|
def initialize(website)
|
7
|
-
|
8
|
-
@main_page # Mainpage content
|
9
|
-
@name # Name of the plugin
|
10
|
-
@download_page # Content of the download page
|
11
|
-
@download_url # Download url of the plugin
|
7
|
+
super(website)
|
12
8
|
|
13
9
|
raise "Bad URL #{@url}" if @url.match(/http:\/\/dev.bukkit.org\/bukkit-plugins\/[a-z\-]+\/?/).nil?
|
14
10
|
end
|
15
|
-
def main_page
|
16
|
-
return @main_page unless @main_page.nil?
|
17
|
-
begin
|
18
|
-
@main_page = open(@url).read
|
19
|
-
rescue
|
20
|
-
raise "404 Error, that plugin URL doesn't exists"
|
21
|
-
end
|
22
|
-
return @main_page
|
23
|
-
end
|
24
11
|
def download_page
|
25
12
|
return @download_page unless @download_page.nil?
|
26
13
|
main_page
|
27
14
|
url_download_page = @main_page.match(/<a href="(?<download_page_url>.+)">Download/)[:download_page_url]
|
28
15
|
@download_page = open("http://dev.bukkit.org/#{url_download_page}").read
|
29
16
|
# Don't need to begin-rescue, it's done by main_page
|
30
|
-
return @download_page
|
31
17
|
end
|
32
18
|
def download_url
|
33
19
|
return @download_url unless @download_url.nil?
|
@@ -43,14 +29,5 @@ module Spigoter
|
|
43
29
|
return @name unless @name.nil?
|
44
30
|
@name = /ins\/(?<name>[a-z\-]+)\/?/.match(@url)[:name]
|
45
31
|
end
|
46
|
-
def download
|
47
|
-
download_url
|
48
|
-
begin
|
49
|
-
file = open(@download_url).read
|
50
|
-
rescue
|
51
|
-
raise "Can't download file for #{name}, #{@download_url}, check internet?"
|
52
|
-
end
|
53
|
-
return file
|
54
|
-
end
|
55
32
|
end
|
56
33
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'logging'
|
3
|
+
|
4
|
+
module Spigoter
|
5
|
+
class Plugin
|
6
|
+
def initialize(website)
|
7
|
+
@url = website # Url of the plugin
|
8
|
+
#@main_page # Mainpage content
|
9
|
+
#@name # Name of the plugin
|
10
|
+
#@download_page # Content of the download page
|
11
|
+
#@download_url # Download url of the plugin
|
12
|
+
#@regexp # Regexp that matches the URL
|
13
|
+
#@file # Where the file is stored
|
14
|
+
end
|
15
|
+
def main_page
|
16
|
+
return @main_page unless @main_page.nil?
|
17
|
+
begin
|
18
|
+
@main_page = open(@url).read
|
19
|
+
rescue
|
20
|
+
raise "404 Error, that plugin URL doesn't exists"
|
21
|
+
end
|
22
|
+
return @main_page
|
23
|
+
end
|
24
|
+
def file
|
25
|
+
return @file unless @file.nil?
|
26
|
+
@file = Spigoter::Utils.download(download_url) # download_url is implemented in child class
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spigoter.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "guard-bundler", "~> 2.1"
|
36
36
|
spec.add_development_dependency "coveralls", "~> 0.8"
|
37
37
|
spec.add_development_dependency "yard", "~> 0.8"
|
38
|
-
spec.add_development_dependency "
|
38
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.5.0"
|
39
39
|
|
40
40
|
spec.add_runtime_dependency "logging", "~> 2.1"
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spigoter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Ramos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,19 +123,19 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.8'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: codeclimate-test-reporter
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.5.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.5.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: logging
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,12 +158,13 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
+
- ".codeclimate.yml"
|
161
162
|
- ".gitignore"
|
162
163
|
- ".rspec"
|
164
|
+
- ".rubocop.yml"
|
163
165
|
- ".travis.yml"
|
164
166
|
- CODE_OF_CONDUCT.md
|
165
167
|
- Gemfile
|
166
|
-
- Gemfile.lock
|
167
168
|
- Guardfile
|
168
169
|
- LICENSE.txt
|
169
170
|
- README.md
|
@@ -178,9 +179,11 @@ files:
|
|
178
179
|
- lib/spigoter/cli/cli_update.rb
|
179
180
|
- lib/spigoter/log/log.rb
|
180
181
|
- lib/spigoter/plugins.rb
|
182
|
+
- lib/spigoter/utils.rb
|
181
183
|
- lib/spigoter/version.rb
|
182
184
|
- lib/spigoter/webapi/curse.rb
|
183
185
|
- lib/spigoter/webapi/devbukkit.rb
|
186
|
+
- lib/spigoter/webapi/plugin.rb
|
184
187
|
- pkg/.gitignore
|
185
188
|
- spigoter.gemspec
|
186
189
|
- tmp/.gitignore
|