please 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/please +81 -0
- metadata +81 -0
data/bin/please
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#Configure this!
|
4
|
+
@email_address = 'email@gmail.com'
|
5
|
+
@phone_number = '2128675309'
|
6
|
+
@carrier_gateway = 'txt.att.net'
|
7
|
+
@dydns = "moniker.is-a-geek.com"
|
8
|
+
|
9
|
+
# Main configuration ends! Don't edit anything below this if you use gmail.
|
10
|
+
require 'rubygems'
|
11
|
+
require 'pony'
|
12
|
+
|
13
|
+
# you may have to fiddle with this and delete unused/redundant/old things from your
|
14
|
+
# keychain to make this work. test it in irb.
|
15
|
+
@password = `security 2>&1 >/dev/null find-internet-password -g -s 'www.google.com' -a '#{@email_address}' | cut -d '"' -f 2`.strip
|
16
|
+
|
17
|
+
# Change this is you don't use Gmail
|
18
|
+
@smtp_options = {
|
19
|
+
:address => 'smtp.gmail.com',
|
20
|
+
:port => '587',
|
21
|
+
:enable_starttls_auto => true,
|
22
|
+
:user_name => @email_address,
|
23
|
+
:password => @password,
|
24
|
+
:authentication => :plain,
|
25
|
+
:domain => @dydns
|
26
|
+
}
|
27
|
+
## configuration ends! Don't edit anything below this!
|
28
|
+
|
29
|
+
@action = ARGV[0]
|
30
|
+
@object = ARGV[1]
|
31
|
+
@message = ARGV[2]
|
32
|
+
|
33
|
+
def email(email_address, message)
|
34
|
+
Pony.mail(
|
35
|
+
:to => email_address,
|
36
|
+
:from => @email_address,
|
37
|
+
:subject => message,
|
38
|
+
:body => message,
|
39
|
+
:via => :smtp,
|
40
|
+
:via_options => @smtp_options
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def sms(email_address, message)
|
45
|
+
Pony.mail(
|
46
|
+
:to => email_address,
|
47
|
+
:from => email_address,
|
48
|
+
:subject => '',
|
49
|
+
:body => message,
|
50
|
+
:via => :smtp,
|
51
|
+
:via_options => @smtp_options
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
case @action
|
56
|
+
when 'help', nil
|
57
|
+
print '
|
58
|
+
$ please email me "hello"
|
59
|
+
$ please email sally@example.com "Hi Sally."
|
60
|
+
$ please sms me "what is up."
|
61
|
+
$ please sms 8675309@gateway.phonecarrier.com "I CAN HAZ CONVENIENCE"
|
62
|
+
$ please exec "<arbitrary shell command, in quotes>' +
|
63
|
+
"\n"
|
64
|
+
when 'email'
|
65
|
+
if 'me' == @object
|
66
|
+
ea = @email_address
|
67
|
+
else
|
68
|
+
ea = @object
|
69
|
+
end
|
70
|
+
email(ea, @message)
|
71
|
+
when 'sms'
|
72
|
+
if 'me' == @object
|
73
|
+
ea = "#{@phone_number}@#{@carrier_gateway}"
|
74
|
+
else
|
75
|
+
ea = @object
|
76
|
+
end
|
77
|
+
sms(ea, @message)
|
78
|
+
when 'exec'
|
79
|
+
system @object
|
80
|
+
end
|
81
|
+
# future actions: beep, say something, tweet. yes, tweet.
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: please
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- John Joseph Bachir
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-21 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: pony
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
version: "1.0"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: " You know all that cool stuff that computers and the internet can do\n really easily, but you can't easily tell them when or how to do? Now\n You can.\n"
|
37
|
+
email: j@jjb.cc
|
38
|
+
executables:
|
39
|
+
- please
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- bin/please
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: https://github.com/jjb/please/
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
|
53
|
+
require_paths:
|
54
|
+
- .
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: please
|
76
|
+
rubygems_version: 1.3.7
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Please will do stuff for you.
|
80
|
+
test_files: []
|
81
|
+
|