reportir 0.3.1 → 0.3.3
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.
- checksums.yaml +4 -4
- data/lib/reportir/version.rb +1 -1
- data/lib/reportir.rb +42 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 984561d1c0d5ce2d7d61d43bc6da95651679cd6c
|
4
|
+
data.tar.gz: bc8caa6a3a64650fa85194017ca2551c2f02264c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05fb3a93750af32b5c528a886d868ae14be35e85b34ad52ede3517b5c9b4a9864ebbaf74293c65482bce33c75ad4b2e3f34cdbb72f0a78b72ab882fb413194c7
|
7
|
+
data.tar.gz: df018eeb4a717cc113f78ea55e158df646e90248702b275156d65b5c83517b079862703472dcae19f04a59757343d5d1d76433885c7bd2b3a635e9e0a856d583
|
data/lib/reportir/version.rb
CHANGED
data/lib/reportir.rb
CHANGED
@@ -8,25 +8,27 @@ module Reportir
|
|
8
8
|
|
9
9
|
def upload_result_to_s3_as_static_site
|
10
10
|
check_for_env_vars
|
11
|
+
upload_template unless template_uploaded?
|
11
12
|
clear_previous_results_from_s3
|
12
13
|
save_final_markup
|
13
14
|
write_javascript_models
|
14
15
|
upload_to_s3
|
15
16
|
delete_tmp_files_for_this_test
|
16
17
|
end
|
17
|
-
|
18
|
-
def s3_screenshot(method)
|
19
|
-
create_current_test #TODO: before-filter??
|
20
|
-
@@step = @@step+=1
|
21
|
-
image_name = "#{@@step}-#{method}"
|
22
|
-
local_path = "#{local_test_root}/#{image_name}.png"
|
23
|
-
FileUtils.mkdir_p(local_test_root) unless Dir.exists?(local_test_root)
|
24
|
-
@browser.screenshot.save(local_path)
|
25
|
-
current_test[:screenshots] << { name: image_name, src: "#{public_path_for_this_test}/#{image_name}.png" }
|
26
|
-
end
|
27
18
|
|
28
19
|
private
|
29
20
|
|
21
|
+
def upload_template
|
22
|
+
puts ''
|
23
|
+
puts ''
|
24
|
+
puts '====== UPLOADING TEMPLATE ========='
|
25
|
+
upload_directory(static_site_template_path, '')
|
26
|
+
end
|
27
|
+
|
28
|
+
def template_uploaded?
|
29
|
+
bucket.object('index.html').exists?
|
30
|
+
end
|
31
|
+
|
30
32
|
def check_for_env_vars
|
31
33
|
raise Reportir::Error.new 'Missing ENV AWS_DEFAULT_BUCKET' unless ENV['AWS_DEFAULT_BUCKET']
|
32
34
|
raise Reportir::Error.new 'Missing ENV AWS_SECRET_ACCESS_KEY' unless ENV['AWS_SECRET_ACCESS_KEY']
|
@@ -66,15 +68,10 @@ module Reportir
|
|
66
68
|
def upload_to_s3
|
67
69
|
puts ''
|
68
70
|
puts ''
|
69
|
-
puts '======
|
70
|
-
|
71
|
+
puts '====== UPLOADING RESULTS ========='
|
72
|
+
bucket.object('js/models.js').upload_file(local_model_file_path)
|
71
73
|
puts "Uploading #{local_model_file_path} to /js/models.js"
|
72
|
-
|
73
|
-
:destination_dir => public_path_for_this_test,
|
74
|
-
:threads => 5,
|
75
|
-
s3_key: ENV['AWS_ACCESS_KEY_ID'],
|
76
|
-
s3_secret: ENV['AWS_SECRET_ACCESS_KEY'],
|
77
|
-
region: ENV['AWS_DEFAULT_REGION'] })
|
74
|
+
upload_directory(local_test_root, public_path_for_this_test)
|
78
75
|
puts ''
|
79
76
|
puts ''
|
80
77
|
puts '====== S3 UPLOAD COMPLETE ========='
|
@@ -84,6 +81,33 @@ module Reportir
|
|
84
81
|
puts ''
|
85
82
|
end
|
86
83
|
|
84
|
+
def s3_screenshot(method)
|
85
|
+
create_current_test #TODO: before-filter??
|
86
|
+
@@step = @@step+=1
|
87
|
+
image_name = "#{@@step}-#{method}"
|
88
|
+
local_path = "#{local_test_root}/#{image_name}.png"
|
89
|
+
FileUtils.mkdir_p(local_test_root) unless Dir.exists?(local_test_root)
|
90
|
+
@browser.screenshot.save(local_path)
|
91
|
+
current_test[:screenshots] << { name: image_name, src: "#{public_path_for_this_test}/#{image_name}.png" }
|
92
|
+
end
|
93
|
+
|
94
|
+
def bucket
|
95
|
+
@bucket ||= ::Aws::S3::Resource.new.bucket(ENV['AWS_DEFAULT_BUCKET'])
|
96
|
+
end
|
97
|
+
|
98
|
+
def upload_directory(local, remote)
|
99
|
+
::S3Uploader.upload_directory(local, ENV['AWS_DEFAULT_BUCKET'], {
|
100
|
+
:destination_dir => remote,
|
101
|
+
:threads => 5,
|
102
|
+
s3_key: ENV['AWS_ACCESS_KEY_ID'],
|
103
|
+
s3_secret: ENV['AWS_SECRET_ACCESS_KEY'],
|
104
|
+
region: ENV['AWS_DEFAULT_REGION'] })
|
105
|
+
end
|
106
|
+
|
107
|
+
def static_site_template_path
|
108
|
+
Gem.find_files('reportir')[1] +'/static_site_template'
|
109
|
+
end
|
110
|
+
|
87
111
|
def current_test
|
88
112
|
@@tests.select{ |test| test[:name] == test_name }.first
|
89
113
|
end
|