reportir 0.2.1 → 0.3.0
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/static_site_template/css/main.css +15 -64
- data/lib/reportir/static_site_template/css/vendor/owl.carousel.css +216 -0
- data/lib/reportir/static_site_template/css/vendor/owl.default.theme.min.css +1 -0
- data/lib/reportir/static_site_template/index.html +95 -69
- data/lib/reportir/static_site_template/js/{main.js → models.js} +0 -0
- data/lib/reportir/static_site_template/js/vendor/owl.carousel.min.js +2 -0
- data/lib/reportir/version.rb +1 -1
- data/lib/reportir.rb +73 -51
- data/reportir.gemspec +1 -0
- metadata +20 -30
- data/lib/reportir/static_site_template/.editorconfig +0 -13
- data/lib/reportir/static_site_template/.gitattributes +0 -1
- data/lib/reportir/static_site_template/.gitignore +0 -2
- data/lib/reportir/static_site_template/.htaccess +0 -984
- data/lib/reportir/static_site_template/404.html +0 -60
- data/lib/reportir/static_site_template/LICENSE.txt +0 -19
- data/lib/reportir/static_site_template/apple-touch-icon.png +0 -0
- data/lib/reportir/static_site_template/css/font/FontAwesome.otf +0 -0
- data/lib/reportir/static_site_template/css/font/fontawesome-webfont.eot +0 -0
- data/lib/reportir/static_site_template/css/font/fontawesome-webfont.svg +0 -284
- data/lib/reportir/static_site_template/css/font/fontawesome-webfont.ttf +0 -0
- data/lib/reportir/static_site_template/css/font/fontawesome-webfont.woff +0 -0
- data/lib/reportir/static_site_template/css/vendor/font-awesome.min.css +0 -33
- data/lib/reportir/static_site_template/doc/TOC.md +0 -29
- data/lib/reportir/static_site_template/doc/css.md +0 -162
- data/lib/reportir/static_site_template/doc/extend.md +0 -663
- data/lib/reportir/static_site_template/doc/faq.md +0 -62
- data/lib/reportir/static_site_template/doc/html.md +0 -223
- data/lib/reportir/static_site_template/doc/js.md +0 -37
- data/lib/reportir/static_site_template/doc/misc.md +0 -175
- data/lib/reportir/static_site_template/doc/usage.md +0 -130
- data/lib/reportir/static_site_template/humans.txt +0 -15
- data/lib/reportir/static_site_template/img/pagination.png +0 -0
- data/lib/reportir/static_site_template/robots.txt +0 -5
- data/lib/reportir/static_site_template/tile-wide.png +0 -0
- data/lib/reportir/static_site_template/tile.png +0 -0
- data/reportir-0.2.0.gem +0 -0
data/lib/reportir.rb
CHANGED
@@ -3,18 +3,26 @@ require 's3_uploader'
|
|
3
3
|
require 'aws-sdk'
|
4
4
|
|
5
5
|
module Reportir
|
6
|
-
@@static_site_template_path = Gem.find_files('reportir')[1] +'/static_site_template'
|
7
|
-
@@template_subdirectory_for_test_artifacts = 'test_run'
|
8
6
|
@@step = 0
|
7
|
+
@@tests = [] # has to be array for front-end
|
9
8
|
|
10
9
|
def upload_result_to_s3_as_static_site
|
11
10
|
check_for_env_vars
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
clear_previous_results_from_s3
|
12
|
+
save_final_markup
|
13
|
+
write_javascript_models
|
14
|
+
upload_to_s3
|
15
|
+
delete_tmp_files_for_this_test
|
16
|
+
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" }
|
18
26
|
end
|
19
27
|
|
20
28
|
private
|
@@ -26,84 +34,98 @@ module Reportir
|
|
26
34
|
raise Reportir::Error.new 'Missing ENV AWS_DEFAULT_REGION' unless ENV['AWS_DEFAULT_REGION']
|
27
35
|
end
|
28
36
|
|
29
|
-
def
|
30
|
-
FileUtils.
|
37
|
+
def delete_tmp_files_for_this_test
|
38
|
+
FileUtils.rm_rf local_test_root
|
31
39
|
end
|
32
40
|
|
33
|
-
def
|
34
|
-
|
41
|
+
def save_final_markup
|
42
|
+
s3_screenshot('final')
|
43
|
+
path = "#{local_test_root}/final.html"
|
44
|
+
File.open(path, 'w') { |f| f.write @browser.html }
|
45
|
+
current_test[:add_links] << { name: 'Markup from Last Page', path: "#{public_path_for_this_test}/final.html" }
|
35
46
|
end
|
36
47
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
48
|
+
def write_javascript_models
|
49
|
+
string = %{
|
50
|
+
var navigation = #{array_of_test_names.to_json};\n
|
51
|
+
var tests = #{@@tests.to_json};\n
|
52
|
+
}
|
53
|
+
File.open(local_model_file_path, "w") { |f| f.write(string) }
|
40
54
|
end
|
41
55
|
|
42
|
-
def
|
43
|
-
data
|
44
|
-
|
45
|
-
|
46
|
-
|
56
|
+
def clear_previous_results_from_s3
|
57
|
+
puts "deleting all previous test data from s3"
|
58
|
+
::Aws::S3::Bucket.new(ENV['AWS_DEFAULT_BUCKET']).delete_objects({
|
59
|
+
delete: {
|
60
|
+
objects: [{ key: "#{public_path_for_this_test}" }],
|
61
|
+
quiet: true
|
62
|
+
}
|
63
|
+
})
|
47
64
|
end
|
48
65
|
|
49
|
-
def
|
50
|
-
puts '
|
66
|
+
def upload_to_s3
|
67
|
+
puts ''
|
51
68
|
puts ''
|
52
|
-
|
53
|
-
::
|
54
|
-
|
69
|
+
puts '====== STARTING S3 UPLOAD ========='
|
70
|
+
::Aws::S3::Resource.new.bucket(ENV['AWS_DEFAULT_BUCKET']).object('js/models.js').upload_file(local_model_file_path)
|
71
|
+
puts "Uploading #{local_model_file_path} to /js/models.js"
|
72
|
+
::S3Uploader.upload_directory(local_test_root, ENV['AWS_DEFAULT_BUCKET'], {
|
73
|
+
:destination_dir => public_path_for_this_test,
|
55
74
|
:threads => 5,
|
56
75
|
s3_key: ENV['AWS_ACCESS_KEY_ID'],
|
57
76
|
s3_secret: ENV['AWS_SECRET_ACCESS_KEY'],
|
58
77
|
region: ENV['AWS_DEFAULT_REGION'] })
|
59
78
|
puts ''
|
79
|
+
puts ''
|
60
80
|
puts '====== S3 UPLOAD COMPLETE ========='
|
61
81
|
puts 'URL: ' + static_site_url
|
62
82
|
puts '==================================='
|
83
|
+
puts ''
|
84
|
+
puts ''
|
63
85
|
end
|
64
86
|
|
65
|
-
def
|
66
|
-
|
87
|
+
def current_test
|
88
|
+
@@tests.select{ |test| test[:name] == test_name }.first
|
67
89
|
end
|
68
90
|
|
69
|
-
def
|
70
|
-
|
91
|
+
def create_current_test
|
92
|
+
if !current_test || current_test.empty?
|
93
|
+
@@tests << { name: test_name, screenshots: [], add_links: [] }
|
94
|
+
end
|
71
95
|
end
|
72
96
|
|
73
|
-
def
|
74
|
-
|
97
|
+
def array_of_test_names
|
98
|
+
@@tests.map{|t| t[:name] }
|
75
99
|
end
|
76
100
|
|
77
|
-
def
|
78
|
-
"
|
101
|
+
def local_model_file_path
|
102
|
+
"#{local_root}/models.js"
|
79
103
|
end
|
80
104
|
|
81
|
-
def
|
82
|
-
|
83
|
-
image_name = "#{@@step}-#{method}"
|
84
|
-
FileUtils.mkdir_p(deletable_data_path) unless Dir.exists?(deletable_data_path)
|
85
|
-
@browser.screenshot.save("#{deletable_data_path}/#{image_name}.png")
|
105
|
+
def local_test_root
|
106
|
+
"#{local_root}/#{public_path_for_this_test}"
|
86
107
|
end
|
87
108
|
|
88
|
-
def
|
89
|
-
"
|
109
|
+
def local_root
|
110
|
+
"./tmp/reportir"
|
90
111
|
end
|
91
112
|
|
92
|
-
def
|
93
|
-
|
113
|
+
def public_path_for_this_test
|
114
|
+
"#{public_artifact_root}/#{test_name}"
|
94
115
|
end
|
95
116
|
|
96
|
-
def
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
117
|
+
def public_artifact_root
|
118
|
+
"test_artifacts"
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_name
|
122
|
+
::RSpec.current_example.metadata[:test_name] || ::RSpec.current_example.metadata[:full_description].gsub(/[^\w\s]/,'').gsub(/\s/,'_')
|
102
123
|
end
|
103
124
|
|
104
|
-
def
|
105
|
-
|
106
|
-
|
125
|
+
def static_site_url
|
126
|
+
# TODO: use aws-sdk for this.
|
127
|
+
"http://#{ENV['AWS_DEFAULT_BUCKET']}.s3-website-#{ENV['AWS_DEFAULT_REGION']}.amazonaws.com"
|
107
128
|
end
|
129
|
+
|
108
130
|
class Error < ::StandardError; end
|
109
131
|
end
|
data/reportir.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "rubocop"
|
25
26
|
spec.add_runtime_dependency 's3_uploader'
|
26
27
|
spec.add_runtime_dependency 'aws-sdk'
|
27
28
|
spec.add_runtime_dependency 'fileutils'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reportir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Shelton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: s3_uploader
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,48 +141,24 @@ files:
|
|
127
141
|
- bin/console
|
128
142
|
- bin/setup
|
129
143
|
- lib/reportir.rb
|
130
|
-
- lib/reportir/static_site_template/.editorconfig
|
131
|
-
- lib/reportir/static_site_template/.gitattributes
|
132
|
-
- lib/reportir/static_site_template/.gitignore
|
133
|
-
- lib/reportir/static_site_template/.htaccess
|
134
|
-
- lib/reportir/static_site_template/404.html
|
135
|
-
- lib/reportir/static_site_template/LICENSE.txt
|
136
|
-
- lib/reportir/static_site_template/apple-touch-icon.png
|
137
144
|
- lib/reportir/static_site_template/browserconfig.xml
|
138
145
|
- lib/reportir/static_site_template/crossdomain.xml
|
139
|
-
- lib/reportir/static_site_template/css/font/FontAwesome.otf
|
140
|
-
- lib/reportir/static_site_template/css/font/fontawesome-webfont.eot
|
141
|
-
- lib/reportir/static_site_template/css/font/fontawesome-webfont.svg
|
142
|
-
- lib/reportir/static_site_template/css/font/fontawesome-webfont.ttf
|
143
|
-
- lib/reportir/static_site_template/css/font/fontawesome-webfont.woff
|
144
146
|
- lib/reportir/static_site_template/css/main.css
|
145
147
|
- lib/reportir/static_site_template/css/normalize.css
|
146
148
|
- lib/reportir/static_site_template/css/vendor/bootstrap.min.css
|
147
|
-
- lib/reportir/static_site_template/css/vendor/
|
148
|
-
- lib/reportir/static_site_template/
|
149
|
-
- lib/reportir/static_site_template/doc/css.md
|
150
|
-
- lib/reportir/static_site_template/doc/extend.md
|
151
|
-
- lib/reportir/static_site_template/doc/faq.md
|
152
|
-
- lib/reportir/static_site_template/doc/html.md
|
153
|
-
- lib/reportir/static_site_template/doc/js.md
|
154
|
-
- lib/reportir/static_site_template/doc/misc.md
|
155
|
-
- lib/reportir/static_site_template/doc/usage.md
|
149
|
+
- lib/reportir/static_site_template/css/vendor/owl.carousel.css
|
150
|
+
- lib/reportir/static_site_template/css/vendor/owl.default.theme.min.css
|
156
151
|
- lib/reportir/static_site_template/favicon.ico
|
157
|
-
- lib/reportir/static_site_template/humans.txt
|
158
152
|
- lib/reportir/static_site_template/img/.gitignore
|
159
|
-
- lib/reportir/static_site_template/img/pagination.png
|
160
153
|
- lib/reportir/static_site_template/index.html
|
161
|
-
- lib/reportir/static_site_template/js/
|
154
|
+
- lib/reportir/static_site_template/js/models.js
|
162
155
|
- lib/reportir/static_site_template/js/plugins.js
|
163
156
|
- lib/reportir/static_site_template/js/vendor/bootstrap.min.js
|
164
157
|
- lib/reportir/static_site_template/js/vendor/jquery-1.11.3.min.js
|
165
158
|
- lib/reportir/static_site_template/js/vendor/jquery.slides.min.js
|
166
159
|
- lib/reportir/static_site_template/js/vendor/modernizr-2.8.3.min.js
|
167
|
-
- lib/reportir/static_site_template/
|
168
|
-
- lib/reportir/static_site_template/tile-wide.png
|
169
|
-
- lib/reportir/static_site_template/tile.png
|
160
|
+
- lib/reportir/static_site_template/js/vendor/owl.carousel.min.js
|
170
161
|
- lib/reportir/version.rb
|
171
|
-
- reportir-0.2.0.gem
|
172
162
|
- reportir.gemspec
|
173
163
|
homepage: http://github.com/reportir
|
174
164
|
licenses:
|
@@ -1 +0,0 @@
|
|
1
|
-
* text=auto
|