Ifd_Automation 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Ifd_Automation +34 -15
  3. data/bin/console +14 -0
  4. data/bin/documentation_generator.rb +119 -0
  5. data/bin/helper.rb +24 -19
  6. data/bin/setup +8 -0
  7. data/lib/Ifd_Automation.rb +2 -1
  8. data/lib/Ifd_Automation/all_steps.rb +8 -0
  9. data/lib/Ifd_Automation/database_steps.rb +106 -0
  10. data/lib/Ifd_Automation/email_steps.rb +67 -82
  11. data/lib/Ifd_Automation/file_steps.rb +30 -0
  12. data/lib/Ifd_Automation/{javascript_handling_steps.rb → javascript_steps.rb} +1 -2
  13. data/lib/Ifd_Automation/required_libs.rb +7 -0
  14. data/lib/Ifd_Automation/response.rb +105 -0
  15. data/lib/Ifd_Automation/ssh_steps.rb +47 -0
  16. data/lib/Ifd_Automation/version.rb +3 -5
  17. data/lib/Ifd_Automation/web_steps.rb +293 -0
  18. data/lib/Ifd_Automation/webservice_steps.rb +261 -0
  19. data/lib/{Ifd_Automation/methods/IFD_Assertion_methods.rb → Ifd_Automation_support/assertion_helpers.rb} +0 -1
  20. data/lib/Ifd_Automation_support/connection_helpers.rb +14 -0
  21. data/lib/{Ifd_Automation/methods → Ifd_Automation_support}/core.rb +103 -34
  22. data/lib/{Ifd_Automation/methods/javascript_handling_methods.rb → Ifd_Automation_support/javascript_helpers.rb} +0 -1
  23. data/lib/Ifd_Automation_support/mail_helpers.rb +17 -0
  24. data/lib/Ifd_Automation_support/selenium_sync_issues.rb +62 -0
  25. data/lib/{Ifd_Automation/methods/web_methods.rb → Ifd_Automation_support/web_steps_helpers.rb} +6 -1
  26. data/project/Gemfile +1 -19
  27. data/project/Gemfile.lock +203 -0
  28. data/project/features/TestData/globalData.yml +3 -11
  29. data/project/features/TestData/sshtest.txt +2 -0
  30. data/project/features/TestData/testfile.sql +2 -0
  31. data/project/features/{TestData/DownloadFolder/test.txt → TestSuite/test} +0 -0
  32. data/project/features/step_definitions/lib_steps/test.rb +16 -0
  33. data/project/features/step_definitions/repositories/project_object.yml +6 -6
  34. data/project/features/support/env.rb +46 -68
  35. data/project/features/support/project_config.yml +6 -37
  36. metadata +231 -51
  37. data/lib/Ifd_Automation/assertion_steps.rb +0 -96
  38. data/lib/Ifd_Automation/lib_file_steps.rb +0 -54
  39. data/lib/Ifd_Automation/lib_schema_data_steps.rb +0 -115
  40. data/lib/Ifd_Automation/lib_web_steps.rb +0 -184
  41. data/lib/Ifd_Automation/lib_webservice_steps.rb +0 -44
  42. data/lib/Ifd_Automation/methods/IFD_Connection.rb +0 -28
  43. data/lib/Ifd_Automation/methods/IFD_email_methods.rb +0 -16
  44. data/lib/Ifd_Automation/methods/IFD_webservice.rb +0 -17
  45. data/lib/Ifd_Automation/methods/database_methods.rb +0 -25
  46. data/lib/Ifd_Automation/methods/db_utils.rb +0 -37
  47. data/lib/Ifd_Automation/methods/error_handling_methods.rb +0 -87
  48. data/lib/Ifd_Automation/methods/lib_var.rb +0 -59
  49. data/lib/Ifd_Automation/methods/misc_methods.rb +0 -33
  50. data/lib/Ifd_Automation/methods/required_files.rb +0 -33
  51. data/lib/Ifd_Automation/methods/util.rb +0 -168
  52. data/lib/Ifd_Automation/methods/web_service_methods.rb +0 -63
  53. data/project/config/cucumber.yml +0 -3
  54. data/project/features/TestData/ExpectedDataFile/test.txt +0 -0
  55. data/project/features/TestData/SqlScript/test.sql +0 -0
  56. data/project/features/TestData/actual_images/infodation.jpg +0 -0
  57. data/project/features/TestData/expected_images/infodation.jpg +0 -0
  58. data/project/features/TestData/image_difference/infodation.jpg +0 -0
  59. data/project/features/TestData/screenshots/infodation.jpg +0 -0
  60. data/project/features/TestSuite/Login/login.feature +0 -11
  61. data/project/features/step_definitions/lib_steps/login_steps.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cc94f4832155a4ce2de60236786252fb0611811
4
- data.tar.gz: d6371731b9672dceb75f793681ccd080a389d2b8
3
+ metadata.gz: df8498418e7065e4ddcc12961d6142d0d5f5c80c
4
+ data.tar.gz: 6f32532b72cf8c054e8a00413d0dd464e0215d03
5
5
  SHA512:
6
- metadata.gz: 33926b1736f3c9ffcaf8ce35a9255968be88791de40c1a3c8a513810fd84c761c07a0fa471baac4ed565ce937364b6a26bd30a02f3cac650e70ffe3ebb381bbb
7
- data.tar.gz: b6b21e2e045f1f9308fbf8c90ce70b8449e9d806a16324bb01020020cf328c23bd97911b322e587cfb550e6102a9d908aa56d411e182494acb7d43eb8496fc9b
6
+ metadata.gz: 0d8d6b66e566c2510a54338e7a796c9d059c0d03a9a708b41dcdf31a12e513a3b175ad190bbf55d4524c8f7f04f55e0244633224c4fd6d78b5e4677459195e76
7
+ data.tar.gz: 1590841f166adde9f93e4d4ab5f7117255ead493d9a847fc68822c5f4c2a3d333ad7b482a34fd465981297f44ea7bb8c40e8da1108ed6b7364d5c8514a338020
data/bin/Ifd_Automation CHANGED
@@ -1,25 +1,44 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require_relative 'helper.rb'
4
3
  require_relative 'generate.rb'
4
+ require_relative 'documentation_generator.rb'
5
5
  require 'Ifd_Automation/version'
6
6
 
7
7
  @features_dir = File.join(FileUtils.pwd, "project")
8
8
  @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
9
 
10
- if (ARGV.length == 0)
11
- print_usage
12
- else
13
- cmd = ARGV.shift
14
-
15
- if cmd == "help"
16
- print_help
17
- elsif cmd == "gen"
18
- ifd_automation_scaffold
19
- elsif cmd == "version"
20
- puts Ifd::Automation::VERSION
21
- else
22
- print_usage
23
- end
10
+ search_string = ARGV.shift
11
+ case search_string
12
+ when /version/
13
+ puts IfdAutomation::VERSION
14
+ when /gen/
15
+ ifd_automation_scaffold
16
+ when /ls/
17
+ ORDERED_KINDS = %w[Given When Then]
18
+ heading = 'All Ifd_Automation steps'
19
+
20
+ # collect
21
+ steps_glob = File.expand_path('../../lib/Ifd_Automation/*_steps.rb', __FILE__)
22
+ step_names = `cat #{steps_glob}`.split($/).select { |line| line =~ /^\s*(Given|When|Then)/ }
23
+
24
+ # format
25
+ # step_names.map! do |step|
26
+ # DocumentationGenerator::StepDefinition.try_and_parse(step)
27
+ # p step
28
+ # end
29
+
30
+ # sort
31
+ # step_names = step_names.sort_by do |step|
32
+ # step =~ /^(\w+)(.*)/
33
+ # [ORDERED_KINDS.index($1), $2]
34
+ # end
35
+
36
+ # Output
37
+ puts "\e[4;34m\n# #{heading}\e[0m" # blue underline
38
+ puts step_names
39
+ else
40
+ print_help
24
41
  end
25
42
 
43
+
44
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "Ifd_Automation"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,119 @@
1
+ module DocumentationGenerator
2
+
3
+ module CommentExtractor
4
+ def parse_and_format_comment(comment)
5
+ comment.gsub!(/.*coding:.*UTF-8.*/, '')
6
+ comment.strip!
7
+ comment_lines = comment.split("\n").take_while { |line| line =~ /^\s*#/ }
8
+ comment_lines && comment_lines.join("\n").gsub(/^\s*# ?/, '')
9
+ end
10
+ end
11
+
12
+ class StepDefinition
13
+
14
+ extend CommentExtractor
15
+
16
+ def initialize(definition, comment = nil)
17
+ @definition = definition
18
+ @comment = comment
19
+ end
20
+
21
+ def self.try_and_parse(code)
22
+ definition = code[/^\s*((When|Then|Given|AfterStep).*)do/, 1]
23
+ return unless definition
24
+ comment = parse_and_format_comment(code)
25
+ return if comment =~ /\bnodoc\b/
26
+ new(definition.strip, comment)
27
+ end
28
+
29
+ def format
30
+ <<-TEXT
31
+ * **#{format_definition}**
32
+
33
+ #{@comment.gsub(/^/, ' ')}
34
+ TEXT
35
+ end
36
+
37
+ def format_definition
38
+ if @definition =~ /AfterStep/
39
+ @definition[/@\w*/]
40
+ else
41
+ capture_groups = %w[([^\"]*) ([^"]*) (.*) (.*?) [^"]+ ([^\"]+) ([^']*) ([^/]*) (.+) (.*[^:])]
42
+ capture_groups.map! &Regexp.method(:escape)
43
+
44
+ @definition.
45
+ gsub('/^', '').
46
+ gsub('$/', '').
47
+ gsub(' ?', ' ').
48
+ gsub('(?:|I )', 'I ').
49
+ gsub('?:', '').
50
+ gsub(Regexp.new(capture_groups.join '|'), '...').
51
+ gsub(/\\\//, '/')
52
+ end
53
+ end
54
+ end
55
+
56
+ class StepDefinitionFile
57
+
58
+ FILE_COMMENT_END = 'FILE_COMMENT_END'
59
+
60
+ include CommentExtractor
61
+
62
+ def initialize(filename)
63
+ @filename = filename
64
+ @code = File.read(filename)
65
+ @steps = []
66
+ extract_comment
67
+ add_steps
68
+ end
69
+
70
+ def extract_comment
71
+ if @code.include?(FILE_COMMENT_END)
72
+ file_comment = @code.split(FILE_COMMENT_END).first
73
+ @comment = parse_and_format_comment(file_comment)
74
+ end
75
+ end
76
+
77
+ def add_steps
78
+ @code.split("\n\n").each do |block|
79
+ step = StepDefinition.try_and_parse(block)
80
+ if step
81
+ @steps << step
82
+ end
83
+ end
84
+ end
85
+
86
+ def format
87
+ <<-TEXT
88
+ ### #{format_filename}
89
+
90
+ #{@comment}
91
+
92
+ #{format_steps}
93
+ TEXT
94
+ end
95
+
96
+ def format_filename
97
+ @filename.split('/').last
98
+ end
99
+
100
+ def format_steps
101
+ @steps.collect { |step| step.format }.join("\n\n")
102
+ end
103
+ end
104
+
105
+ class StepDefinitionsDirectory
106
+ def initialize(directory)
107
+ @step_definition_files = []
108
+ Dir["#{directory}/*.rb"].to_a.sort.each do |filename|
109
+ next if filename =~ /all_steps/
110
+ @step_definition_files << StepDefinitionFile.new(filename)
111
+ end
112
+ end
113
+
114
+ def format
115
+ @step_definition_files.collect { |step_definition_file| step_definition_file.format }.join("\n\n")
116
+ end
117
+ end
118
+
119
+ end
data/bin/helper.rb CHANGED
@@ -8,33 +8,36 @@ def msg(title, &block)
8
8
  puts "-"*10 + "-------" + "-"*10 + "\n"
9
9
  end
10
10
 
11
- def print_usage
12
- puts <<EOF
13
-
14
- Usage: Ifd_Automation <command-name> [parameters] [options]
15
-
16
- <command-name> can be one of
17
- help
18
- prints more detailed help information.
19
- gen
20
- generate a features folder structure.
21
- version
22
- prints the gem version
23
-
24
- <options> can be
25
- -v, --verbose Turns on verbose logging
26
- EOF
27
- end
11
+ # def print_usage
12
+ # puts <<EOF
13
+ #
14
+ # Usage: Ifd_Automation <command-name> [parameters] [options]
15
+ #
16
+ # <command-name> can be one of
17
+ # help
18
+ # prints more detailed help information.
19
+ # gen
20
+ # generate a features folder structure.
21
+ # version
22
+ # prints the gem version
23
+ # ls
24
+ # list all steps name of Ifd Automation framework
25
+ # <options> can be
26
+ # -v, --verbose Turns on verbose logging
27
+ # EOF
28
+ # end
28
29
 
29
30
  def print_help
30
31
  puts <<EOF
31
-
32
+ Author: Anh Pham
33
+
32
34
  Usage: Ifd_Automation <command-name> [parameters] [options]
33
-
35
+
34
36
  <command-name> can be one of
35
37
  help
36
38
  gen
37
39
  version
40
+ ls
38
41
 
39
42
  Commands:
40
43
  help : prints more detailed help information.
@@ -45,6 +48,8 @@ def print_help
45
48
 
46
49
  version : prints the gem version
47
50
 
51
+ ls: list all steps name of Ifd Automation framework
52
+
48
53
  <Options>
49
54
  -v, --verbose Turns on verbose logging
50
55
  EOF
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1 +1,2 @@
1
- Dir[File.dirname(__FILE__) + '/Ifd_Automation/*.rb'].each { |file| require file }
1
+ require "Ifd_Automation/version"
2
+ Dir[File.dirname(__FILE__) + '/Ifd_Automation/*.rb'].each { |file| require file }
@@ -0,0 +1,8 @@
1
+ # coding: UTF-8
2
+
3
+ Dir[File.join(File.dirname(__FILE__), '*_steps.rb')].each do |f|
4
+ name = File.basename(f, '.rb')
5
+ unless name == 'all_steps'
6
+ require "Ifd_Automation/#{name}"
7
+ end
8
+ end
@@ -0,0 +1,106 @@
1
+ require_relative 'required_libs'
2
+
3
+ Given /^I create connection to database with:$/ do |params|
4
+ unless params.hashes.empty?
5
+ @connection = Connection.new(params.hashes[0])
6
+ p "Connect to database successfully!" if @connection
7
+ end
8
+ end
9
+
10
+ # Example
11
+ # When I run multiple sql script:
12
+ # """
13
+ # delete from autofeatures where id=10;
14
+ # delete from autofeatures where id=11;
15
+ # """
16
+ And /^I run multiple sql script:$/ do |raw_data|
17
+ raw_data.strip!
18
+ script = raw_data.split(/\n/)
19
+ script.each do |row|
20
+ begin
21
+ sql = "#{row}"
22
+ @result = @connection.connection().execute(sql)
23
+ rescue Exception => e
24
+ raise e.message
25
+ end
26
+ end
27
+ end
28
+
29
+ When /^I run sql script from previous step$/ do
30
+ unless @file_data.nil?
31
+ begin
32
+ @file_data.each_line do |line|
33
+ if line.nil? || line =~ /^\s*\n*--/
34
+ puts "\nSQL: " + line;
35
+ next
36
+ end
37
+ line = line.strip();
38
+ # line = line[0..-2];
39
+ p line
40
+ @result = @connection.connection().execute(line)
41
+ sleep 1
42
+ end
43
+
44
+ rescue Exception => e
45
+ raise e.message
46
+ end
47
+ end
48
+ end
49
+
50
+ # Example
51
+ # When I run sql script "select * from users where email=stored='id'"
52
+ And /^I run sql script "(.*)"$/ do |sql|
53
+ script = check_match_url sql
54
+ begin
55
+ @result = @connection.connection().execute(script)
56
+ rescue Exception => e
57
+ raise e.message
58
+ end
59
+ end
60
+
61
+ Then /^Show me the result of SQL statement$/ do
62
+ unless @result.nil?
63
+ @result.each(:as => :hash) do |row|
64
+ puts row
65
+ end
66
+ end
67
+ end
68
+
69
+ # Example
70
+ # Then the result of SQL statement should be:
71
+ # """
72
+ # {"name": "quoc anh", "email": "anhpq.info@gmail.com"}
73
+ # """
74
+ Then /^the result of SQL statement should be:$/ do |json|
75
+ expected = JSON.parse(json)
76
+ @result.each(:as => :hash) do |row|
77
+ IFD_Assertion.assert_string_equal(row, expected)
78
+ end
79
+ end
80
+
81
+ # Example
82
+ # Then the result of SQL statement should have "email" with value "anhpq.info@gmail.com"
83
+ Then /^the result of SQL statement should have "(.*)" with value "(.*)"$/ do |json_path, value|
84
+ @result.each(:as => :hash) do |row|
85
+ results = JsonPath.new(json_path).on(row).to_a.map(&:to_s)
86
+ IFD_Assertion.assert_string_equal(results[0], value)
87
+ end
88
+ end
89
+
90
+ When /^I store "(.*)" as "(.*)"$/ do |json_path, place_holder|
91
+ if @result.nil?
92
+ raise 'No record found, a request need to be made first before you can store data'
93
+ end
94
+ @stored = {} if @stored.nil?
95
+ @result.each(:as => :hash) do |row|
96
+ @stored[%/#{place_holder}/] = row[%/#{json_path}/]
97
+
98
+ end
99
+ end
100
+
101
+ # def resolve_script script
102
+ # unless @stored.nil?
103
+ # @stored.each { |key, value| script = script.gsub /\{#{key}\}/, %/'#{value}'/ }
104
+ # end
105
+ # script
106
+ # end
@@ -1,91 +1,76 @@
1
- require 'mail'
2
- require_relative 'methods/required_files'
3
- # Before do
4
- # ActionMailer::Base.deliveries.clear
5
- # end
6
-
7
- Then /^I send the email to "(.*)" with subject is "(.*)" and email body in "(.*)" file$/ do |to_address, subject, file|
8
- data_file = File.read($test_data_dir + file)
9
- filepath = ($test_data_dir + file)
10
- body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
11
- if File.exist?(filepath)
12
- IFD_Email.send_email(to_address, subject, body_email)
13
- end
14
- end
15
- Then /^I send the email to "(.*)" with subject is "(.*)" and email body "(.*)"$/ do |to_address, subject, email_body|
16
- email_body = email_body.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
17
- IFD_Email.send_email(to_address, subject, email_body)
18
- end
1
+ require 'action_mailer'
2
+ require_relative 'required_libs'
3
+ # Example:
4
+ #
5
+ # Then I send an email with:
6
+ # """
7
+ # From: from@example.com
8
+ # Reply-To: reply-to@example.com
9
+ # To: anh.pham@infodation.vn
10
+ # Subject: SUBJECT
11
+ # Attachments: globalData.yml
19
12
 
20
- Then /^I should receive the email from "(.*)" with subject "(.*)"$/ do |email_from, email_subject|
21
- sleep 5
22
- emails = Mail.find(:what => :last, :count => 1)
23
- if emails.instance_of? Mail::Message
24
- # puts emails.from[0].to_s
25
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
26
- IFD_Assertion.assert_string_equal(email_subject, emails.subject)
27
- else
28
- raise "WARNING: *** No new Email is found"
29
- end
30
- end
13
+ # BODY
14
+ # """
15
+ #
16
+ Then /^I send an e?mail with:$/ do |raw_data|
17
+ patiently do
18
+ raw_data.strip!
19
+ header, body = raw_data.split(/\n\n/, 2) # 2: maximum number of fields
20
+ conditions = {}
21
+ header.split("\n").each do |row|
22
+ if row.lstrip.chop.match(/^[a-z\-]+:/i)
23
+ key, value = row.split(":", 2)
24
+ conditions[key.gsub(' ','').underscore.to_sym] = value.gsub(' ','')
31
25
 
32
- Then /^I should receive the mail from "(.*)" with Email content has following value:$/ do |email_from, email_content|
33
- sleep 5
34
- emails = Mail.find(:what => :last, :count => 1)
35
- if emails.instance_of? Mail::Message
36
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
37
- email_content.raw[0].each do |line|
38
- assert(true) if emails.body.should include(line.strip)
26
+ end
39
27
  end
40
- else
41
- raise "WARNING: *** No new Email is found"
28
+ conditions[:body] = body if body
29
+ filepath = ($test_data_dir + conditions[:attachments] if conditions[:attachments])
30
+ IFD_Email.send_email(conditions[:to], conditions[:subject], conditions[:body],filepath)
42
31
  end
43
32
  end
44
33
 
45
- Then /^I should receive the mail from "(.*)" with subject "(.*)" and Email content has following value:$/ do |email_from,email_subject, email_content|
46
- sleep 5
47
- emails = Mail.find(:what => :last, :count => 1)
48
- if emails.instance_of? Mail::Message
49
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
50
- IFD_Assertion.assert_string_equal(email_subject, emails.subject)
51
- email_content.raw[0].each do |line|
52
- assert(true) if emails.body.should include(line.strip)
34
+ # Example:
35
+ #
36
+ # Then I should receive an email with:
37
+ # """
38
+ # From: from@example.com
39
+ # Reply-To: reply-to@example.com
40
+ # To: anh.pham@infodation.vn
41
+ # Subject: SUBJECT
42
+ # Attachments: globalData.yml
43
+
44
+ # BODY
45
+ # """
46
+ #
47
+
48
+ Then /^I should receive an e?mail with:$/ do |raw_data|
49
+ patiently do
50
+ raw_data.strip!
51
+ header, body = raw_data.split(/\n\n/, 2) # 2: maximum number of fields
52
+ conditions = {}
53
+ header.split("\n").each do |row|
54
+ if row.lstrip.chop.match(/^[a-z\-]+:/i)
55
+ key, value = row.split(":", 2)
56
+ conditions[key.gsub(' ','').underscore.to_sym] = value.gsub(' ','')
57
+
58
+ end
59
+ end
60
+ conditions[:body] = body.squeeze(' ').strip if body
61
+ sleep 5
62
+ emails = Mail.find(:what => :last, :count => 1)
63
+
64
+ if emails.instance_of? Mail::Message
65
+ IFD_Assertion.assert_string_equal(conditions[:from], emails.from[0].to_s)
66
+ IFD_Assertion.assert_string_equal(conditions[:subject], emails.subject)
67
+ IFD_Assertion.assert_string_contain(conditions[:body], emails.body)
68
+ emails.attachments.each do |attachment|
69
+ IFD_Assertion.assert_string_equal(conditions[:attachments], attachment.filename)
70
+ end if conditions[:attachments]
71
+ else
72
+ raise "WARNING: *** No new Email is found"
53
73
  end
54
- else
55
- raise "WARNING: *** No new Email is found"
56
74
  end
57
75
  end
58
- #
59
- # Then /^I send the email to "(.*)" with subject is "(.*)" and email body template in "(.*)" file and following conditions:$/ do |to_address, subject, file, data_table|
60
- # data_file = File.read($test_data_dir + file)
61
- # filepath = ($test_data_dir + file)
62
- # body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
63
- # if File.exist?(filepath)
64
- # raw_data = JSON.parse(JSON.generate(data_table))
65
- # header = raw_data[0]
66
- # value = raw_data[1]
67
- # $test = String.new
68
- # $i = 0
69
- # body_email.each_line do |lines|
70
- # header.zip(value).each do |headers, values|
71
- # group1, group2, group3= lines.match(/(^.*)(:)(.*)/i).try(:captures)
72
- # if headers == group1 && group1.size > 0
73
- # $new_value = lines.gsub(group3, " #{values}")
74
- # $test += "#{$new_value}"
75
- # $i = 1
76
- # break
77
- # elsif headers == "taaknummer"
78
- # $new_value = lines.gsub("[TASKID]", " #{values}")
79
- # $test += "#{$new_value}"
80
- # $i = 1
81
- # else
82
- # $i = 0
83
- # end
84
- # end
85
- # if $i == 0
86
- # $test += "#{lines}"
87
- # end
88
- # end
89
- # IFD_Email.send_email(to_address, subject, $test)
90
- # end
91
- # end
76
+