mshard 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mshard/mshard.rb +40 -0
- data/lib/mshard/version.rb +1 -1
- data/lib/mshard.rb +1 -0
- data/mshard.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97c848765701c65aaa2af5eecdaba810c0725cab
|
4
|
+
data.tar.gz: c448405710ac3e989af91ac751a336e8d8374417
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a7dfaf601cc6aeb3746f37ea6d53fe222e1ebf80cbe4080ddce1e77fa5ff54e17da1c33ef8cada4a5d822287a58320ea1700e77e8d570ca36e6acfbd11c96c0
|
7
|
+
data.tar.gz: b5bef3d764095befea6ac97a5f4a4bf10745fbb8a249eb325dd6c301efd0588f8d24d3315de8c3d562e5af025c61351fdfa3f6b508a9a58eb3499a1c35c2baf6
|
data/lib/mshard/mshard.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'httparty'
|
2
|
+
require 'haml'
|
2
3
|
|
3
4
|
module MShard
|
4
5
|
class MShard
|
@@ -12,5 +13,44 @@ module MShard
|
|
12
13
|
def set(params)
|
13
14
|
self.class.post('/v2/shards', body: params)['id']
|
14
15
|
end
|
16
|
+
|
17
|
+
def set_safe(*args)
|
18
|
+
3.times do
|
19
|
+
begin
|
20
|
+
return set(*args)
|
21
|
+
rescue
|
22
|
+
end
|
23
|
+
sleep 2
|
24
|
+
end
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
def error_to_html(e)
|
29
|
+
Haml::Engine.new(<<-HAML).render(Object.new, e: e)
|
30
|
+
!!! 5
|
31
|
+
%html
|
32
|
+
%head
|
33
|
+
%meta{ name: 'viewport', content: 'width=device-width,initial-scale=1.0' }
|
34
|
+
%title Error
|
35
|
+
%body
|
36
|
+
%p
|
37
|
+
%pre
|
38
|
+
&= e.inspect
|
39
|
+
%p
|
40
|
+
%pre
|
41
|
+
&= e.backtrace.join("\\n")
|
42
|
+
HAML
|
43
|
+
end
|
44
|
+
|
45
|
+
def set_error(e, **opt)
|
46
|
+
set_safe({
|
47
|
+
pushbullet: true,
|
48
|
+
type: 'link',
|
49
|
+
title: 'Error!',
|
50
|
+
body: "#{e.class}\nClick here",
|
51
|
+
contents: error_to_html(e),
|
52
|
+
}.merge(opt)
|
53
|
+
)
|
54
|
+
end
|
15
55
|
end
|
16
56
|
end
|
data/lib/mshard/version.rb
CHANGED
data/lib/mshard.rb
CHANGED
data/mshard.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'httparty'
|
22
|
+
spec.add_dependency 'haml'
|
22
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
25
|
spec.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mshard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minwoo Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: haml
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
192
|
version: '0'
|
179
193
|
requirements: []
|
180
194
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.4.6
|
182
196
|
signing_key:
|
183
197
|
specification_version: 4
|
184
198
|
summary: MShard
|