cknife 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
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 "actionpack", '>= 3.0'
7
8
  gem "mail"
8
9
  gem "thor", '>= 0.14'
9
10
  gem "builder", '>= 3.0'
@@ -1,12 +1,28 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ actionpack (3.1.12)
5
+ activemodel (= 3.1.12)
6
+ activesupport (= 3.1.12)
7
+ builder (~> 3.0.0)
8
+ erubis (~> 2.7.0)
9
+ i18n (~> 0.6)
10
+ rack (~> 1.3.6)
11
+ rack-cache (~> 1.2)
12
+ rack-mount (~> 0.8.2)
13
+ rack-test (~> 0.6.1)
14
+ sprockets (~> 2.0.4)
15
+ activemodel (3.1.12)
16
+ activesupport (= 3.1.12)
17
+ builder (~> 3.0.0)
18
+ i18n (~> 0.6)
4
19
  activesupport (3.1.12)
5
20
  multi_json (~> 1.0)
6
21
  addressable (2.3.6)
7
22
  builder (3.0.4)
8
23
  descendants_tracker (0.0.4)
9
24
  thread_safe (~> 0.3, >= 0.3.1)
25
+ erubis (2.7.0)
10
26
  excon (0.27.6)
11
27
  faraday (0.9.0)
12
28
  multipart-post (>= 1.2, < 3)
@@ -32,6 +48,7 @@ GEM
32
48
  oauth2
33
49
  hashie (3.3.1)
34
50
  highline (1.6.21)
51
+ hike (1.2.3)
35
52
  i18n (0.6.11)
36
53
  jeweler (2.0.1)
37
54
  builder
@@ -66,14 +83,25 @@ GEM
66
83
  rack (~> 1.2)
67
84
  polyglot (0.3.5)
68
85
  rack (1.3.10)
86
+ rack-cache (1.2)
87
+ rack (>= 0.4)
88
+ rack-mount (0.8.3)
89
+ rack (>= 1.0.0)
90
+ rack-test (0.6.2)
91
+ rack (>= 1.0)
69
92
  rake (10.3.2)
70
93
  rdoc (4.1.1)
71
94
  json (~> 1.4)
72
95
  rest-client (1.6.3)
73
96
  mime-types (>= 1.16)
74
97
  ruby-hmac (0.4.0)
98
+ sprockets (2.0.4)
99
+ hike (~> 1.2)
100
+ rack (~> 1.0)
101
+ tilt (~> 1.1, != 1.3.0)
75
102
  thor (0.14.6)
76
103
  thread_safe (0.3.4)
104
+ tilt (1.4.1)
77
105
  treetop (1.4.15)
78
106
  polyglot
79
107
  polyglot (>= 0.3.1)
@@ -85,6 +113,7 @@ PLATFORMS
85
113
  ruby
86
114
 
87
115
  DEPENDENCIES
116
+ actionpack (>= 3.0)
88
117
  activesupport (>= 3.0)
89
118
  builder (>= 3.0)
90
119
  bundler (~> 1.0)
data/README.md CHANGED
@@ -11,6 +11,7 @@ depends on the Fog gem for all of it's S3 operations.
11
11
 
12
12
  Has been tested successfully on Rubies >= 1.9.2 with activesupport >= 3.
13
13
 
14
+ > \curl -sSL https://get.rvm.io | bash -s stable --ruby
14
15
  > gem install cknife
15
16
 
16
17
  # Amazon Web Services (AWS) Command Line Interface
@@ -145,9 +146,27 @@ Download entire my-photos bucket to CWD
145
146
  cknifemail help [TASK] # Describe available tasks or one specific task
146
147
  cknifemail mail [RECIPIENT] [SUBJECT] [TEXT_FILE] # Send an email to recipient.
147
148
 
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.
149
+ Only simple email sending is available here, for now.
150
+
151
+ ### Send an email
152
+
153
+ > bundle exec ./bin/cknifemail help mail
154
+ Usage:
155
+ cknifemail mail [RECIPIENT] [SUBJECT] [TEXT_FILE]
156
+
157
+ Options:
158
+ [--from=FROM]
159
+ [--simple-format]
160
+ # Default: true
161
+
162
+ The `simple_format` option is available to help format plaintext
163
+ emails whose bodies you don't want messed up when newlines are ignored
164
+ with html formatting. This is helpful for when log files are included
165
+ in email bodies, which is the primary expectation for how this will
166
+ be used.
167
+
168
+ Has been successfully tested with the SMTP interface to Amazon SES and
169
+ Sendgrid. Should work with Postmark just fine.
151
170
 
152
171
  This **requires** the cknife YAML config, with the following field structure.
153
172
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -14,6 +14,7 @@ class CKnifeEmail < Thor
14
14
 
15
15
  desc "mail [RECIPIENT] [SUBJECT] [TEXT_FILE]", "Send an email to recipient."
16
16
  method_options :from => ""
17
+ method_options :simple_format => true
17
18
  def mail(recipient, subject, text_file)
18
19
  smtp_settings = {
19
20
  :address => config['mail.address'],
@@ -35,15 +36,24 @@ class CKnifeEmail < Thor
35
36
  return
36
37
  end
37
38
 
39
+ body = File.read(text_file)
40
+ body_html = options[:simple_format] ? CKnife::Formatter.new.simple_format(body) : nil
41
+
38
42
  mail = Mail.new do
39
43
  from from
40
44
  to recipient
41
45
  subject subject
42
- body File.read(text_file)
46
+ body body
47
+
48
+ if body_html
49
+ html_part do
50
+ content_type 'text/html; charset=UTF-8'
51
+ body body_html
52
+ end
53
+ end
43
54
  end
44
55
 
45
56
  mail.deliver
46
-
47
57
  say("Mail delivered to #{recipient}.")
48
58
 
49
59
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cknife"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike De La Loza"]
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.6"])
51
51
  s.add_runtime_dependency(%q<i18n>, ["~> 0.6.0"])
52
52
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
53
+ s.add_runtime_dependency(%q<actionpack>, [">= 3.0"])
53
54
  s.add_runtime_dependency(%q<mail>, [">= 0"])
54
55
  s.add_runtime_dependency(%q<thor>, [">= 0.14"])
55
56
  s.add_runtime_dependency(%q<builder>, [">= 3.0"])
@@ -62,6 +63,7 @@ Gem::Specification.new do |s|
62
63
  s.add_dependency(%q<nokogiri>, [">= 1.6"])
63
64
  s.add_dependency(%q<i18n>, ["~> 0.6.0"])
64
65
  s.add_dependency(%q<activesupport>, [">= 3.0"])
66
+ s.add_dependency(%q<actionpack>, [">= 3.0"])
65
67
  s.add_dependency(%q<mail>, [">= 0"])
66
68
  s.add_dependency(%q<thor>, [">= 0.14"])
67
69
  s.add_dependency(%q<builder>, [">= 3.0"])
@@ -75,6 +77,7 @@ Gem::Specification.new do |s|
75
77
  s.add_dependency(%q<nokogiri>, [">= 1.6"])
76
78
  s.add_dependency(%q<i18n>, ["~> 0.6.0"])
77
79
  s.add_dependency(%q<activesupport>, [">= 3.0"])
80
+ s.add_dependency(%q<actionpack>, [">= 3.0"])
78
81
  s.add_dependency(%q<mail>, [">= 0"])
79
82
  s.add_dependency(%q<thor>, [">= 0.14"])
80
83
  s.add_dependency(%q<builder>, [">= 3.0"])
@@ -1,4 +1,11 @@
1
+ require 'action_view'
2
+
1
3
  module CKnife
4
+ class Formatter
5
+ include ActionView::Helpers::TagHelper
6
+ include ActionView::Helpers::TextHelper
7
+ end
8
+
2
9
  class Config
3
10
  def self.config
4
11
  return @config if @config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '3.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: actionpack
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '3.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: '3.0'
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: mail
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -234,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
250
  version: '0'
235
251
  segments:
236
252
  - 0
237
- hash: 1159768603036288882
253
+ hash: 1454050378644929282
238
254
  required_rubygems_version: !ruby/object:Gem::Requirement
239
255
  none: false
240
256
  requirements: