timeclock 0.7.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/timeclock/clock.rb +25 -16
- data/lib/timeclock/version.rb +1 -1
- metadata +2 -2
data/lib/timeclock/clock.rb
CHANGED
@@ -2,6 +2,21 @@ require 'time'
|
|
2
2
|
|
3
3
|
module Timeclock
|
4
4
|
class Clock
|
5
|
+
|
6
|
+
@template = "<pre>
|
7
|
+
Hay. This is the best formatting I can do.. I'm just a meager programmer..
|
8
|
+
<% dl = daily_log %>
|
9
|
+
<% total = dl.delete(:total)%>
|
10
|
+
<% dl.each do |key, value| %>
|
11
|
+
on <%= key.to_s %> I got <%= value[:total] %> hours
|
12
|
+
<% value[:log].each do |ele| %>
|
13
|
+
<%= ele.to_s %>
|
14
|
+
<%end%>
|
15
|
+
<%end%>
|
16
|
+
For a total of <%= total %> hours
|
17
|
+
|
18
|
+
Thank you!
|
19
|
+
</pre>"
|
5
20
|
class << self
|
6
21
|
def home_directory
|
7
22
|
running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
|
@@ -144,27 +159,21 @@ module Timeclock
|
|
144
159
|
puts collect
|
145
160
|
print "who should I send this to: "
|
146
161
|
to = STDIN.gets.strip
|
162
|
+
print "what email should I send it from: "
|
163
|
+
from = STDIN.gets.strip
|
164
|
+
|
147
165
|
# begin
|
148
166
|
require 'pony'
|
149
167
|
require 'erb'
|
150
168
|
|
151
169
|
Pony.mail(
|
152
|
-
:to
|
153
|
-
:from
|
154
|
-
:subject
|
170
|
+
:to => to,
|
171
|
+
:from => from,
|
172
|
+
:subject => "Time card",
|
155
173
|
:content_type => 'text/html',
|
156
|
-
:domain
|
157
|
-
:html_body
|
158
|
-
:body
|
159
|
-
# :via => :smtp, :via_options => {
|
160
|
-
# :address => 'smtp.gmail.com',
|
161
|
-
# :port => '587',
|
162
|
-
# :enable_starttls_auto => true,
|
163
|
-
# :user_name => 'user',
|
164
|
-
# :password => 'password',
|
165
|
-
# :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
166
|
-
# :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
167
|
-
# }
|
174
|
+
:domain => "localhost.localdomain",
|
175
|
+
:html_body => ERB.new(File.new("templates/email.html.erb").read).result(binding),
|
176
|
+
:body => "You are reading this because your email client sux and cant interperate html... fix it."
|
168
177
|
)
|
169
178
|
puts "Time card has been sent to #{to}."
|
170
179
|
# rescue Exception => e
|
@@ -193,7 +202,7 @@ module Timeclock
|
|
193
202
|
|
194
203
|
def clay
|
195
204
|
require 'erb'
|
196
|
-
ERB.new(
|
205
|
+
ERB.new(@template).result(binding)
|
197
206
|
end
|
198
207
|
|
199
208
|
def email
|
data/lib/timeclock/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeclock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-08-26 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple console based clock in/clock out system.
|
15
15
|
email:
|