echi-converter 0.0.3 → 0.0.4
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.
- data/History.txt +15 -1
- data/Manifest.txt +3 -2
- data/README.txt +9 -16
- data/Rakefile +7 -0
- data/bin/echi-converter +129 -0
- data/config/application.yml +9 -2
- data/config/install_files.yml +44 -0
- data/examples/schemas/oracle_echi.sql +129 -0
- data/lib/database.rb +20 -0
- data/lib/echi-converter.rb +6 -8
- data/lib/echi-converter/version.rb +1 -1
- data/lib/main.rb +4 -5
- data/website/index.html +22 -32
- data/website/index.txt +15 -20
- metadata +52 -7
- data/bin/echi-converter-create +0 -76
- data/echi-converter +0 -8
data/History.txt
CHANGED
@@ -24,5 +24,19 @@
|
|
24
24
|
* Added support of processing 'chr' files only (FR#12996)
|
25
25
|
* Added a configuration element to turn logging of file processing to a table on/off
|
26
26
|
* Removed the net/ssh library include, as not using sftp for now
|
27
|
+
* Added dependencies for other gems in the Rakefile for auto-install from Rubyforge
|
27
28
|
* Bug fix(es):
|
28
|
-
* Added proper error handling when ftp user does not have delete rights
|
29
|
+
* Added proper error handling when ftp user does not have delete rights
|
30
|
+
|
31
|
+
== 0.0.4 2007-08-16
|
32
|
+
|
33
|
+
* Major enhancement(s):
|
34
|
+
* Removed the 'echi-conveterter-create' bin file and replaced with 'echi-converter' to have one uniform executable for installation and operation (FR#12784)
|
35
|
+
* Minor enhancement(s):
|
36
|
+
* Added configuration file config/install_files.yml for the new install method
|
37
|
+
* Added support for a monitor process using the Daemons library
|
38
|
+
* Reworked the way you create, run, start and stop a project that has been created, see the README.txt for details as well as the website
|
39
|
+
* Added the ability to set specific table names when using a specific PCO application
|
40
|
+
* Added the ability to upgrade the files when a new gem is installed
|
41
|
+
* Bug fix(es):
|
42
|
+
* Bug #13062 - Corrected log table population
|
data/Manifest.txt
CHANGED
@@ -3,7 +3,6 @@ License.txt
|
|
3
3
|
Manifest.txt
|
4
4
|
README.txt
|
5
5
|
Rakefile
|
6
|
-
echi-converter
|
7
6
|
lib/main.rb
|
8
7
|
lib/echi-converter/version.rb
|
9
8
|
lib/database.rb
|
@@ -22,9 +21,11 @@ config/application.yml
|
|
22
21
|
config/database.yml
|
23
22
|
config/extended_version12.yml
|
24
23
|
config/extended_version13.yml
|
24
|
+
config/install_files.yml
|
25
25
|
db/migrate/001_create_echi_records.rb
|
26
26
|
db/migrate/002_create_echi_logs.rb
|
27
|
-
bin/echi-converter
|
27
|
+
bin/echi-converter
|
28
28
|
examples/extended_version12/chr0003
|
29
29
|
examples/extended_version12/chr0003.txt
|
30
|
+
examples/schemas/oracle_echi.sql
|
30
31
|
|
data/README.txt
CHANGED
@@ -10,24 +10,17 @@ http://support.avaya.com/elmodocs2/cms/R12/ECHI.pdf
|
|
10
10
|
|
11
11
|
--- command ---
|
12
12
|
|
13
|
-
Usage:
|
13
|
+
Usage:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
stop stop all instances of the application
|
18
|
-
restart stop all instances and restart them afterwards
|
19
|
-
run start the application and stay on top
|
20
|
-
zap set the application to a stopped state
|
15
|
+
# echi-converter create myproject - create the local project to run the ECHI converter from
|
16
|
+
# echi-converter upgrade myproject - location of project to upgrade after a new gem is installed
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Common options:
|
28
|
-
-h, --help Show this message
|
29
|
-
--version Show version
|
18
|
+
# echi-converter run myproject - Run the ECHI converter interactively from the location given
|
19
|
+
# echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
|
20
|
+
# echi-converter stop myproject - Stop the ECHI converter daemon
|
21
|
+
# echi-converter restart myproject - Restart the ECHI converter
|
22
|
+
# echi-converter zap myrpoject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files
|
30
23
|
|
31
24
|
--- overview ---
|
32
25
|
|
33
|
-
|
26
|
+
More to come...
|
data/Rakefile
CHANGED
@@ -74,6 +74,13 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
74
74
|
# == Optional
|
75
75
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
76
76
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
77
|
+
p.extra_deps = [
|
78
|
+
['activerecord', '>=1.15.3'],
|
79
|
+
['activesupport', '>=1.4.2'],
|
80
|
+
['daemons', '>=1.0.7'],
|
81
|
+
['fastercsv', '>=1.2.0'],
|
82
|
+
['rake', '>=0.7.3']
|
83
|
+
]
|
77
84
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
78
85
|
end
|
79
86
|
|
data/bin/echi-converter
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'daemons'
|
4
|
+
require 'fileutils'
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
def set_operating_environ
|
8
|
+
#Build details on the gem installed and its location and version
|
9
|
+
gem_searcher = Gem::GemPathSearcher.new
|
10
|
+
@echi_converter_gem = gem_searcher.find('echi-converter')
|
11
|
+
@echi_gem_loc = Gem::dir + '/gems/' + @echi_converter_gem.name + '-' + @echi_converter_gem.version.version
|
12
|
+
end
|
13
|
+
|
14
|
+
#Method for creating the project itself
|
15
|
+
def create_project dir_name
|
16
|
+
if dir_name == nil
|
17
|
+
puts 'You must specify a directory name, proper usage is:'
|
18
|
+
puts 'echi-converter-create /path/to/my/directory'
|
19
|
+
puts 'Exiting...'
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
#Assemble elements to create root directory
|
24
|
+
dest_dir_relative = dir_name || Dir.pwd
|
25
|
+
dest_dir = File.expand_path dest_dir_relative
|
26
|
+
base_dir = File.expand_path File.dirname(__FILE__)
|
27
|
+
|
28
|
+
begin
|
29
|
+
echi_install_conf = YAML::load(File.open("#{@echi_gem_loc}/config/install_files.yml"))
|
30
|
+
#Make root directory of project
|
31
|
+
FileUtils.mkdir dest_dir
|
32
|
+
#Create subdirectories
|
33
|
+
echi_install_conf["dirs_to_create"].each do |dir|
|
34
|
+
FileUtils.mkdir dir_name + '/' + dir["name"]
|
35
|
+
puts 'Created directory: ' + dir_name + '/' + dir["name"]
|
36
|
+
end
|
37
|
+
#Copy files
|
38
|
+
echi_install_conf["files_to_copy"].each do |file|
|
39
|
+
FileUtils.cp "#{@echi_gem_loc}/#{file["name"]}", "#{dest_dir}/#{file["name"]}"
|
40
|
+
puts 'Created file: ' + dir_name + '/' + file["name"]
|
41
|
+
end
|
42
|
+
rescue => err
|
43
|
+
puts err
|
44
|
+
puts 'Fatal...exiting...'
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
puts ''
|
48
|
+
puts 'Successfully created project in directory ' + dest_dir
|
49
|
+
end
|
50
|
+
|
51
|
+
#Stub to allow the upgrade of the project
|
52
|
+
def upgrade_project project_name
|
53
|
+
#Assemble elements to create root directory
|
54
|
+
dest_dir_relative = project_name || Dir.pwd
|
55
|
+
dest_dir = File.expand_path dest_dir_relative
|
56
|
+
base_dir = File.expand_path File.dirname(__FILE__)
|
57
|
+
|
58
|
+
begin
|
59
|
+
echi_install_conf = YAML::load(File.open("#{@echi_gem_loc}/config/install_files.yml"))
|
60
|
+
#Copy files
|
61
|
+
echi_install_conf["files_to_upgrade"].each do |file|
|
62
|
+
FileUtils.cp "#{@echi_gem_loc}/#{file["name"]}", "#{dest_dir}/#{file["name"]}"
|
63
|
+
puts 'Upgraded file: ' + project_name + '/' + file["name"]
|
64
|
+
end
|
65
|
+
rescue => err
|
66
|
+
puts err
|
67
|
+
exit
|
68
|
+
end
|
69
|
+
puts ''
|
70
|
+
puts 'Successfully upgraded ' + project_name
|
71
|
+
end
|
72
|
+
|
73
|
+
#Used launch dynamically or as a deamon
|
74
|
+
def launch_project run_type, project_name
|
75
|
+
|
76
|
+
#Set various file paths
|
77
|
+
pid_directory = project_name + '/log'
|
78
|
+
script_path = project_name + '/lib/main.rb'
|
79
|
+
|
80
|
+
#Build options to run as a daemon
|
81
|
+
options = {
|
82
|
+
:app_name => 'echi-converter',
|
83
|
+
:ARGV => [run_type],
|
84
|
+
:ontop => false,
|
85
|
+
:multiple => false,
|
86
|
+
:backtrace => true,
|
87
|
+
:monitor => true,
|
88
|
+
:dir_mode => :normal,
|
89
|
+
:dir => pid_directory,
|
90
|
+
:script => ''
|
91
|
+
}
|
92
|
+
|
93
|
+
#If set, run interactively and not as a daemon
|
94
|
+
if run_type == 'run'
|
95
|
+
options["ontop"] = true
|
96
|
+
end
|
97
|
+
|
98
|
+
#Daemonize
|
99
|
+
Daemons.run(script_path, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
#We need to locate the echi-converter gem and set some variables
|
103
|
+
set_operating_environ
|
104
|
+
#Display initial banner of information
|
105
|
+
puts '[' + @echi_converter_gem.name + ' ' + @echi_converter_gem.version.version + ']'
|
106
|
+
puts @echi_converter_gem.summary
|
107
|
+
puts ''
|
108
|
+
puts @echi_converter_gem.homepage
|
109
|
+
puts ''
|
110
|
+
|
111
|
+
#Evaluate the selection and execute
|
112
|
+
if ARGV[0] == 'create'
|
113
|
+
create_project ARGV[1]
|
114
|
+
elsif ARGV[0] == 'upgrade'
|
115
|
+
upgrade_project ARGV[1]
|
116
|
+
elsif ARGV[0] == 'run' || ARGV[0] == 'start' || ARGV[0] == 'stop' || ARGV[0] == 'zap' || ARGV[0] == 'restart'
|
117
|
+
launch_project ARGV[0], ARGV[1]
|
118
|
+
else
|
119
|
+
usage = "Usage:
|
120
|
+
echi-converter create myproject - create the local project to run the ECHI converter from
|
121
|
+
echi-converter upgrade myproject - location of project to upgrade after a new gem version is installed
|
122
|
+
|
123
|
+
echi-converter run myproject - Run the ECHI converter interactively from the location given
|
124
|
+
echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
|
125
|
+
echi-converter stop myproject - Stop the ECHI converter daemon
|
126
|
+
echi-converter restart myproject - Restart the ECHI converter
|
127
|
+
echi-converter zap myproject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files"
|
128
|
+
puts usage
|
129
|
+
end
|
data/config/application.yml
CHANGED
@@ -11,7 +11,7 @@ echi_ftp_retry: 3
|
|
11
11
|
echi_ftp_delete: N #to not delete the files off of the FTP server set to N
|
12
12
|
echi_schema: extended_version13.yml
|
13
13
|
echi_format: ASCII #valid settings are ASCII or BINARY
|
14
|
-
echi_process_log:
|
14
|
+
echi_process_log: Y #valid is Y/N to turn it on or off
|
15
15
|
|
16
16
|
#Currently only ftp supported, but may want to add UUCP/Serial later
|
17
17
|
echi_xfer_type: ftp
|
@@ -33,4 +33,11 @@ log_level: DEBUG
|
|
33
33
|
#How many log files to create and the length before cycling through
|
34
34
|
log_number: 10
|
35
35
|
#The size of each individual log file
|
36
|
-
log_length: 10240000
|
36
|
+
log_length: 10240000
|
37
|
+
|
38
|
+
#Special settings for a specific application database
|
39
|
+
pco_process: N #Set to yes or no if running with a PCO database
|
40
|
+
pco_record_tablename: PCO_ECHIRECORD
|
41
|
+
pco_record_seqname: PCO_ECHIRECORDSEQ
|
42
|
+
pco_log_tablename: PCO_ECHILOG
|
43
|
+
pco_log_seqname: PCO_ECHILOGSEQ
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#Lets the echi-conveter-create utility know which files and directories to load
|
2
|
+
dirs_to_create:
|
3
|
+
- name: test
|
4
|
+
- name: config
|
5
|
+
- name: log
|
6
|
+
- name: csv
|
7
|
+
- name: files
|
8
|
+
- name: files/to_process
|
9
|
+
- name: files/processed
|
10
|
+
- name: db
|
11
|
+
- name: db/migrate
|
12
|
+
- name: examples
|
13
|
+
- name: examples/extended_version12
|
14
|
+
- name: examples/schemas
|
15
|
+
- name: lib
|
16
|
+
- name: lib/echi-converter
|
17
|
+
|
18
|
+
files_to_copy:
|
19
|
+
- name: History.txt
|
20
|
+
- name: License.txt
|
21
|
+
- name: Manifest.txt
|
22
|
+
- name: README.txt
|
23
|
+
- name: Rakefile
|
24
|
+
- name: test/test_echi-converter.rb
|
25
|
+
- name: test/test_helper.rb
|
26
|
+
- name: config/application.yml
|
27
|
+
- name: config/database.yml
|
28
|
+
- name: config/extended_version12.yml
|
29
|
+
- name: config/extended_version13.yml
|
30
|
+
- name: db/migrate/001_create_echi_records.rb
|
31
|
+
- name: db/migrate/002_create_echi_logs.rb
|
32
|
+
- name: examples/extended_version12/chr0003
|
33
|
+
- name: examples/extended_version12/chr0003.txt
|
34
|
+
- name: lib/database.rb
|
35
|
+
- name: lib/echi-converter.rb
|
36
|
+
- name: lib/main.rb
|
37
|
+
- name: lib/echi-converter/version.rb
|
38
|
+
- name: examples/schemas/oracle_echi.sql
|
39
|
+
|
40
|
+
files_to_upgrade:
|
41
|
+
- name: lib/database.rb
|
42
|
+
- name: lib/echi-converter.rb
|
43
|
+
- name: lib/main.rb
|
44
|
+
- name: lib/echi-converter/version.rb
|
@@ -0,0 +1,129 @@
|
|
1
|
+
CREATE TABLE PCO_ECHILOG (
|
2
|
+
ID NUMBER,
|
3
|
+
FILENAME VARCHAR2(10),
|
4
|
+
FILENUMBER NUMBER,
|
5
|
+
VERSION NUMBER,
|
6
|
+
RECORDS VARCHAR2(2),
|
7
|
+
PROCESSEDAT DATE
|
8
|
+
);
|
9
|
+
|
10
|
+
ALTER TABLE PCO_ECHILOG ADD CONSTRAINT PCO_ECHILOGPK PRIMARY KEY (ID)
|
11
|
+
USING INDEX TABLESPACE PINDEX;
|
12
|
+
ALTER TABLE PCO_ECHILOG ENABLE CONSTRAINT PCO_ECHILOGPK;
|
13
|
+
|
14
|
+
CREATE SEQUENCE PCO_ECHILOGSEQ ORDER;
|
15
|
+
|
16
|
+
CREATE OR REPLACE TRIGGER PCO_ECHILOGTRG BEFORE INSERT ON PCO_ECHILOG
|
17
|
+
REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE
|
18
|
+
TEMP NUMBER;
|
19
|
+
BEGIN
|
20
|
+
|
21
|
+
SELECT PCO_ECHILOGSEQ.NEXTVAL
|
22
|
+
INTO TEMP
|
23
|
+
FROM DUAL;
|
24
|
+
|
25
|
+
:NEW.ID:=TEMP;
|
26
|
+
|
27
|
+
END;
|
28
|
+
/
|
29
|
+
|
30
|
+
CREATE TABLE PCO_ECHIRECORD (
|
31
|
+
ID NUMBER,
|
32
|
+
CALLID NUMBER,
|
33
|
+
ACWTIME NUMBER,
|
34
|
+
ONHOLDTIME NUMBER,
|
35
|
+
CONSULTTIME NUMBER,
|
36
|
+
DISPTIME NUMBER,
|
37
|
+
DURATION NUMBER,
|
38
|
+
SEGSTART DATE,
|
39
|
+
SEGSTOP DATE,
|
40
|
+
TALKTIME NUMBER,
|
41
|
+
NETINTIME NUMBER,
|
42
|
+
ORIGHOLDTIME NUMBER,
|
43
|
+
QUEUETIME NUMBER,
|
44
|
+
RINGTIME NUMBER,
|
45
|
+
DISPIVECTOR NUMBER,
|
46
|
+
DISPSPLIT NUMBER,
|
47
|
+
FIRSTIVECTOR NUMBER,
|
48
|
+
SPLIT1 NUMBER,
|
49
|
+
SPLIT2 NUMBER,
|
50
|
+
SPLIT3 NUMBER,
|
51
|
+
TRUNGROUP NUMBER,
|
52
|
+
TKLOCID NUMBER,
|
53
|
+
ORIGLOCID NUMBER,
|
54
|
+
ANSWERLOCID NUMBER,
|
55
|
+
OBSLOCID NUMBER,
|
56
|
+
UUILEN NUMBER,
|
57
|
+
ASSIST CHAR(1),
|
58
|
+
AUDIODIFFICULTY CHAR(1),
|
59
|
+
CONFERENCE CHAR(1),
|
60
|
+
DAQUEUED CHAR(1),
|
61
|
+
HOLDABN CHAR(1),
|
62
|
+
MALICIOUS CHAR(1),
|
63
|
+
OBSERVINGCALL CHAR(1),
|
64
|
+
TRANSFERRED CHAR(1),
|
65
|
+
AGENTRELEASED CHAR(1),
|
66
|
+
ACDNUM NUMBER,
|
67
|
+
CALLDISP NUMBER,
|
68
|
+
DISPPRIORITY NUMBER,
|
69
|
+
HOLDS NUMBER,
|
70
|
+
SEGMENT NUMBER,
|
71
|
+
ANSREASON NUMBER,
|
72
|
+
ORIGREASON NUMBER,
|
73
|
+
DISPSKLEVEL NUMBER,
|
74
|
+
EVENTS0 NUMBER,
|
75
|
+
EVENTS1 NUMBER,
|
76
|
+
EVENTS2 NUMBER,
|
77
|
+
EVENTS3 NUMBER,
|
78
|
+
EVENTS4 NUMBER,
|
79
|
+
EVENTS5 NUMBER,
|
80
|
+
EVENTS6 NUMBER,
|
81
|
+
EVENTS7 NUMBER,
|
82
|
+
EVENTS8 NUMBER,
|
83
|
+
UCID VARCHAR2(21),
|
84
|
+
DISPVDN VARCHAR2(8),
|
85
|
+
EQLOC VARCHAR2(10),
|
86
|
+
FIRSTVDN VARCHAR2(8),
|
87
|
+
ORIGLOGID VARCHAR2(10),
|
88
|
+
ANSLOGID VARCHAR2(10),
|
89
|
+
LASTOBSERVER VARCHAR2(10),
|
90
|
+
DIALEDNUMBER VARCHAR2(25),
|
91
|
+
CALLINGPARTY VARCHAR2(13),
|
92
|
+
COLLECTDIGITS VARCHAR2(17),
|
93
|
+
CWCDIGITS VARCHAR2(17),
|
94
|
+
CALLINGII VARCHAR2(3),
|
95
|
+
CWCS0 VARCHAR2(17),
|
96
|
+
CWCS1 VARCHAR2(17),
|
97
|
+
CWCS2 VARCHAR2(17),
|
98
|
+
CWCS3 VARCHAR2(17),
|
99
|
+
CWCS4 VARCHAR2(17),
|
100
|
+
VDN2 VARCHAR2(8),
|
101
|
+
VDN3 VARCHAR2(8),
|
102
|
+
VDN4 VARCHAR2(8),
|
103
|
+
VDN5 VARCHAR2(8),
|
104
|
+
VDN6 VARCHAR2(8),
|
105
|
+
VDN7 VARCHAR2(8),
|
106
|
+
VDN8 VARCHAR2(8),
|
107
|
+
VDN9 VARCHAR2(8),
|
108
|
+
ASAIUUI VARCHAR2(96)
|
109
|
+
);
|
110
|
+
|
111
|
+
ALTER TABLE PCO_ECHIRECORD ADD CONSTRAINT PCO_ECHIRECORDPK PRIMARY KEY (ID)
|
112
|
+
USING INDEX TABLESPACE PINDEX;
|
113
|
+
ALTER TABLE PCO_ECHIRECORD ENABLE CONSTRAINT PCO_ECHIRECORDPK;
|
114
|
+
|
115
|
+
CREATE SEQUENCE PCO_ECHIRECORDSEQ ORDER;
|
116
|
+
|
117
|
+
CREATE OR REPLACE TRIGGER PCO_ECHIRECORDTRG BEFORE INSERT ON PCO_ECHIRECORD
|
118
|
+
REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE
|
119
|
+
TEMP NUMBER;
|
120
|
+
BEGIN
|
121
|
+
|
122
|
+
SELECT PCO_ECHIRECORDSEQ.NEXTVAL
|
123
|
+
INTO TEMP
|
124
|
+
FROM DUAL;
|
125
|
+
|
126
|
+
:NEW.ID:=TEMP;
|
127
|
+
|
128
|
+
END;
|
129
|
+
/
|
data/lib/database.rb
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
class EchiRecord < ActiveRecord::Base
|
2
|
+
#Determine our working directory
|
3
|
+
workingdirectory = File.expand_path(File.dirname(__FILE__))
|
4
|
+
#Open the configuration file
|
5
|
+
configfile = workingdirectory + '/../config/application.yml'
|
6
|
+
config = YAML::load(File.open(configfile))
|
7
|
+
|
8
|
+
if config["pco_process"] == 'Y'
|
9
|
+
set_table_name config["pco_record_tablename"]
|
10
|
+
set_sequence_name config["pco_record_seqname"]
|
11
|
+
end
|
2
12
|
end
|
3
13
|
|
4
14
|
class EchiLog < ActiveRecord::Base
|
15
|
+
#Determine our working directory
|
16
|
+
workingdirectory = File.expand_path(File.dirname(__FILE__))
|
17
|
+
#Open the configuration file
|
18
|
+
configfile = workingdirectory + '/../config/application.yml'
|
19
|
+
config = YAML::load(File.open(configfile))
|
20
|
+
|
21
|
+
if config["pco_process"] == 'Y'
|
22
|
+
set_table_name @config["pco_log_tablename"]
|
23
|
+
set_sequence_name @config["pco_log_seqname"]
|
24
|
+
end
|
5
25
|
end
|
data/lib/echi-converter.rb
CHANGED
@@ -2,8 +2,6 @@ require 'rubygems'
|
|
2
2
|
require 'active_record'
|
3
3
|
require 'faster_csv'
|
4
4
|
require 'net/ftp'
|
5
|
-
#require 'net/ssh'
|
6
|
-
#require 'net/sftp'
|
7
5
|
require 'fileutils'
|
8
6
|
|
9
7
|
class Logger
|
@@ -110,7 +108,7 @@ module EchiConverter
|
|
110
108
|
fileversion = dump_binary 'int', 4
|
111
109
|
@log.debug "Version " + fileversion.to_s
|
112
110
|
|
113
|
-
if @config["echi_process_log"] == "
|
111
|
+
if @config["echi_process_log"] == "Y"
|
114
112
|
#Log the file
|
115
113
|
echi_log = EchiLog.new
|
116
114
|
echi_log.filename = filename
|
@@ -160,7 +158,7 @@ module EchiConverter
|
|
160
158
|
destination_directory = @workingdirectory + '/../files/processed/'
|
161
159
|
FileUtils.mv(echi_file, destination_directory)
|
162
160
|
|
163
|
-
if @config["echi_process_log"] == "
|
161
|
+
if @config["echi_process_log"] == "Y"
|
164
162
|
#Finish logging the details on the file
|
165
163
|
echi_log.records = record_cnt
|
166
164
|
echi_log.processed_at = Time.now
|
@@ -238,12 +236,12 @@ end
|
|
238
236
|
def process_ascii filename
|
239
237
|
echi_file = @workingdirectory + "/../files/to_process/" + filename
|
240
238
|
|
241
|
-
if @config["echi_process_log"] == "
|
239
|
+
if @config["echi_process_log"] == "Y"
|
242
240
|
#Log the file
|
243
241
|
echi_log = EchiLog.new
|
244
242
|
echi_log.filename = filename
|
245
|
-
echi_log.filenumber = filenumber
|
246
|
-
echi_log.version = fileversion
|
243
|
+
#echi_log.filenumber = filenumber
|
244
|
+
#echi_log.version = fileversion
|
247
245
|
end
|
248
246
|
|
249
247
|
record_cnt = 0
|
@@ -275,7 +273,7 @@ def process_ascii filename
|
|
275
273
|
end
|
276
274
|
end
|
277
275
|
|
278
|
-
if @config["echi_process_log"] == "
|
276
|
+
if @config["echi_process_log"] == "Y"
|
279
277
|
#Finish logging the details on the file
|
280
278
|
echi_log.records = record_cnt
|
281
279
|
echi_log.processed_at = Time.now
|
data/lib/main.rb
CHANGED
@@ -6,14 +6,13 @@ require 'yaml'
|
|
6
6
|
require @workingdirectory + '/echi-converter.rb'
|
7
7
|
include EchiConverter
|
8
8
|
|
9
|
-
#Load ActiveRecord Models
|
10
|
-
require @workingdirectory + '/database.rb'
|
11
|
-
|
12
|
-
configfile = @workingdirectory + '/../config/application.yml'
|
13
|
-
|
14
9
|
#Open the configuration file
|
10
|
+
configfile = @workingdirectory + '/../config/application.yml'
|
15
11
|
@config = YAML::load(File.open(configfile))
|
16
12
|
|
13
|
+
#Load ActiveRecord Models
|
14
|
+
require @workingdirectory + '/database.rb'
|
15
|
+
|
17
16
|
#Load the configured schema
|
18
17
|
schemafile = @workingdirectory + "/../config/" + @config["echi_schema"]
|
19
18
|
@echi_schema = YAML::load(File.open(schemafile))
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>ECHI Converter</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/echi-converter"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/echi-converter" class="numbers">0.0.
|
36
|
+
<a href="http://rubyforge.org/projects/echi-converter" class="numbers">0.0.4</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘echi-converter’</h1>
|
39
39
|
|
@@ -66,6 +66,15 @@
|
|
66
66
|
</ol>
|
67
67
|
|
68
68
|
|
69
|
+
<ol>
|
70
|
+
<li>Table names:
|
71
|
+
<ol>
|
72
|
+
<li>echi_records – stores all <span class="caps">ECHI</span> data </li>
|
73
|
+
<li>echi_logs – stores a log entry for each file processed</li>
|
74
|
+
</ol></li>
|
75
|
+
</ol>
|
76
|
+
|
77
|
+
|
69
78
|
<h2>Requirements</h2>
|
70
79
|
|
71
80
|
|
@@ -91,7 +100,7 @@
|
|
91
100
|
<p>First, create the directory with all of the project files where you will run this application from:</p>
|
92
101
|
|
93
102
|
|
94
|
-
<pre syntax="ruby">echi-converter
|
103
|
+
<pre syntax="ruby">echi-converter create myproject</pre>
|
95
104
|
|
96
105
|
<p>Once you have installed a project into your preferred directory, you then need to configure for your environment. The first step is to modify each of these files:</p>
|
97
106
|
|
@@ -99,7 +108,7 @@
|
|
99
108
|
<ol>
|
100
109
|
<li>config/application.yml
|
101
110
|
<ol>
|
102
|
-
<li>Change each of the ‘echi’ settings for connecting to your local <span class="caps">FTP</span> server where the <span class="caps">CMS</span> puts the binary files</li>
|
111
|
+
<li>Change each of the ‘echi’ settings for connecting to your local <span class="caps">FTP</span> server where the <span class="caps">CMS</span> puts the <span class="caps">ASCII</span>/binary files</li>
|
103
112
|
<li>Select which schema you would like to use (ie – extended_version12.yml) based on what you have in place</li>
|
104
113
|
</ol>
|
105
114
|
</li>
|
@@ -122,36 +131,18 @@
|
|
122
131
|
<h2>Usage</h2>
|
123
132
|
|
124
133
|
|
125
|
-
<p>Usage: echi-converter command options</p>
|
126
|
-
|
127
|
-
|
128
|
-
<ol>
|
129
|
-
<li>where command is one of:
|
130
|
-
<ol>
|
131
|
-
<li>start start an instance of the application</li>
|
132
|
-
<li>stop stop all instances of the application</li>
|
133
|
-
<li>restart stop all instances and restart them afterwards</li>
|
134
|
-
<li>run start the application and stay on top</li>
|
135
|
-
<li>zap set the application to a stopped state</li>
|
136
|
-
</ol></li>
|
137
|
-
</ol>
|
138
|
-
|
139
|
-
|
140
134
|
<ol>
|
141
|
-
<li>
|
142
|
-
|
143
|
-
<li>-t,—ontop Stay on top (does not daemonize)</li>
|
144
|
-
<li>-f,—force Force operation</li>
|
145
|
-
</ol></li>
|
135
|
+
<li>echi-converter create myproject – create the local project to run the <span class="caps">ECHI</span> converter from</li>
|
136
|
+
<li>echi-converter upgrade myproject – location of project to upgrade after a new gem is installed</li>
|
146
137
|
</ol>
|
147
138
|
|
148
139
|
|
149
140
|
<ol>
|
150
|
-
<li>
|
151
|
-
|
152
|
-
|
153
|
-
<li
|
154
|
-
|
141
|
+
<li>echi-converter run myproject – Run the <span class="caps">ECHI</span> converter interactively from the location given</li>
|
142
|
+
<li>echi-converter start myproject – Start the <span class="caps">ECHI</span> converter in daemon mode from the location given</li>
|
143
|
+
<li>echi-converter stop myproject – Stop the <span class="caps">ECHI</span> converter daemon</li>
|
144
|
+
<li>echi-converter restart myproject – Restart the <span class="caps">ECHI</span> converter </li>
|
145
|
+
<li>echi-converter zap myrpoject – If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files</li>
|
155
146
|
</ol>
|
156
147
|
|
157
148
|
|
@@ -161,12 +152,12 @@
|
|
161
152
|
<p>Start the daemon/service:</p>
|
162
153
|
|
163
154
|
|
164
|
-
<pre syntax="ruby">echi-converter start</pre>
|
155
|
+
<pre syntax="ruby">echi-converter start myproject</pre>
|
165
156
|
|
166
157
|
<p>Stop the daemon/service:</p>
|
167
158
|
|
168
159
|
|
169
|
-
<pre syntax="ruby">echi-converter stop</pre>
|
160
|
+
<pre syntax="ruby">echi-converter stop myproject</pre>
|
170
161
|
|
171
162
|
<h2>ToDo</h2>
|
172
163
|
|
@@ -176,7 +167,6 @@
|
|
176
167
|
|
177
168
|
<ol>
|
178
169
|
<li>‘echi-converter-create’ works fine with <span class="caps">OSX</span>/Linux, need to test validate with a Win32 platform</li>
|
179
|
-
<li>Determine what to do with the files on the <span class="caps">FTP</span> server of the Avaya <span class="caps">CMS</span>, delete them or leave them and add methods to ensure no duplication</li>
|
180
170
|
</ol>
|
181
171
|
|
182
172
|
|
@@ -206,7 +196,7 @@
|
|
206
196
|
|
207
197
|
<p>Comments are welcome. Send an email to <a href="mailto:jason@goecke.net">jason [at] goecke.net</a>.</p>
|
208
198
|
<p class="coda">
|
209
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
199
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 16th August 2007<br>
|
210
200
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
211
201
|
</p>
|
212
202
|
</div>
|
data/website/index.txt
CHANGED
@@ -23,6 +23,10 @@ The utility provides the following capabilities:
|
|
23
23
|
# Insert the records into the defined database table
|
24
24
|
# Change schema structure via YML configuration file to accommodate various releases of the ECHI format
|
25
25
|
|
26
|
+
# Table names:
|
27
|
+
## echi_records - stores all ECHI data
|
28
|
+
## echi_logs - stores a log entry for each file processed
|
29
|
+
|
26
30
|
|
27
31
|
h2. Requirements
|
28
32
|
|
@@ -43,12 +47,12 @@ h2. Setup
|
|
43
47
|
|
44
48
|
First, create the directory with all of the project files where you will run this application from:
|
45
49
|
|
46
|
-
<pre syntax="ruby">echi-converter
|
50
|
+
<pre syntax="ruby">echi-converter create myproject</pre>
|
47
51
|
|
48
52
|
Once you have installed a project into your preferred directory, you then need to configure for your environment. The first step is to modify each of these files:
|
49
53
|
|
50
54
|
# config/application.yml
|
51
|
-
## Change each of the 'echi' settings for connecting to your local FTP server where the CMS puts the binary files
|
55
|
+
## Change each of the 'echi' settings for connecting to your local FTP server where the CMS puts the ASCII/binary files
|
52
56
|
## Select which schema you would like to use (ie - extended_version12.yml) based on what you have in place
|
53
57
|
# config/database.yml
|
54
58
|
## Change to match your local database and database login credentials, full ActiveRecord support
|
@@ -61,33 +65,25 @@ Once this is complete, then simply run these commands from the project directory
|
|
61
65
|
|
62
66
|
h2. Usage
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
# where command is one of:
|
67
|
-
## start start an instance of the application
|
68
|
-
## stop stop all instances of the application
|
69
|
-
## restart stop all instances and restart them afterwards
|
70
|
-
## run start the application and stay on top
|
71
|
-
## zap set the application to a stopped state
|
72
|
-
|
73
|
-
# and where options may contain several of the following:
|
74
|
-
## -t, --ontop Stay on top (does not daemonize)
|
75
|
-
## -f, --force Force operation
|
68
|
+
# echi-converter create myproject - create the local project to run the ECHI converter from
|
69
|
+
# echi-converter upgrade myproject - location of project to upgrade after a new gem is installed
|
76
70
|
|
77
|
-
#
|
78
|
-
|
79
|
-
|
71
|
+
# echi-converter run myproject - Run the ECHI converter interactively from the location given
|
72
|
+
# echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
|
73
|
+
# echi-converter stop myproject - Stop the ECHI converter daemon
|
74
|
+
# echi-converter restart myproject - Restart the ECHI converter
|
75
|
+
# echi-converter zap myrpoject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files
|
80
76
|
|
81
77
|
|
82
78
|
h2. Demonstration of usage
|
83
79
|
|
84
80
|
Start the daemon/service:
|
85
81
|
|
86
|
-
<pre syntax="ruby">echi-converter start</pre>
|
82
|
+
<pre syntax="ruby">echi-converter start myproject</pre>
|
87
83
|
|
88
84
|
Stop the daemon/service:
|
89
85
|
|
90
|
-
<pre syntax="ruby">echi-converter stop</pre>
|
86
|
+
<pre syntax="ruby">echi-converter stop myproject</pre>
|
91
87
|
|
92
88
|
|
93
89
|
h2. ToDo
|
@@ -95,7 +91,6 @@ h2. ToDo
|
|
95
91
|
Items to be done to move this out of alpha stage:
|
96
92
|
|
97
93
|
# 'echi-converter-create' works fine with OSX/Linux, need to test validate with a Win32 platform
|
98
|
-
# Determine what to do with the files on the FTP server of the Avaya CMS, delete them or leave them and add methods to ensure no duplication
|
99
94
|
|
100
95
|
|
101
96
|
h2. Forum
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: echi-converter
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-08-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2007-08-16 00:00:00 -07:00
|
8
8
|
summary: ECHI Conversion Utility - Provides a utility to fetch Avaya CMS / ECHI binary files, convert them and insert into a database table via ActiveRecord
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,7 +34,6 @@ files:
|
|
34
34
|
- Manifest.txt
|
35
35
|
- README.txt
|
36
36
|
- Rakefile
|
37
|
-
- echi-converter
|
38
37
|
- lib/main.rb
|
39
38
|
- lib/echi-converter/version.rb
|
40
39
|
- lib/database.rb
|
@@ -52,11 +51,13 @@ files:
|
|
52
51
|
- config/database.yml
|
53
52
|
- config/extended_version12.yml
|
54
53
|
- config/extended_version13.yml
|
54
|
+
- config/install_files.yml
|
55
55
|
- db/migrate/001_create_echi_records.rb
|
56
56
|
- db/migrate/002_create_echi_logs.rb
|
57
|
-
- bin/echi-converter
|
57
|
+
- bin/echi-converter
|
58
58
|
- examples/extended_version12/chr0003
|
59
59
|
- examples/extended_version12/chr0003.txt
|
60
|
+
- examples/schemas/oracle_echi.sql
|
60
61
|
test_files:
|
61
62
|
- test/test_echi-converter.rb
|
62
63
|
- test/test_helper.rb
|
@@ -71,10 +72,54 @@ extra_rdoc_files:
|
|
71
72
|
- website/index.txt
|
72
73
|
- examples/extended_version12/chr0003.txt
|
73
74
|
executables:
|
74
|
-
- echi-converter
|
75
|
+
- echi-converter
|
75
76
|
extensions: []
|
76
77
|
|
77
78
|
requirements: []
|
78
79
|
|
79
|
-
dependencies:
|
80
|
-
|
80
|
+
dependencies:
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: activerecord
|
83
|
+
version_requirement:
|
84
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.15.3
|
89
|
+
version:
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: activesupport
|
92
|
+
version_requirement:
|
93
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.4.2
|
98
|
+
version:
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: daemons
|
101
|
+
version_requirement:
|
102
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.0.7
|
107
|
+
version:
|
108
|
+
- !ruby/object:Gem::Dependency
|
109
|
+
name: fastercsv
|
110
|
+
version_requirement:
|
111
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 1.2.0
|
116
|
+
version:
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rake
|
119
|
+
version_requirement:
|
120
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.7.3
|
125
|
+
version:
|
data/bin/echi-converter-create
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'yaml'
|
4
|
-
require 'fileutils'
|
5
|
-
include FileUtils
|
6
|
-
|
7
|
-
usage = "Usage: echi-converter-create /path/to/directory"
|
8
|
-
|
9
|
-
if ARGV[0] == nil
|
10
|
-
puts usage
|
11
|
-
puts "You must specify a directory name"
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
dest_dir_relative = ARGV[0] || Dir.pwd
|
16
|
-
dest_dir = File.expand_path dest_dir_relative
|
17
|
-
base_dir = File.expand_path File.dirname(__FILE__)
|
18
|
-
|
19
|
-
if RUBY_PLATFORM =~ /mswin32/
|
20
|
-
slash = "\ ".rstrip!
|
21
|
-
puts 'Windows'
|
22
|
-
else
|
23
|
-
puts 'Linux/OSX'
|
24
|
-
slash = "/"
|
25
|
-
end
|
26
|
-
|
27
|
-
#Obtain the details of which Gem is installed
|
28
|
-
gem_details = base_dir.split(slash)
|
29
|
-
location = gem_details.length - 2
|
30
|
-
puts 'Creating new ' + gem_details[location] + ' directory tree in ' + dest_dir
|
31
|
-
puts ' '
|
32
|
-
|
33
|
-
#Now, create the directory, must be a new 'fresh' one
|
34
|
-
begin
|
35
|
-
result = FileUtils.mkdir dest_dir_relative
|
36
|
-
puts 'Created diretory "' + result.to_s + '"'
|
37
|
-
rescue => err
|
38
|
-
puts 'ERROR: ' + err
|
39
|
-
puts 'Failed, exiting...'
|
40
|
-
exit
|
41
|
-
end
|
42
|
-
|
43
|
-
#Now create various directories
|
44
|
-
logdir = dest_dir + slash +'log'
|
45
|
-
filesdir = dest_dir + slash + 'files'
|
46
|
-
csvdir = filesdir + slash + 'csv'
|
47
|
-
processeddir = filesdir + slash + 'processed'
|
48
|
-
toprocessdir = filesdir + slash + 'to_process'
|
49
|
-
begin
|
50
|
-
FileUtils.mkdir logdir
|
51
|
-
FileUtils.mkdir filesdir
|
52
|
-
FileUtils.mkdir csvdir
|
53
|
-
FileUtils.mkdir processeddir
|
54
|
-
FileUtils.mkdir toprocessdir
|
55
|
-
rescue => err
|
56
|
-
puts 'ERROR: ' + err
|
57
|
-
puts 'Failed, exiting...'
|
58
|
-
exit
|
59
|
-
end
|
60
|
-
|
61
|
-
#Now, start copying project files files
|
62
|
-
substitute = slash + '.'
|
63
|
-
base_dir = base_dir.sub('/bin', substitute)
|
64
|
-
new_dest_dir = dest_dir + slash + '.'
|
65
|
-
exe_file = dest_dir + slash + 'echi-converter'
|
66
|
-
begin
|
67
|
-
FileUtils.cp_r base_dir, new_dest_dir
|
68
|
-
FileUtils.chmod 0755, exe_file
|
69
|
-
rescue => err
|
70
|
-
puts 'ERROR: ' + err
|
71
|
-
puts 'Failed, exiting...'
|
72
|
-
exit
|
73
|
-
end
|
74
|
-
|
75
|
-
puts ' '
|
76
|
-
puts 'ECHI Conveter directory created! Now ready for use.'
|