updown 0.0.1 → 0.1.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/Gemfile.lock +3 -1
- data/README.md +31 -1
- data/bin/updown +8 -0
- data/lib/updown/cli.rb +55 -0
- data/lib/updown/version.rb +1 -1
- data/updown.gemspec +1 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2dbae809fc3ca16f30af62279401f4310eda7db
|
4
|
+
data.tar.gz: 2f582ea04640723eac849cb8d5647c2d1d27a4e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9712a39c483a6dd62d10889519b436e3013218e5a57427ac2e80224113dbf3c75aea9083ff2be3b25fdcaf67d8f214daba49fc6e2bd09703b13272b6e5eb7cd0
|
7
|
+
data.tar.gz: 7167145967a7e8b56104fd312badd76ed0f72ed91bca1685d05e2b0827817398f7a9262f33e07c57bf42e0cfea5bb10ad6ad4dfda326507cf2c9ba746bc1b812
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
updown (0.0
|
4
|
+
updown (0.1.0)
|
5
5
|
gem_config
|
6
6
|
rest-client
|
7
|
+
thor
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -15,6 +16,7 @@ GEM
|
|
15
16
|
rest-client (1.7.3)
|
16
17
|
mime-types (>= 1.16, < 3.0)
|
17
18
|
netrc (~> 0.7)
|
19
|
+
thor (0.19.1)
|
18
20
|
|
19
21
|
PLATFORMS
|
20
22
|
ruby
|
data/README.md
CHANGED
@@ -74,9 +74,39 @@ Delete a specific check:
|
|
74
74
|
check.destroy
|
75
75
|
```
|
76
76
|
|
77
|
+
## Command Line
|
78
|
+
|
79
|
+
This gem also comes with a few commands
|
80
|
+
|
81
|
+
First, configure your API key:
|
82
|
+
|
83
|
+
```
|
84
|
+
$ updown configure YOUR_API_KEY
|
85
|
+
```
|
86
|
+
|
87
|
+
See the status of your checks:
|
88
|
+
|
89
|
+
```
|
90
|
+
$ updown status
|
91
|
+
[up] https://google.com
|
92
|
+
[up] https://bing.com
|
93
|
+
```
|
94
|
+
|
95
|
+
Add a new check:
|
96
|
+
|
97
|
+
```
|
98
|
+
$ updown add https://google.com
|
99
|
+
```
|
100
|
+
|
101
|
+
|
102
|
+
## Todo
|
103
|
+
|
104
|
+
- Write tests!
|
105
|
+
- Error handling
|
106
|
+
|
77
107
|
## Contributing
|
78
108
|
|
79
|
-
1. Fork it ( https://github.com/
|
109
|
+
1. Fork it ( https://github.com/askehansen/updown-ruby/fork )
|
80
110
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
81
111
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
82
112
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bin/updown
ADDED
data/lib/updown/cli.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module Updown
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
desc 'status', 'see the status of all your checks'
|
5
|
+
def status
|
6
|
+
configure_api_key
|
7
|
+
|
8
|
+
Updown::Check.all.each do |check|
|
9
|
+
status = check.down ? 'DOWN' : 'up'
|
10
|
+
puts "[#{status}] #{check.url}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'add URL [PERIOD]', 'add a new check'
|
15
|
+
def add(url, period=60)
|
16
|
+
configure_api_key
|
17
|
+
|
18
|
+
check = Updown::Check.create url, period: period
|
19
|
+
system "open https://updown.io/#{check.token}"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'configure API_KEY', 'set your updown.io api key'
|
23
|
+
def configure(api_key)
|
24
|
+
config = read_config
|
25
|
+
config['api_key'] = api_key
|
26
|
+
|
27
|
+
write_config config
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
CONFIG_FILE = File.expand_path('~/.updown')
|
33
|
+
|
34
|
+
def read_config
|
35
|
+
if File.exist? CONFIG_FILE
|
36
|
+
YAML.load File.read(CONFIG_FILE)
|
37
|
+
else
|
38
|
+
{}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def write_config(config)
|
43
|
+
File.write CONFIG_FILE, config.to_yaml
|
44
|
+
end
|
45
|
+
|
46
|
+
def configure_api_key
|
47
|
+
if api_key = read_config['api_key']
|
48
|
+
Updown.configuration.api_key = api_key
|
49
|
+
else
|
50
|
+
abort "no api key configured!\nrun `updown configure API_KEY`"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
data/lib/updown/version.rb
CHANGED
data/updown.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: updown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aske Hansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: gem_config
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,7 +83,8 @@ dependencies:
|
|
69
83
|
description: A wrapper for the Updown.io API
|
70
84
|
email:
|
71
85
|
- aske@deeco.dk
|
72
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- updown
|
73
88
|
extensions: []
|
74
89
|
extra_rdoc_files: []
|
75
90
|
files:
|
@@ -78,9 +93,11 @@ files:
|
|
78
93
|
- LICENSE.txt
|
79
94
|
- README.md
|
80
95
|
- Rakefile
|
96
|
+
- bin/updown
|
81
97
|
- lib/updown.rb
|
82
98
|
- lib/updown/call.rb
|
83
99
|
- lib/updown/check.rb
|
100
|
+
- lib/updown/cli.rb
|
84
101
|
- lib/updown/downtime.rb
|
85
102
|
- lib/updown/version.rb
|
86
103
|
- updown.gemspec
|