doneyo 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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/yo +5 -0
- data/doneyo.gemspec +23 -0
- data/lib/doneyo.rb +2 -0
- data/lib/doneyo/version.rb +3 -0
- data/lib/doneyo/yo.rb +64 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 94e3e29852cb13f59332cdfe8c3b5b69f39608e6
|
4
|
+
data.tar.gz: 46cd355bf08ac9bf5ec092486f5d9d439b9624ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7b15053b85eccdbeceb66b1459022140c6d533a36070bc5a16a74d4498645ad1751a556789cc24ce2d8661a79457659f7c8a40191ea937556303adcb93909a0
|
7
|
+
data.tar.gz: a468ebe4c2e2329f4533220e13dc43d61f6a05e0d583085e381523619b88e61a712d8c84ce96eaf3b75c181334f68b90619f7b67ef3e4038a32fe7ca47f10ee4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Shintaro Kojima
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Done Yo
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/codeout/doneyo)
|
4
|
+
|
5
|
+
Yo you when time-consuming shell commands are done.
|
6
|
+
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
Invoke ```yo``` just after a task which takes long is done.
|
11
|
+
|
12
|
+
```shell
|
13
|
+
$ sleep 5; yo
|
14
|
+
```
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
You can choose one of two options:
|
19
|
+
|
20
|
+
### Rubygem
|
21
|
+
|
22
|
+
```shell
|
23
|
+
$ gem install doneyo
|
24
|
+
```
|
25
|
+
|
26
|
+
### Go
|
27
|
+
|
28
|
+
```shell
|
29
|
+
$ go get github.com/codeout/doneyo/go/yo
|
30
|
+
```
|
31
|
+
|
32
|
+
## Configuration
|
33
|
+
|
34
|
+
Doneyo will look in ```~/.yorc``` for your Yo username.
|
35
|
+
|
36
|
+
```
|
37
|
+
# ~/.yorc
|
38
|
+
[user]
|
39
|
+
name = your_yo_username
|
40
|
+
```
|
data/Rakefile
ADDED
data/bin/yo
ADDED
data/doneyo.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'doneyo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'doneyo'
|
8
|
+
spec.version = Doneyo::VERSION
|
9
|
+
spec.authors = ['Shintaro Kojima']
|
10
|
+
spec.email = ['goodies@codeout.net']
|
11
|
+
spec.summary = "Yo you when it's done"
|
12
|
+
spec.description = 'Yo you when time-consuming shell commands are done.'
|
13
|
+
spec.homepage = 'https://github.com/codeout/doneyo'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject{|f| f =~ /^go\// }
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
end
|
data/lib/doneyo.rb
ADDED
data/lib/doneyo/yo.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Doneyo
|
4
|
+
class Yo
|
5
|
+
ENDPOINT = 'http://doneyo.herokuapp.com'
|
6
|
+
CONFIG_FILE_NAME = '.yorc'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def send
|
10
|
+
begin
|
11
|
+
puts new(username).send
|
12
|
+
rescue
|
13
|
+
$stderr.puts $!.to_s
|
14
|
+
abort
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def config_file
|
22
|
+
File.join(ENV['HOME'], CONFIG_FILE_NAME)
|
23
|
+
end
|
24
|
+
|
25
|
+
def username
|
26
|
+
ask_user unless File.exists?(config_file)
|
27
|
+
|
28
|
+
hash = parse_into_hash(File.read(config_file))
|
29
|
+
hash['[user]'] =~ /name\s*=\s(\S+)/
|
30
|
+
$1
|
31
|
+
end
|
32
|
+
|
33
|
+
def ask_user
|
34
|
+
print 'Your Yo username? : '
|
35
|
+
create_config_file gets
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_config_file(user)
|
39
|
+
user = user.to_s.strip
|
40
|
+
raise 'Username required' if user == ''
|
41
|
+
|
42
|
+
open(config_file, 'w') do |f|
|
43
|
+
f.write "[user]\nname = #{user}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_into_hash(string)
|
48
|
+
Hash[
|
49
|
+
string.split(/(\[[^\[\]]+\])/)[1..-1].each_slice(2).to_a
|
50
|
+
]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def initialize(user)
|
56
|
+
@user = user
|
57
|
+
end
|
58
|
+
|
59
|
+
def send
|
60
|
+
response = Net::HTTP.post_form(URI.parse(ENDPOINT), user: @user)
|
61
|
+
response.body
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: doneyo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shintaro Kojima
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Yo you when time-consuming shell commands are done.
|
42
|
+
email:
|
43
|
+
- goodies@codeout.net
|
44
|
+
executables:
|
45
|
+
- yo
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/yo
|
55
|
+
- doneyo.gemspec
|
56
|
+
- lib/doneyo.rb
|
57
|
+
- lib/doneyo/version.rb
|
58
|
+
- lib/doneyo/yo.rb
|
59
|
+
homepage: https://github.com/codeout/doneyo
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Yo you when it's done
|
83
|
+
test_files: []
|
84
|
+
has_rdoc:
|