calderin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/calderin +18 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e23b4f4464323f9f56e1d76c3bdd7019d43293e0
|
4
|
+
data.tar.gz: 530fde6559157174f5fb267493daf9fae4c5bb11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2af8cb37a04809f9f0ab27a5a1b7e9500664e88db90df8059e9fe5b45e654f93233b19cb14c34d06488fd8e086ff2d54e877437045bc3665ed3453cb08e34515
|
7
|
+
data.tar.gz: b52ce621d2b0fc56bb28ea9bf7022d3fd056a92a0320782e49bbf6aea45c43366fee1951ed496c7892fc026e938a30c65bfad8db7d8b09c0f8a762b33283144f
|
data/bin/calderin
CHANGED
@@ -46,28 +46,31 @@ when 'message'
|
|
46
46
|
when 'get'
|
47
47
|
messages = JSON.parse(RestClient.get(pond_url))
|
48
48
|
|
49
|
+
new_messages = []
|
49
50
|
messages.each do |message|
|
50
51
|
tmp_file = File.join(pond_directory, '.' + SecureRandom.hex)
|
52
|
+
identifier = Digest::MD5.hexdigest(message)
|
53
|
+
|
54
|
+
# Check if message is already known
|
55
|
+
next if Dir.glob(File.join(pond_directory, "*#{ identifier }*")).any?
|
51
56
|
|
52
57
|
# Attempt to decrypt message into temporary file
|
53
58
|
`echo #{ message } | gpg --decrypt --output #{ tmp_file }`
|
54
59
|
|
55
|
-
# If file exists it means the message is intended for us
|
60
|
+
# If file exists it means the message is intended for us, since
|
61
|
+
# we are checking for identifiers it also means the message is
|
62
|
+
# new if we reached this point in the code.
|
56
63
|
if File.exists?(tmp_file)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
File.rename(tmp_file, file_name)
|
68
|
-
|
69
|
-
puts "New message:\n#{file_name}"
|
70
|
-
end
|
64
|
+
file_name = File.join(pond_directory, Time.now.strftime('%Y-%m-%d_') + identifier)
|
65
|
+
File.rename(tmp_file, file_name)
|
66
|
+
new_messages << file_name
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
unless new_messages.empty?
|
71
|
+
puts "New Messages: \n"
|
72
|
+
new_messages.each do |m|
|
73
|
+
puts m
|
71
74
|
end
|
72
75
|
end
|
73
76
|
when 'inbox'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calderin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PoTe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clap
|