cknife 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -1
- data/Gemfile.lock +28 -25
- data/README.md +89 -64
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/cknifemail +52 -0
- data/cknife.gemspec +18 -11
- data/cknife.yml.sample +13 -0
- data/lib/cknife/config.rb +49 -0
- metadata +75 -28
- checksums.yaml +0 -7
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
cknifedev
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p448
|
data/Gemfile
CHANGED
@@ -4,6 +4,7 @@ gem "rest-client", '>= 1.6'
|
|
4
4
|
gem "nokogiri", '>= 1.6'
|
5
5
|
gem "i18n", "~> 0.6.0"
|
6
6
|
gem "activesupport", '>= 3.0'
|
7
|
+
gem "mail"
|
7
8
|
gem "thor", '>= 0.14'
|
8
9
|
gem "builder", '>= 3.0'
|
9
10
|
gem "fog", '>= 1.15'
|
@@ -12,6 +13,9 @@ gem "unf", '>= 0.1'
|
|
12
13
|
# Add dependencies to develop your gem here.
|
13
14
|
# Include everything needed to run rake, tests, features, etc.
|
14
15
|
group :development do
|
16
|
+
# gem "cknife", :path => "." # this arguably makes it easier to test quickly, locally.
|
15
17
|
gem "bundler", "~> 1.0"
|
16
|
-
gem "jeweler", "
|
18
|
+
gem "jeweler", ">= 2.0"
|
17
19
|
end
|
20
|
+
|
21
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (
|
5
|
-
|
6
|
-
json (~> 1.7, >= 1.7.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
thread_safe (~> 0.1)
|
9
|
-
tzinfo (~> 1.1)
|
4
|
+
activesupport (3.1.12)
|
5
|
+
multi_json (~> 1.0)
|
10
6
|
addressable (2.3.6)
|
11
|
-
builder (3.0.
|
7
|
+
builder (3.0.4)
|
12
8
|
descendants_tracker (0.0.4)
|
13
9
|
thread_safe (~> 0.3, >= 0.3.1)
|
14
10
|
excon (0.27.6)
|
@@ -25,16 +21,16 @@ GEM
|
|
25
21
|
nokogiri (~> 1.5)
|
26
22
|
ruby-hmac
|
27
23
|
formatador (0.2.4)
|
28
|
-
git (1.2.
|
29
|
-
github_api (0.
|
24
|
+
git (1.2.8)
|
25
|
+
github_api (0.12.1)
|
30
26
|
addressable (~> 2.3)
|
31
|
-
descendants_tracker (~> 0.0.
|
27
|
+
descendants_tracker (~> 0.0.4)
|
32
28
|
faraday (~> 0.8, < 0.10)
|
33
|
-
hashie (>=
|
29
|
+
hashie (>= 3.2)
|
34
30
|
multi_json (>= 1.7.5, < 2.0)
|
35
|
-
nokogiri (~> 1.6.
|
31
|
+
nokogiri (~> 1.6.3)
|
36
32
|
oauth2
|
37
|
-
hashie (3.
|
33
|
+
hashie (3.3.1)
|
38
34
|
highline (1.6.21)
|
39
35
|
i18n (0.6.11)
|
40
36
|
jeweler (2.0.1)
|
@@ -48,33 +44,39 @@ GEM
|
|
48
44
|
rdoc
|
49
45
|
json (1.8.1)
|
50
46
|
jwt (1.0.0)
|
47
|
+
mail (2.4.4)
|
48
|
+
i18n (>= 0.4.0)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
51
51
|
mime-types (1.16)
|
52
|
-
mini_portile (0.
|
53
|
-
|
54
|
-
multi_json (1.8.2)
|
52
|
+
mini_portile (0.6.0)
|
53
|
+
multi_json (1.10.1)
|
55
54
|
multi_xml (0.5.5)
|
56
55
|
multipart-post (2.0.0)
|
57
56
|
net-scp (1.1.2)
|
58
57
|
net-ssh (>= 2.6.5)
|
59
58
|
net-ssh (2.7.0)
|
60
|
-
nokogiri (1.6.
|
61
|
-
mini_portile (
|
62
|
-
oauth2 (0.
|
59
|
+
nokogiri (1.6.3.1)
|
60
|
+
mini_portile (= 0.6.0)
|
61
|
+
oauth2 (1.0.0)
|
63
62
|
faraday (>= 0.8, < 0.10)
|
64
63
|
jwt (~> 1.0)
|
65
64
|
multi_json (~> 1.3)
|
66
65
|
multi_xml (~> 0.5)
|
67
66
|
rack (~> 1.2)
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
polyglot (0.3.5)
|
68
|
+
rack (1.3.10)
|
69
|
+
rake (10.3.2)
|
70
|
+
rdoc (4.1.1)
|
71
|
+
json (~> 1.4)
|
71
72
|
rest-client (1.6.3)
|
72
73
|
mime-types (>= 1.16)
|
73
74
|
ruby-hmac (0.4.0)
|
74
75
|
thor (0.14.6)
|
75
76
|
thread_safe (0.3.4)
|
76
|
-
|
77
|
-
|
77
|
+
treetop (1.4.15)
|
78
|
+
polyglot
|
79
|
+
polyglot (>= 0.3.1)
|
78
80
|
unf (0.1.3)
|
79
81
|
unf_ext
|
80
82
|
unf_ext (0.0.6)
|
@@ -88,7 +90,8 @@ DEPENDENCIES
|
|
88
90
|
bundler (~> 1.0)
|
89
91
|
fog (>= 1.15)
|
90
92
|
i18n (~> 0.6.0)
|
91
|
-
jeweler (
|
93
|
+
jeweler (>= 2.0)
|
94
|
+
mail
|
92
95
|
nokogiri (>= 1.6)
|
93
96
|
rest-client (>= 1.6)
|
94
97
|
thor (>= 0.14)
|
data/README.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/cknife.svg)](http://badge.fury.io/rb/cknife)
|
3
3
|
|
4
|
+
# Overview
|
5
|
+
|
6
|
+
Cali Army Knife, or cknife, is a collection of command line tools.
|
7
|
+
It's written in Ruby with Thor, and packaged as a Ruby gem. It
|
8
|
+
depends on the Fog gem for all of it's S3 operations.
|
9
|
+
|
4
10
|
# Installation
|
5
11
|
|
6
12
|
Has been tested successfully on Rubies >= 1.9.2 with activesupport >= 3.
|
7
13
|
|
8
14
|
> gem install cknife
|
15
|
+
|
16
|
+
# Amazon Web Services (AWS) Command Line Interface
|
17
|
+
|
9
18
|
> cknifeaws help
|
10
19
|
Tasks:
|
11
20
|
cknifeaws afew [BUCKET_NAME] # Show first 5 files in bucket
|
@@ -22,9 +31,9 @@ Has been tested successfully on Rubies >= 1.9.2 with activesupport >= 3.
|
|
22
31
|
cknifeaws stop_server [SERVER_ID] # Stop a given EC2 server (does not terminate it)
|
23
32
|
cknifeaws upsync [BUCKET_NAME] [DIRECTORY] # Push local files matching glob PATTERN into bucket. Ignore unchanged files.
|
24
33
|
|
25
|
-
|
34
|
+
### AWS Key and Secret Configuration
|
26
35
|
|
27
|
-
|
36
|
+
Setup your AWS key and secret in any of these methods, in order of priority:
|
28
37
|
|
29
38
|
- $CWD/cknife.yml
|
30
39
|
- $CWD/tmp/cknife.yml
|
@@ -37,34 +46,29 @@ The format of your cknife.yml must be like so:
|
|
37
46
|
key: AKIAblahblahb...
|
38
47
|
secret: 8xILhOsecretsecretsecretsecret...
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
Cali Army Knife, or cknife, is an Amazon Web Services S3 command line
|
43
|
-
tool, and a few other command line tools, packaged as a Ruby
|
44
|
-
gem. Written in Ruby with Thor. It depends on the Fog gem for all of
|
45
|
-
its S3 operations.
|
46
|
-
|
47
|
-
Uses multipart uploads with a chunksize of 10 megabytes to keep RAM
|
48
|
-
usage down.
|
49
|
-
|
50
|
-
The premier feature of the tool is the "upsync" command, which can be
|
51
|
-
used to run a backups schedule with multiple classes of files
|
52
|
-
(partitioned by a glob pattern). **It is your responsibility to
|
53
|
-
generate one uniquely-named backup file per day**, as this tool does
|
54
|
-
not do that part for you.
|
49
|
+
### Upload a local directory into an S3 Bucket
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
Which is also pretty useful.
|
51
|
+
Usage:
|
52
|
+
cknifeaws upsync [BUCKET_NAME] [DIRECTORY]
|
59
53
|
|
60
|
-
|
54
|
+
Options:
|
55
|
+
[--public]
|
56
|
+
[--region=REGION]
|
57
|
+
# Default: us-east-1
|
58
|
+
[--noprompt=NOPROMPT]
|
59
|
+
[--glob=GLOB]
|
60
|
+
# Default: **/*
|
61
|
+
[--backups-retain]
|
62
|
+
[--days-retain=N]
|
63
|
+
# Default: 30
|
64
|
+
[--months-retain=N]
|
65
|
+
# Default: 3
|
66
|
+
[--weeks-retain=N]
|
67
|
+
# Default: 5
|
68
|
+
[--dry-run]
|
61
69
|
|
62
70
|
Some examples:
|
63
71
|
|
64
|
-
Download entire my-photos bucke to CWD
|
65
|
-
|
66
|
-
> cknifeaws download my-photos
|
67
|
-
|
68
72
|
Upload and sync `/tmp/*.sql` into `my-frog-app-backups`
|
69
73
|
bucket. Treat the files as backup files, and keep one backup
|
70
74
|
file for each of the last 5 months, 10 weeks, and 30 days.
|
@@ -88,45 +92,33 @@ let's see what will happen, first.
|
|
88
92
|
|
89
93
|
> cknifeaws upsync my-frog-app-backups ./tmp --glob "*.sql" --noprompt --backups-retain true --months-retain 5 --weeks-retain 10 --days-retain 30 --dry-run
|
90
94
|
|
91
|
-
|
95
|
+
This is the premier feature of the gem.
|
92
96
|
|
93
|
-
|
94
|
-
|
97
|
+
Uses multipart uploads with a chunksize of 10 megabytes to keep RAM
|
98
|
+
usage down.
|
95
99
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
[--days-retain=N]
|
105
|
-
# Default: 30
|
106
|
-
[--months-retain=N]
|
107
|
-
# Default: 3
|
108
|
-
[--weeks-retain=N]
|
109
|
-
# Default: 5
|
110
|
-
[--dry-run]
|
100
|
+
It can be used to run a backups schedule with multiple classes of
|
101
|
+
files (partitioned by a glob pattern). **It is your responsibility to
|
102
|
+
generate one uniquely-named backup file per day**, as this tool does
|
103
|
+
not do that part for you.
|
104
|
+
|
105
|
+
If you *don't* use the `backups-retain` option, then its like a very
|
106
|
+
weak **rsync** that can upload from a local filesystem into a bucket.
|
107
|
+
Which is also pretty useful.
|
111
108
|
|
112
109
|
The glob allows you to determine whether you want to recursively
|
113
110
|
upload an entire directory, or just a set of *.dat or *.sql files,
|
114
111
|
ignoring whatever else may be in the specified directory. This glob
|
115
112
|
pattern is appended to the directory you specify.
|
116
113
|
|
117
|
-
For determining whether to upload a file,
|
118
|
-
and if
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
This info is uploaded with the file to Amazon's S3 servers when the
|
125
|
-
file is uploaded, in the S3 file metadata. Without this, S3 uses a
|
126
|
-
modtime that is equal to when the file was last uploaded, which is not
|
127
|
-
comparable to the file's local mod time.
|
114
|
+
For determining whether to upload a file, it uses the file's local
|
115
|
+
filesystem modification time, and if there is a mismatch then it does
|
116
|
+
an md5 checksum comparison, and if there is a mismatch there, then the
|
117
|
+
local file will replace the remote one in S3. The file's local
|
118
|
+
filesystem modification time is stored on S3 in the S3 object's
|
119
|
+
metadata when the file is uploaded.
|
128
120
|
|
129
|
-
###
|
121
|
+
### Download an S3 bucket to a local directory
|
130
122
|
|
131
123
|
Sometimes you want to download an entire S3 bucket to your local
|
132
124
|
directory - a set of photos, for example.
|
@@ -142,6 +134,34 @@ directory - a set of photos, for example.
|
|
142
134
|
|
143
135
|
Download all files in a bucket to CWD. Or one file.
|
144
136
|
|
137
|
+
Download entire my-photos bucket to CWD
|
138
|
+
|
139
|
+
> cknifeaws download my-photos
|
140
|
+
|
141
|
+
# SMTP Email Command Line Interface
|
142
|
+
|
143
|
+
> cknifemail help
|
144
|
+
Tasks:
|
145
|
+
cknifemail help [TASK] # Describe available tasks or one specific task
|
146
|
+
cknifemail mail [RECIPIENT] [SUBJECT] [TEXT_FILE] # Send an email to recipient.
|
147
|
+
|
148
|
+
Has been tested to work with the SMTP interface that Amazon SES
|
149
|
+
provides, but it should work with Sendgrid and Postmark,
|
150
|
+
or any SMTP service.
|
151
|
+
|
152
|
+
This **requires** the cknife YAML config, with the following field structure.
|
153
|
+
|
154
|
+
mail:
|
155
|
+
from: "Rick Santana <rick.santana@example.com>"
|
156
|
+
authentication: login
|
157
|
+
address: smtp-server
|
158
|
+
port: smtp-port (defaults to 587)
|
159
|
+
username: yoursmtpusername
|
160
|
+
password: yoursmtppassword
|
161
|
+
domain: domain-if-you-like.com
|
162
|
+
|
163
|
+
|
164
|
+
|
145
165
|
# Zerigo Command Line Interface
|
146
166
|
|
147
167
|
The These tasks can be used to manage your DNS via Zerigo. They changed
|
@@ -172,11 +192,9 @@ Options:
|
|
172
192
|
-c Enable colorized output.
|
173
193
|
|
174
194
|
|
175
|
-
#
|
176
|
-
|
177
|
-
Be on master.
|
195
|
+
# Contributing
|
178
196
|
|
179
|
-
|
197
|
+
### Making a release
|
180
198
|
|
181
199
|
One of the following, like patch. This will create a git commit.
|
182
200
|
|
@@ -188,12 +206,19 @@ Create the gem spec.
|
|
188
206
|
|
189
207
|
bundle exec rake gemspec:generate
|
190
208
|
git add -A
|
191
|
-
git commit -m "Generated gemspec for version 0.1.
|
209
|
+
git commit -m "Generated gemspec for version 0.1.4"
|
192
210
|
|
193
|
-
|
211
|
+
Make a gem release. This will generate a commit and a tag for v0.1.2.
|
194
212
|
|
195
|
-
git flow release start rNN
|
196
|
-
git flow release finish rNN
|
197
|
-
git checkout master # I think sometimes release finish moves to develop branch.
|
198
213
|
bundle exec rake release
|
199
214
|
|
215
|
+
### Invoking commands without clobbering the gemspec
|
216
|
+
|
217
|
+
You can uncommente the 'gem cknife' line in the Gemfile.
|
218
|
+
|
219
|
+
This allows you to test your changes without having to run `rake
|
220
|
+
install` if you don't want to, after every file edit.
|
221
|
+
|
222
|
+
Don't generate the gemspec with this on, though, or it'll be a self-dependency
|
223
|
+
which isn't really what we want.
|
224
|
+
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
gem.homepage = "http://github.com/mikedll/cali-army-knife"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = "Cali Army Knife"
|
21
|
-
gem.description = "
|
21
|
+
gem.description = "Cali Army Knife, a collection of command line tools, especially for popular API services."
|
22
22
|
gem.email = "mikedll@mikedll.com"
|
23
23
|
gem.authors = ["Mike De La Loza"]
|
24
24
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/cknifemail
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'mail'
|
5
|
+
require 'cknife/config'
|
6
|
+
|
7
|
+
class CKnifeEmail < Thor
|
8
|
+
|
9
|
+
no_tasks do
|
10
|
+
def config
|
11
|
+
@config ||= CKnife::Config
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "mail [RECIPIENT] [SUBJECT] [TEXT_FILE]", "Send an email to recipient."
|
16
|
+
method_options :from => ""
|
17
|
+
def mail(recipient, subject, text_file)
|
18
|
+
smtp_settings = {
|
19
|
+
:address => config['mail.address'],
|
20
|
+
:port => config['mail.port'] || 587,
|
21
|
+
:domain => config['mail.domain'],
|
22
|
+
:authentication => config['mail.authentication'].to_sym,
|
23
|
+
:user_name => config['mail.username'],
|
24
|
+
:password => config['mail.password'],
|
25
|
+
:enable_starttls_auto => true
|
26
|
+
}
|
27
|
+
|
28
|
+
Mail.defaults do
|
29
|
+
delivery_method :smtp, smtp_settings
|
30
|
+
end
|
31
|
+
|
32
|
+
from = !options[:from].blank? ? options[:from] : config['mail.from']
|
33
|
+
if from.blank?
|
34
|
+
say("No from address found. No action taken.")
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
mail = Mail.new do
|
39
|
+
from from
|
40
|
+
to recipient
|
41
|
+
subject subject
|
42
|
+
body File.read(text_file)
|
43
|
+
end
|
44
|
+
|
45
|
+
mail.deliver
|
46
|
+
|
47
|
+
say("Mail delivered to #{recipient}.")
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
CKnifeEmail.start
|
data/cknife.gemspec
CHANGED
@@ -2,24 +2,24 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: cknife 0.1.3 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "cknife"
|
9
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["Mike De La Loza"]
|
14
12
|
s.date = "2014-09-07"
|
15
|
-
s.description = "
|
13
|
+
s.description = "Cali Army Knife, a collection of command line tools, especially for popular API services."
|
16
14
|
s.email = "mikedll@mikedll.com"
|
17
|
-
s.executables = ["cknifeaws", "cknifedub", "cknifenowtimestamp", "cknifewcdir", "cknifezerigo"]
|
15
|
+
s.executables = ["cknifeaws", "cknifedub", "cknifemail", "cknifenowtimestamp", "cknifewcdir", "cknifezerigo"]
|
18
16
|
s.extra_rdoc_files = [
|
19
17
|
"LICENSE",
|
20
18
|
"README.md"
|
21
19
|
]
|
22
20
|
s.files = [
|
21
|
+
".ruby-gemset",
|
22
|
+
".ruby-version",
|
23
23
|
"Gemfile",
|
24
24
|
"Gemfile.lock",
|
25
25
|
"LICENSE",
|
@@ -28,53 +28,60 @@ Gem::Specification.new do |s|
|
|
28
28
|
"VERSION",
|
29
29
|
"bin/cknifeaws",
|
30
30
|
"bin/cknifedub",
|
31
|
+
"bin/cknifemail",
|
31
32
|
"bin/cknifenowtimestamp",
|
32
33
|
"bin/cknifewcdir",
|
33
34
|
"bin/cknifezerigo",
|
34
|
-
"cknife.gemspec"
|
35
|
+
"cknife.gemspec",
|
36
|
+
"cknife.yml.sample",
|
37
|
+
"lib/cknife/config.rb"
|
35
38
|
]
|
36
39
|
s.homepage = "http://github.com/mikedll/cali-army-knife"
|
37
40
|
s.licenses = ["MIT"]
|
38
|
-
s.
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.rubygems_version = "1.8.28"
|
39
43
|
s.summary = "Cali Army Knife"
|
40
44
|
|
41
45
|
if s.respond_to? :specification_version then
|
42
|
-
s.specification_version =
|
46
|
+
s.specification_version = 3
|
43
47
|
|
44
48
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
49
|
s.add_runtime_dependency(%q<rest-client>, [">= 1.6"])
|
46
50
|
s.add_runtime_dependency(%q<nokogiri>, [">= 1.6"])
|
47
51
|
s.add_runtime_dependency(%q<i18n>, ["~> 0.6.0"])
|
48
52
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
|
53
|
+
s.add_runtime_dependency(%q<mail>, [">= 0"])
|
49
54
|
s.add_runtime_dependency(%q<thor>, [">= 0.14"])
|
50
55
|
s.add_runtime_dependency(%q<builder>, [">= 3.0"])
|
51
56
|
s.add_runtime_dependency(%q<fog>, [">= 1.15"])
|
52
57
|
s.add_runtime_dependency(%q<unf>, [">= 0.1"])
|
53
58
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
54
|
-
s.add_development_dependency(%q<jeweler>, ["
|
59
|
+
s.add_development_dependency(%q<jeweler>, [">= 2.0"])
|
55
60
|
else
|
56
61
|
s.add_dependency(%q<rest-client>, [">= 1.6"])
|
57
62
|
s.add_dependency(%q<nokogiri>, [">= 1.6"])
|
58
63
|
s.add_dependency(%q<i18n>, ["~> 0.6.0"])
|
59
64
|
s.add_dependency(%q<activesupport>, [">= 3.0"])
|
65
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
60
66
|
s.add_dependency(%q<thor>, [">= 0.14"])
|
61
67
|
s.add_dependency(%q<builder>, [">= 3.0"])
|
62
68
|
s.add_dependency(%q<fog>, [">= 1.15"])
|
63
69
|
s.add_dependency(%q<unf>, [">= 0.1"])
|
64
70
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
65
|
-
s.add_dependency(%q<jeweler>, ["
|
71
|
+
s.add_dependency(%q<jeweler>, [">= 2.0"])
|
66
72
|
end
|
67
73
|
else
|
68
74
|
s.add_dependency(%q<rest-client>, [">= 1.6"])
|
69
75
|
s.add_dependency(%q<nokogiri>, [">= 1.6"])
|
70
76
|
s.add_dependency(%q<i18n>, ["~> 0.6.0"])
|
71
77
|
s.add_dependency(%q<activesupport>, [">= 3.0"])
|
78
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
72
79
|
s.add_dependency(%q<thor>, [">= 0.14"])
|
73
80
|
s.add_dependency(%q<builder>, [">= 3.0"])
|
74
81
|
s.add_dependency(%q<fog>, [">= 1.15"])
|
75
82
|
s.add_dependency(%q<unf>, [">= 0.1"])
|
76
83
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
77
|
-
s.add_dependency(%q<jeweler>, ["
|
84
|
+
s.add_dependency(%q<jeweler>, [">= 2.0"])
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
data/cknife.yml.sample
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
key: AKIAblahblahb...
|
3
|
+
secret: 8xILhOsecretsecretsecretsecret...
|
4
|
+
|
5
|
+
|
6
|
+
mail:
|
7
|
+
from: me@mydomain.com
|
8
|
+
authentication: login
|
9
|
+
address: email-smtp.us-west-2.amazonaws.com
|
10
|
+
username: MYSESusername
|
11
|
+
password: MYSESpassword
|
12
|
+
domain: mydomain.com
|
13
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module CKnife
|
2
|
+
class Config
|
3
|
+
def self.config
|
4
|
+
return @config if @config
|
5
|
+
|
6
|
+
@config = {
|
7
|
+
:key => ENV["KEY"] || ENV['AMAZON_ACCESS_KEY_ID'],
|
8
|
+
:secret => ENV["SECRET"] || ENV['AMAZON_SECRET_ACCESS_KEY']
|
9
|
+
}
|
10
|
+
|
11
|
+
config_file = nil
|
12
|
+
Pathname.new(Dir.getwd).tap do |here|
|
13
|
+
config_file = [["cknife.yml"], ["tmp", "cknife.yml"]].map { |args|
|
14
|
+
here.join(*args)
|
15
|
+
}.select { |path|
|
16
|
+
File.exists?(path)
|
17
|
+
}.first
|
18
|
+
end
|
19
|
+
|
20
|
+
if config_file
|
21
|
+
begin
|
22
|
+
@config.merge!(YAML.load(config_file.read))
|
23
|
+
rescue
|
24
|
+
say ("Found, but could not parse config: #{config_file}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
@config
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.[](s)
|
32
|
+
get(s)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.get(path)
|
36
|
+
cur = config
|
37
|
+
path.to_s.split('.').each do |segment|
|
38
|
+
cur = cur[segment.force_encoding('UTF-8').to_s] if cur
|
39
|
+
end
|
40
|
+
|
41
|
+
if cur.nil?
|
42
|
+
cur = ENV[path]
|
43
|
+
end
|
44
|
+
|
45
|
+
cur
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Mike De La Loza
|
@@ -13,149 +14,186 @@ dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rest-client
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '1.6'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.6'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: nokogiri
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '1.6'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '1.6'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: i18n
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: 0.6.0
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: 0.6.0
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: activesupport
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '3.0'
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '3.0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: mail
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: thor
|
71
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
72
98
|
requirements:
|
73
|
-
- -
|
99
|
+
- - ! '>='
|
74
100
|
- !ruby/object:Gem::Version
|
75
101
|
version: '0.14'
|
76
102
|
type: :runtime
|
77
103
|
prerelease: false
|
78
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
79
106
|
requirements:
|
80
|
-
- -
|
107
|
+
- - ! '>='
|
81
108
|
- !ruby/object:Gem::Version
|
82
109
|
version: '0.14'
|
83
110
|
- !ruby/object:Gem::Dependency
|
84
111
|
name: builder
|
85
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
86
114
|
requirements:
|
87
|
-
- -
|
115
|
+
- - ! '>='
|
88
116
|
- !ruby/object:Gem::Version
|
89
117
|
version: '3.0'
|
90
118
|
type: :runtime
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
93
122
|
requirements:
|
94
|
-
- -
|
123
|
+
- - ! '>='
|
95
124
|
- !ruby/object:Gem::Version
|
96
125
|
version: '3.0'
|
97
126
|
- !ruby/object:Gem::Dependency
|
98
127
|
name: fog
|
99
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
100
130
|
requirements:
|
101
|
-
- -
|
131
|
+
- - ! '>='
|
102
132
|
- !ruby/object:Gem::Version
|
103
133
|
version: '1.15'
|
104
134
|
type: :runtime
|
105
135
|
prerelease: false
|
106
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
107
138
|
requirements:
|
108
|
-
- -
|
139
|
+
- - ! '>='
|
109
140
|
- !ruby/object:Gem::Version
|
110
141
|
version: '1.15'
|
111
142
|
- !ruby/object:Gem::Dependency
|
112
143
|
name: unf
|
113
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
114
146
|
requirements:
|
115
|
-
- -
|
147
|
+
- - ! '>='
|
116
148
|
- !ruby/object:Gem::Version
|
117
149
|
version: '0.1'
|
118
150
|
type: :runtime
|
119
151
|
prerelease: false
|
120
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
121
154
|
requirements:
|
122
|
-
- -
|
155
|
+
- - ! '>='
|
123
156
|
- !ruby/object:Gem::Version
|
124
157
|
version: '0.1'
|
125
158
|
- !ruby/object:Gem::Dependency
|
126
159
|
name: bundler
|
127
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
128
162
|
requirements:
|
129
|
-
- -
|
163
|
+
- - ~>
|
130
164
|
- !ruby/object:Gem::Version
|
131
165
|
version: '1.0'
|
132
166
|
type: :development
|
133
167
|
prerelease: false
|
134
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
135
170
|
requirements:
|
136
|
-
- -
|
171
|
+
- - ~>
|
137
172
|
- !ruby/object:Gem::Version
|
138
173
|
version: '1.0'
|
139
174
|
- !ruby/object:Gem::Dependency
|
140
175
|
name: jeweler
|
141
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
142
178
|
requirements:
|
143
|
-
- -
|
179
|
+
- - ! '>='
|
144
180
|
- !ruby/object:Gem::Version
|
145
181
|
version: '2.0'
|
146
182
|
type: :development
|
147
183
|
prerelease: false
|
148
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
149
186
|
requirements:
|
150
|
-
- -
|
187
|
+
- - ! '>='
|
151
188
|
- !ruby/object:Gem::Version
|
152
189
|
version: '2.0'
|
153
|
-
description:
|
154
|
-
|
190
|
+
description: Cali Army Knife, a collection of command line tools, especially for popular
|
191
|
+
API services.
|
155
192
|
email: mikedll@mikedll.com
|
156
193
|
executables:
|
157
194
|
- cknifeaws
|
158
195
|
- cknifedub
|
196
|
+
- cknifemail
|
159
197
|
- cknifenowtimestamp
|
160
198
|
- cknifewcdir
|
161
199
|
- cknifezerigo
|
@@ -164,6 +202,8 @@ extra_rdoc_files:
|
|
164
202
|
- LICENSE
|
165
203
|
- README.md
|
166
204
|
files:
|
205
|
+
- .ruby-gemset
|
206
|
+
- .ruby-version
|
167
207
|
- Gemfile
|
168
208
|
- Gemfile.lock
|
169
209
|
- LICENSE
|
@@ -172,32 +212,39 @@ files:
|
|
172
212
|
- VERSION
|
173
213
|
- bin/cknifeaws
|
174
214
|
- bin/cknifedub
|
215
|
+
- bin/cknifemail
|
175
216
|
- bin/cknifenowtimestamp
|
176
217
|
- bin/cknifewcdir
|
177
218
|
- bin/cknifezerigo
|
178
219
|
- cknife.gemspec
|
220
|
+
- cknife.yml.sample
|
221
|
+
- lib/cknife/config.rb
|
179
222
|
homepage: http://github.com/mikedll/cali-army-knife
|
180
223
|
licenses:
|
181
224
|
- MIT
|
182
|
-
metadata: {}
|
183
225
|
post_install_message:
|
184
226
|
rdoc_options: []
|
185
227
|
require_paths:
|
186
228
|
- lib
|
187
229
|
required_ruby_version: !ruby/object:Gem::Requirement
|
230
|
+
none: false
|
188
231
|
requirements:
|
189
|
-
- -
|
232
|
+
- - ! '>='
|
190
233
|
- !ruby/object:Gem::Version
|
191
234
|
version: '0'
|
235
|
+
segments:
|
236
|
+
- 0
|
237
|
+
hash: 1159768603036288882
|
192
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
|
+
none: false
|
193
240
|
requirements:
|
194
|
-
- -
|
241
|
+
- - ! '>='
|
195
242
|
- !ruby/object:Gem::Version
|
196
243
|
version: '0'
|
197
244
|
requirements: []
|
198
245
|
rubyforge_project:
|
199
|
-
rubygems_version:
|
246
|
+
rubygems_version: 1.8.28
|
200
247
|
signing_key:
|
201
|
-
specification_version:
|
248
|
+
specification_version: 3
|
202
249
|
summary: Cali Army Knife
|
203
250
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: c1293d3d86b51ccb19a9cbb29970bffe45aed92b
|
4
|
-
data.tar.gz: 2e079ea3f28e0ef212a83c92894966bc302d11fe
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: d59dcae7d2f5b8febad7586ab10a383a3822d8107355687c1e3c3796395896c1b84be46ea6e286e21e136b59f24319fcb50fb6b9e9574513440d6a5849b2dd1c
|
7
|
-
data.tar.gz: 405ae32f2af7c2da369be82bf1d285f9a393794c2bac4eb6d7763d499a44ec1ea4e7b692830a462338262415b72276eabeb892c0d32d55470426eac2f667a818
|