please 0.0.2 → 0.0.4
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.
- data/bin/please +44 -3
- metadata +21 -5
data/bin/please
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'pony'
|
5
|
+
require 'active_support/core_ext'
|
5
6
|
|
6
7
|
require ENV['HOME'] + '/.please.rb'
|
7
8
|
@email_address = EMAIL_ADDRESS
|
@@ -36,6 +37,35 @@ require ENV['HOME'] + '/.please.rb'
|
|
36
37
|
@object = ARGV[1]
|
37
38
|
@message = ARGV[2]
|
38
39
|
|
40
|
+
if %w{email sms}.include?(@action)
|
41
|
+
@timer = ARGV[3]
|
42
|
+
@increment = ARGV[4].to_i
|
43
|
+
@unit = ARGV[5]
|
44
|
+
elsif %w{exec}.include?(@action)
|
45
|
+
@timer = ARGV[2]
|
46
|
+
@increment = ARGV[3].to_i
|
47
|
+
@unit = ARGV[4]
|
48
|
+
end
|
49
|
+
|
50
|
+
case @timer
|
51
|
+
when nil
|
52
|
+
# do nothing
|
53
|
+
when 'in'
|
54
|
+
unless @increment.integer? && !@increment.zero?
|
55
|
+
raise "Provided increment is not numeric."
|
56
|
+
end
|
57
|
+
|
58
|
+
unless %w{
|
59
|
+
second seconds minute minutes hour hours day days week weeks fortnight fortnights
|
60
|
+
}.include?(@unit)
|
61
|
+
raise "Provided time unit is not valid."
|
62
|
+
end
|
63
|
+
|
64
|
+
sleep (@increment.send @unit.to_s).to_i
|
65
|
+
else
|
66
|
+
raise "\"#{@timer}\"? What does that mean?"
|
67
|
+
end
|
68
|
+
|
39
69
|
def email(email_address, message)
|
40
70
|
Pony.mail(
|
41
71
|
:to => email_address,
|
@@ -59,14 +89,25 @@ def sms(email_address, message)
|
|
59
89
|
end
|
60
90
|
|
61
91
|
case @action
|
62
|
-
when 'help', nil
|
92
|
+
when 'help', '-h', '--help', nil
|
63
93
|
print '
|
94
|
+
Email, SMS, or arbitrary shell commands:
|
64
95
|
$ please email me "hello"
|
65
96
|
$ please email sally@example.com "Hi Sally."
|
66
97
|
$ please sms me "what is up."
|
67
98
|
$ please sms 8675309@gateway.phonecarrier.com "I CAN HAZ CONVENIENCE"
|
68
|
-
$ please exec "<arbitrary shell command, in quotes>
|
69
|
-
|
99
|
+
$ please exec "<arbitrary shell command, in quotes>"
|
100
|
+
|
101
|
+
Wait a certain amount of time first:
|
102
|
+
$ please sms me "`uptime`" in 5 minutes
|
103
|
+
|
104
|
+
The message being SMSed or Emailed must be all one string to the shell.
|
105
|
+
So, enclose multi-word message, or messages generated form other shell
|
106
|
+
commands or scripts, in quotes.
|
107
|
+
|
108
|
+
https://github.com/jjb/please
|
109
|
+
|
110
|
+
'
|
70
111
|
when 'email'
|
71
112
|
if 'me' == @object
|
72
113
|
ea = @email_address
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: please
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Joseph Bachir
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-25 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,23 @@ dependencies:
|
|
33
33
|
version: "1.0"
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activesupport
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
45
|
+
segments:
|
46
|
+
- 3
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
version: 3.0.0
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
description: " Email, SMS, or arbitrary shell commands:\n $ please email me \"hello\"\n $ please email sally@example.com \"Hi Sally.\"\n $ please sms me \"what is up.\"\n $ please sms 8675309@gateway.phonecarrier.com \"I CAN HAZ CONVENIENCE\"\n $ please exec \"<arbitrary shell command, in quotes>\n\n Wait a certain amount of time first:\n $ please sms me \"`uptime`\" in 5 minutes\n"
|
37
53
|
email: j@jjb.cc
|
38
54
|
executables:
|
39
55
|
- please
|