rest-gw2 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +30 -0
- data/README.md +7 -3
- data/Rakefile +1 -0
- data/TODO.md +26 -0
- data/config.ru +6 -0
- data/lib/rest-gw2.rb +1 -0
- data/lib/rest-gw2/client.rb +249 -110
- data/lib/rest-gw2/client/item_detail.rb +80 -0
- data/lib/rest-gw2/server.rb +5 -583
- data/lib/rest-gw2/server/action.rb +283 -0
- data/lib/rest-gw2/server/cache.rb +14 -4
- data/lib/rest-gw2/server/imp.rb +270 -0
- data/lib/rest-gw2/server/runner.rb +1 -0
- data/lib/rest-gw2/server/view.rb +309 -0
- data/lib/rest-gw2/{view → server/view}/characters.erb +10 -6
- data/lib/rest-gw2/server/view/check_list.erb +10 -0
- data/lib/rest-gw2/server/view/check_percentage.erb +9 -0
- data/lib/rest-gw2/server/view/commerce.erb +24 -0
- data/lib/rest-gw2/{view → server/view}/dyes.erb +7 -7
- data/lib/rest-gw2/server/view/error.erb +1 -0
- data/lib/rest-gw2/server/view/exchange.erb +29 -0
- data/lib/rest-gw2/server/view/guild_info.erb +37 -0
- data/lib/rest-gw2/{view → server/view}/index.erb +0 -0
- data/lib/rest-gw2/{view → server/view}/info.erb +1 -1
- data/lib/rest-gw2/{view → server/view}/item_list.erb +0 -0
- data/lib/rest-gw2/{view/items.erb → server/view/item_section.erb} +0 -0
- data/lib/rest-gw2/{view → server/view}/item_show.erb +7 -1
- data/lib/rest-gw2/server/view/items.erb +8 -0
- data/lib/rest-gw2/server/view/items_from.erb +35 -0
- data/lib/rest-gw2/{view → server/view}/layout.erb +14 -4
- data/lib/rest-gw2/server/view/members.erb +23 -0
- data/lib/rest-gw2/server/view/menu.erb +13 -0
- data/lib/rest-gw2/server/view/menu_armors.erb +17 -0
- data/lib/rest-gw2/server/view/menu_commerce.erb +7 -0
- data/lib/rest-gw2/server/view/menu_guild.erb +11 -0
- data/lib/rest-gw2/server/view/menu_unlocks.erb +11 -0
- data/lib/rest-gw2/{view → server/view}/menu_weapons.erb +2 -1
- data/lib/rest-gw2/{view → server/view}/pages.erb +2 -2
- data/lib/rest-gw2/{view → server/view}/profile.erb +7 -7
- data/lib/rest-gw2/server/view/skins.erb +15 -0
- data/lib/rest-gw2/server/view/stash.erb +10 -0
- data/lib/rest-gw2/server/view/titles.erb +5 -0
- data/lib/rest-gw2/server/view/unlock_percentage.erb +1 -0
- data/lib/rest-gw2/server/view/unlocks_items.erb +5 -0
- data/lib/rest-gw2/server/view/unlocks_list.erb +3 -0
- data/lib/rest-gw2/{view → server/view}/wallet.erb +1 -1
- data/lib/rest-gw2/server/view/wip.erb +1 -0
- data/lib/rest-gw2/version.rb +2 -1
- data/rest-gw2.gemspec +43 -25
- data/task/README.md +8 -8
- data/task/gemgem.rb +29 -7
- metadata +42 -25
- data/lib/rest-gw2/view/error.erb +0 -1
- data/lib/rest-gw2/view/guild.erb +0 -14
- data/lib/rest-gw2/view/items_from.erb +0 -30
- data/lib/rest-gw2/view/menu.erb +0 -16
- data/lib/rest-gw2/view/menu_armors.erb +0 -11
- data/lib/rest-gw2/view/skins.erb +0 -14
- data/lib/rest-gw2/view/transactions.erb +0 -28
- data/lib/rest-gw2/view/wip.erb +0 -1
data/task/README.md
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
|
5
5
|
Provided tasks:
|
6
6
|
|
7
|
-
rake clean #
|
7
|
+
rake clean # Trash ignored files
|
8
8
|
rake gem:build # Build gem
|
9
9
|
rake gem:install # Install gem
|
10
10
|
rake gem:release # Release gem
|
11
11
|
rake gem:spec # Generate gemspec
|
12
|
-
rake test # Run tests
|
12
|
+
rake test # Run tests
|
13
13
|
|
14
14
|
## REQUIREMENTS:
|
15
15
|
|
16
|
-
* Tested with MRI (official CRuby)
|
16
|
+
* Tested with MRI (official CRuby) and JRuby.
|
17
17
|
|
18
18
|
## INSTALLATION:
|
19
19
|
|
@@ -23,13 +23,13 @@ And in Rakefile:
|
|
23
23
|
|
24
24
|
``` ruby
|
25
25
|
begin
|
26
|
-
require "#{
|
26
|
+
require "#{__dir__}/task/gemgem"
|
27
27
|
rescue LoadError
|
28
|
-
sh 'git submodule update --init'
|
28
|
+
sh 'git submodule update --init --recursive'
|
29
29
|
exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
|
30
30
|
end
|
31
31
|
|
32
|
-
Gemgem.init(
|
32
|
+
Gemgem.init(__dir__, :submodules => %w[your-dep]) do |s|
|
33
33
|
s.name = 'your-gem'
|
34
34
|
s.version = '0.1.0'
|
35
35
|
end
|
@@ -37,9 +37,9 @@ end
|
|
37
37
|
|
38
38
|
## LICENSE:
|
39
39
|
|
40
|
-
Apache License 2.0
|
40
|
+
Apache License 2.0 (Apache-2.0)
|
41
41
|
|
42
|
-
Copyright (c) 2011-
|
42
|
+
Copyright (c) 2011-2019, Lin Jen-Shin (godfat)
|
43
43
|
|
44
44
|
Licensed under the Apache License, Version 2.0 (the "License");
|
45
45
|
you may not use this file except in compliance with the License.
|
data/task/gemgem.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module Gemgem
|
3
3
|
class << self
|
4
|
-
attr_accessor :dir, :spec, :spec_create
|
4
|
+
attr_accessor :dir, :spec, :submodules, :spec_create
|
5
5
|
end
|
6
6
|
|
7
7
|
module_function
|
@@ -11,12 +11,14 @@ module Gemgem
|
|
11
11
|
def pkg_dir ; "#{dir}/pkg" ; end
|
12
12
|
def escaped_dir; @escaped_dir ||= Regexp.escape(dir); end
|
13
13
|
|
14
|
-
def init dir, &block
|
14
|
+
def init dir, options={}, &block
|
15
15
|
self.dir = dir
|
16
|
-
$LOAD_PATH.unshift("#{dir}/lib")
|
17
16
|
ENV['RUBYLIB'] = "#{dir}/lib:#{ENV['RUBYLIB']}"
|
18
17
|
ENV['PATH'] = "#{dir}/bin:#{ENV['PATH']}"
|
18
|
+
self.submodules = options[:submodules] || []
|
19
19
|
self.spec_create = block
|
20
|
+
|
21
|
+
$LOAD_PATH.unshift("#{dir}/lib", *submodules_libs)
|
20
22
|
end
|
21
23
|
|
22
24
|
def create
|
@@ -26,7 +28,7 @@ module Gemgem
|
|
26
28
|
|
27
29
|
s.description = description.join
|
28
30
|
s.summary = description.first
|
29
|
-
s.license =
|
31
|
+
s.license = license
|
30
32
|
|
31
33
|
s.date = Time.now.strftime('%Y-%m-%d')
|
32
34
|
s.files = gem_files
|
@@ -115,6 +117,7 @@ module Gemgem
|
|
115
117
|
SimpleCov.start do
|
116
118
|
add_filter('test/')
|
117
119
|
add_filter('test.rb')
|
120
|
+
submodules_libs.each(&method(:add_filter))
|
118
121
|
end
|
119
122
|
end
|
120
123
|
|
@@ -159,11 +162,15 @@ module Gemgem
|
|
159
162
|
end
|
160
163
|
|
161
164
|
def strip_home_path path
|
162
|
-
path.sub(ENV['HOME']
|
165
|
+
path.sub(/\A#{Regexp.escape(ENV['HOME'])}\//, '~/')
|
163
166
|
end
|
164
167
|
|
165
168
|
def strip_cwd_path path
|
166
|
-
path.sub(Dir.pwd
|
169
|
+
path.sub(/\A#{Regexp.escape(Dir.pwd)}\//, '')
|
170
|
+
end
|
171
|
+
|
172
|
+
def submodules_libs
|
173
|
+
submodules.map{ |path| "#{dir}/#{path}/lib" }
|
167
174
|
end
|
168
175
|
|
169
176
|
def git *args
|
@@ -201,6 +208,11 @@ module Gemgem
|
|
201
208
|
@description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines.to_a
|
202
209
|
end
|
203
210
|
|
211
|
+
def license
|
212
|
+
readme['LICENSE'].sub(/.+\n\n/, '').lines.first.
|
213
|
+
split(/[()]/).map(&:strip).reject(&:empty?).last
|
214
|
+
end
|
215
|
+
|
204
216
|
def all_files
|
205
217
|
@all_files ||= fold_files(glob).sort
|
206
218
|
end
|
@@ -221,7 +233,8 @@ module Gemgem
|
|
221
233
|
|
222
234
|
def gem_files
|
223
235
|
@gem_files ||= all_files.reject{ |f|
|
224
|
-
f =~
|
236
|
+
f =~ submodules_pattern ||
|
237
|
+
(f =~ ignored_pattern && !git_files.include?(f))
|
225
238
|
}
|
226
239
|
end
|
227
240
|
|
@@ -253,6 +266,15 @@ module Gemgem
|
|
253
266
|
end
|
254
267
|
end
|
255
268
|
|
269
|
+
def submodules_pattern
|
270
|
+
@submodules_pattern ||= if submodules.empty?
|
271
|
+
/^$/
|
272
|
+
else
|
273
|
+
Regexp.new(submodules.map{ |path|
|
274
|
+
"^#{Regexp.escape(path)}/" }.join('|'))
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
256
278
|
def expand_patterns pathes
|
257
279
|
# http://git-scm.com/docs/gitignore
|
258
280
|
pathes.flat_map{ |path|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-gw2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-core
|
@@ -99,7 +99,7 @@ description: |-
|
|
99
99
|
client built with [rest-core](https://github.com/godfat/rest-core).
|
100
100
|
|
101
101
|
There's also a bundled web application showing your items, serving as an
|
102
|
-
example using the client.
|
102
|
+
example using the client. There's also a [demo site](https://gw2.godfat.org/)
|
103
103
|
email:
|
104
104
|
- godfat (XD) godfat.org
|
105
105
|
executables:
|
@@ -113,34 +113,52 @@ files:
|
|
113
113
|
- LICENSE
|
114
114
|
- README.md
|
115
115
|
- Rakefile
|
116
|
+
- TODO.md
|
116
117
|
- bin/rest-gw2
|
117
118
|
- config.ru
|
118
119
|
- lib/rest-gw2.rb
|
119
120
|
- lib/rest-gw2/client.rb
|
121
|
+
- lib/rest-gw2/client/item_detail.rb
|
120
122
|
- lib/rest-gw2/server.rb
|
123
|
+
- lib/rest-gw2/server/action.rb
|
121
124
|
- lib/rest-gw2/server/cache.rb
|
125
|
+
- lib/rest-gw2/server/imp.rb
|
122
126
|
- lib/rest-gw2/server/runner.rb
|
127
|
+
- lib/rest-gw2/server/view.rb
|
128
|
+
- lib/rest-gw2/server/view/characters.erb
|
129
|
+
- lib/rest-gw2/server/view/check_list.erb
|
130
|
+
- lib/rest-gw2/server/view/check_percentage.erb
|
131
|
+
- lib/rest-gw2/server/view/commerce.erb
|
132
|
+
- lib/rest-gw2/server/view/dyes.erb
|
133
|
+
- lib/rest-gw2/server/view/error.erb
|
134
|
+
- lib/rest-gw2/server/view/exchange.erb
|
135
|
+
- lib/rest-gw2/server/view/guild_info.erb
|
136
|
+
- lib/rest-gw2/server/view/index.erb
|
137
|
+
- lib/rest-gw2/server/view/info.erb
|
138
|
+
- lib/rest-gw2/server/view/item_list.erb
|
139
|
+
- lib/rest-gw2/server/view/item_section.erb
|
140
|
+
- lib/rest-gw2/server/view/item_show.erb
|
141
|
+
- lib/rest-gw2/server/view/items.erb
|
142
|
+
- lib/rest-gw2/server/view/items_from.erb
|
143
|
+
- lib/rest-gw2/server/view/layout.erb
|
144
|
+
- lib/rest-gw2/server/view/members.erb
|
145
|
+
- lib/rest-gw2/server/view/menu.erb
|
146
|
+
- lib/rest-gw2/server/view/menu_armors.erb
|
147
|
+
- lib/rest-gw2/server/view/menu_commerce.erb
|
148
|
+
- lib/rest-gw2/server/view/menu_guild.erb
|
149
|
+
- lib/rest-gw2/server/view/menu_unlocks.erb
|
150
|
+
- lib/rest-gw2/server/view/menu_weapons.erb
|
151
|
+
- lib/rest-gw2/server/view/pages.erb
|
152
|
+
- lib/rest-gw2/server/view/profile.erb
|
153
|
+
- lib/rest-gw2/server/view/skins.erb
|
154
|
+
- lib/rest-gw2/server/view/stash.erb
|
155
|
+
- lib/rest-gw2/server/view/titles.erb
|
156
|
+
- lib/rest-gw2/server/view/unlock_percentage.erb
|
157
|
+
- lib/rest-gw2/server/view/unlocks_items.erb
|
158
|
+
- lib/rest-gw2/server/view/unlocks_list.erb
|
159
|
+
- lib/rest-gw2/server/view/wallet.erb
|
160
|
+
- lib/rest-gw2/server/view/wip.erb
|
123
161
|
- lib/rest-gw2/version.rb
|
124
|
-
- lib/rest-gw2/view/characters.erb
|
125
|
-
- lib/rest-gw2/view/dyes.erb
|
126
|
-
- lib/rest-gw2/view/error.erb
|
127
|
-
- lib/rest-gw2/view/guild.erb
|
128
|
-
- lib/rest-gw2/view/index.erb
|
129
|
-
- lib/rest-gw2/view/info.erb
|
130
|
-
- lib/rest-gw2/view/item_list.erb
|
131
|
-
- lib/rest-gw2/view/item_show.erb
|
132
|
-
- lib/rest-gw2/view/items.erb
|
133
|
-
- lib/rest-gw2/view/items_from.erb
|
134
|
-
- lib/rest-gw2/view/layout.erb
|
135
|
-
- lib/rest-gw2/view/menu.erb
|
136
|
-
- lib/rest-gw2/view/menu_armors.erb
|
137
|
-
- lib/rest-gw2/view/menu_weapons.erb
|
138
|
-
- lib/rest-gw2/view/pages.erb
|
139
|
-
- lib/rest-gw2/view/profile.erb
|
140
|
-
- lib/rest-gw2/view/skins.erb
|
141
|
-
- lib/rest-gw2/view/transactions.erb
|
142
|
-
- lib/rest-gw2/view/wallet.erb
|
143
|
-
- lib/rest-gw2/view/wip.erb
|
144
162
|
- rest-gw2.gemspec
|
145
163
|
- task/README.md
|
146
164
|
- task/gemgem.rb
|
@@ -163,8 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
181
|
- !ruby/object:Gem::Version
|
164
182
|
version: '0'
|
165
183
|
requirements: []
|
166
|
-
|
167
|
-
rubygems_version: 2.5.2
|
184
|
+
rubygems_version: 3.0.1
|
168
185
|
signing_key:
|
169
186
|
specification_version: 4
|
170
187
|
summary: A very simple [Guild Wars 2 API](https://wiki.guildwars2.com/wiki/API:Main)
|
data/lib/rest-gw2/view/error.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<div class="error">Error: <%= h @error %></div>
|
data/lib/rest-gw2/view/guild.erb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<ul class="menu">
|
2
|
-
<% @guilds.each do |guild| %>
|
3
|
-
<li><%= show_guild(guild) %></li>
|
4
|
-
<% end %>
|
5
|
-
</ul>
|
6
|
-
|
7
|
-
<% @stash.each do |upgrade| %>
|
8
|
-
<h2><%= upgrade['name'] %> (<%= price(upgrade['coins'] || 0) %>)</h2>
|
9
|
-
<%= item_wiki(upgrade) %>
|
10
|
-
<%= erb :items, upgrade['inventory'] %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<h2>Treasury</h2>
|
14
|
-
<%= erb :items, @treasury %>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<% if @buy > 0 || @sell > 0 %>
|
2
|
-
Total: <%= price(@buy) %> / <%= price(@sell) %>
|
3
|
-
<% end %>
|
4
|
-
|
5
|
-
<div>
|
6
|
-
<% if @bank.any? %>
|
7
|
-
<h2><%= menu('/bank', 'Bank') %></h2>
|
8
|
-
<%= erb :item_list, @bank %>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<% if @materials.any? %>
|
12
|
-
<h2><%= menu('/materials', 'Materials') %></h2>
|
13
|
-
<%= erb :item_list, @materials %>
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
<% @chars.each do |name, (equipments, bags)| %>
|
17
|
-
<% equipments.each do |eq| %>
|
18
|
-
<h2><%= menu_char(name) %> <%= eq['slot'] %></h2>
|
19
|
-
<%= erb :item_show, eq %>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<% if bags.any? %>
|
23
|
-
<h2><%= menu_char(name) %> Bags</h2>
|
24
|
-
<% bags.each do |b| %>
|
25
|
-
<%= erb :item_show, b %>
|
26
|
-
<%= erb :item_list, b['inventory'] %>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
<% end %>
|
30
|
-
</div>
|
data/lib/rest-gw2/view/menu.erb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
<ul class="menu">
|
2
|
-
<li><%= menu('/', 'Home') %></li>
|
3
|
-
<li><%= menu('/account', 'Account') %></li>
|
4
|
-
<li><%= menu('/characters', 'Characters') %></li>
|
5
|
-
<li><%= menu('/dyes', 'Dyes') %></li>
|
6
|
-
<li><%= menu_skin('/backpacks', 'Skins') %></li>
|
7
|
-
<li><%= menu('/minis', 'Minis') %></li>
|
8
|
-
<li><%= menu('/achievements', 'Achievements') %></li>
|
9
|
-
<li><%= menu('/bank', 'Bank') %></li>
|
10
|
-
<li><%= menu('/materials', 'Materials') %></li>
|
11
|
-
<li><%= menu('/wallet', 'Wallet') %></li>
|
12
|
-
<li><%= menu('/items', 'All Items (very slow)') %></li>
|
13
|
-
<li><%= menu_trans('/buying', 'Transactions') %></li>
|
14
|
-
<li><%= menu('/tokeninfo', 'Info') %></li>
|
15
|
-
<li><a href="<%= refresh_path %>">Refresh</a></li>
|
16
|
-
</ul>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<ul class="menu">
|
2
|
-
<% jellyfish.class.armors.each do |armor| %>
|
3
|
-
<li><%= menu_skin("/armors/#{armor.downcase}/#{@weight}", armor) %></li>
|
4
|
-
<% end %>
|
5
|
-
</ul>
|
6
|
-
|
7
|
-
<ul class="menu">
|
8
|
-
<% jellyfish.class.armors_weight.each do |weight| %>
|
9
|
-
<li><%= menu_skin("/armors/#{@subtype}/#{weight.downcase}", weight) %></li>
|
10
|
-
<% end %>
|
11
|
-
</ul>
|
data/lib/rest-gw2/view/skins.erb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<ul class="menu">
|
2
|
-
<li><%= menu_skin('/backpacks', 'Backpacks') %></li>
|
3
|
-
<li><%= menu_skin('/weapons/greatsword', 'Weapons') %></li>
|
4
|
-
<li><%= menu_skin('/armors/helm/light', 'Armors') %></li>
|
5
|
-
</ul>
|
6
|
-
|
7
|
-
<%= erb @skin_submenu if @skin_submenu %>
|
8
|
-
|
9
|
-
<% if @items.size > 0 %>
|
10
|
-
Unlocked: <%= @unlocked %> / <%= @items.size %>
|
11
|
-
(<%= ((@unlocked.to_f/@items.size)*100).to_i %>%)
|
12
|
-
<% end %>
|
13
|
-
<br/>
|
14
|
-
<%= erb :items, @items %>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<ul class="menu">
|
2
|
-
<li><%= menu_trans('/buying', 'Buying') %></li>
|
3
|
-
<li><%= menu_trans('/selling', 'Selling') %></li>
|
4
|
-
<li><%= menu_trans('/bought', 'Bought') %></li>
|
5
|
-
<li><%= menu_trans('/sold', 'Sold') %></li>
|
6
|
-
</ul>
|
7
|
-
|
8
|
-
<%= erb :pages %>
|
9
|
-
|
10
|
-
Total: <%= price(@total) %>
|
11
|
-
<ul class="item">
|
12
|
-
<% @trans.each do |trans| %>
|
13
|
-
<li>
|
14
|
-
<%= item_wiki(trans) %>
|
15
|
-
<span class="description">
|
16
|
-
<%= item_link(trans) %>
|
17
|
-
<%= h item_count(trans) %>
|
18
|
-
<br/>
|
19
|
-
<%= price(trans['price']) %>
|
20
|
-
<%= abbr_time_ago(trans['purchased'] || trans['created']) %>
|
21
|
-
<br/>
|
22
|
-
<%= item_price(trans) %>
|
23
|
-
</span>
|
24
|
-
</li>
|
25
|
-
<% end %>
|
26
|
-
</ul>
|
27
|
-
|
28
|
-
<%= erb :pages %>
|
data/lib/rest-gw2/view/wip.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= @message || 'Under construction...' %>
|