debug_html 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/debug_html.rb +31 -0
  3. metadata +78 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 96a707597b686b9bf955dc3504dd27f3f850d7e9
4
+ data.tar.gz: 63790d69f4a1866b482e354eac1978d6f3f132b9
5
+ SHA512:
6
+ metadata.gz: c7ae3b09d5bcc14e687867e7ad3f6c492424a318032d02d5241b7b11b929a8a6da3636e6107284de8b7033feba0f6c1dadb4b517b611e7d8cb6e8c68d40fb2a9
7
+ data.tar.gz: 0de6f5583d70eaa28907130817f46b9514aec07e03baa9c73f0d0133f5c211b6067191379062a099db85b74cd20933ba2bff96440f3e9eb4bf463f4ae4725338
@@ -0,0 +1,31 @@
1
+ require 'tmpdir'
2
+ require 'launchy'
3
+
4
+ module DebugHTML
5
+ def self.save(html)
6
+ save_html(html)
7
+ end
8
+
9
+ def self.save_and_open(html)
10
+ path = save_html(html)
11
+ Launchy.open(path)
12
+ end
13
+
14
+ private_class_method def self.save_html(html)
15
+ file = File.new(full_path, 'w')
16
+ file.write(html)
17
+ file.close
18
+
19
+ file.path
20
+ end
21
+
22
+ private_class_method def self.full_path
23
+ tmpdir = Dir.tmpdir
24
+ "#{tmpdir}/#{filename}"
25
+ end
26
+
27
+ private_class_method def self.filename
28
+ timestamp = Time.new.strftime('%Y%m%d%H%M%S')
29
+ "debug_html-#{timestamp}#{rand(10**10)}.html"
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: debug_html
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Melvin Lammerts
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: launchy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.4.3
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.4.3
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.5'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.5'
47
+ description: Drop-in HTML page save and open like Capybara's save_and_open_page
48
+ email: hi@melvin.sh
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/debug_html.rb
54
+ homepage: https://github.com/melvinsh/debug_html
55
+ licenses:
56
+ - MIT
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 1.9.3
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.6.6
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Drop-in HTML page save and open.
78
+ test_files: []