at_email 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ module At_email::Threads ; end
2
+
3
+ require "at_email/threads/thread_queue"
@@ -0,0 +1,83 @@
1
+
2
+ require 'thread'
3
+
4
+ class At_email::Threads::Thread_Queue < At_email::Core::Default
5
+
6
+ CLASS_DISPLAY_NAME = 'Thread Queue'
7
+
8
+ attr_accessor :threads
9
+
10
+ def initialize
11
+ super
12
+ if !@properties
13
+ return false
14
+ end
15
+ @threads = {}
16
+ @properties['Display Name'] = CLASS_DISPLAY_NAME
17
+ @properties['Max Threads'] = 2
18
+ end
19
+
20
+ def activate
21
+ @properties['Activation Time'] = Time.now
22
+ @properties['State'] = 'Active'
23
+ end
24
+
25
+ def queue_thread(code)
26
+ thread_object = At_email::Tasks::TaskThread.new
27
+ thread_id = thread_object['ID']
28
+ @threads[thread_id] = thread_object
29
+ @threads[thread_id].queue(code)
30
+ return thread_id
31
+ end
32
+
33
+ def start_thread(thread_id)
34
+ if get_state() === 'Active'
35
+ @threads[thread_id].start
36
+ else
37
+ formatted_property = get_formatted('State')
38
+ log_string = 'Thread cannot be started as this thread queue is not active - ' + formatted_property
39
+ log_event('W', log_string)
40
+ end
41
+ end
42
+
43
+ def stop_thread(thread_id)
44
+ @threads[thread_id].stop
45
+ end
46
+
47
+ end
48
+
49
+ class At_email::Tasks::TaskThread < At_email::Core::Default
50
+
51
+ CLASS_DISPLAY_NAME = 'Thread'
52
+
53
+ attr_accessor :thread_ref
54
+
55
+ def initialize
56
+ super
57
+ if !@properties
58
+ return false
59
+ end
60
+ @properties['Display Name'] = CLASS_DISPLAY_NAME
61
+ end
62
+
63
+ def queue(code)
64
+ log_string = 'Queueing'
65
+ log_event('D', event_data)
66
+ set('Queue Time', Time.now)
67
+ Thread.abort_on_exception = true
68
+ @thread_ref = Thread.new do
69
+ sleep 0.1
70
+ code
71
+ end
72
+ end
73
+
74
+ def start
75
+ @properties['Start Time'] = Time.now
76
+ end
77
+
78
+ def stop
79
+ @properties['Stop Time'] = Time.now
80
+ Thread.kill(@thread_ref)
81
+ end
82
+
83
+ end
@@ -0,0 +1,10 @@
1
+
2
+ module At_email
3
+
4
+ MAJOR = '0'
5
+ MINOR = '0'
6
+ REVISION = '1'
7
+ PRE = 'alpha'
8
+ VERSION = MAJOR+'.'+MINOR+'.'+REVISION+'-'+PRE
9
+
10
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: at_email
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Robin Patel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: An email management and support toolkit
14
+ email: ruby@42x1.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - bin/at_email
22
+ - lib/at_email.rb
23
+ - lib/at_email/account.rb
24
+ - lib/at_email/account/connection.rb
25
+ - lib/at_email/config.rb
26
+ - lib/at_email/config/cmd_opt_parser.rb
27
+ - lib/at_email/config/config_file.rb
28
+ - lib/at_email/core.rb
29
+ - lib/at_email/core/default.rb
30
+ - lib/at_email/tasks.rb
31
+ - lib/at_email/tasks/imap_to_fs.rb
32
+ - lib/at_email/threads.rb
33
+ - lib/at_email/threads/thread_queue.rb
34
+ - lib/at_email/version.rb
35
+ homepage: ''
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.5.2.3
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: at_Email
59
+ test_files: []