lunox 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/lunox.rb +33 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0f4ef15647bc981f3636a9a964656f42498636ccf16f49c8624be5061da49ec8
4
+ data.tar.gz: a9cea2f4be054d13ed05c897c2320a5b56a33ae391716f803ca0c0e9336400d3
5
+ SHA512:
6
+ metadata.gz: 6f901dc4778461e8d53c5e62e4f469e36a4cedd090a042c0ecc1afdff54459dd8bc70584a7f9d6f219f10769cee488f48c45f9778e640c44459049d7ca64d100
7
+ data.tar.gz: 12827facd935796eb1a76f87e066d52f919074a6e2142f0a4be749d8178147f4f455c28a72ff24586e1f64da4cc1bd5dbb208328f7923c9716f2318e0218d7d7
data/lib/lunox.rb ADDED
@@ -0,0 +1,33 @@
1
+ require 'nokogiri'
2
+ class CreateHTML
3
+ def create_html(content, bypass_html, file_name: 'index.html')
4
+ markup = content.gsub!(/[<>]/, '') if bypass_html == false
5
+ markup = content unless bypass_html == false
6
+ html = <<~HTML
7
+ <!doctype html>
8
+ <html lang="en">
9
+ <head>
10
+ <meta charset="UTF-8">
11
+ <title>#{file_name}</title>
12
+ </head>
13
+ <body>
14
+ #{markup}
15
+ </body>
16
+ </html>
17
+ HTML
18
+ File.write(file_name, html)
19
+ end
20
+
21
+ def update_html(content, file_name: 'index.html')
22
+ doc = File.open(file_name) { |f| Nokogiri::HTML(f) }
23
+ doc.at('body') << content
24
+
25
+ file = File.open(file_name, 'w+')
26
+ file.puts doc
27
+ file.close
28
+ end
29
+
30
+ def open_in_browser(file_name: 'index.html')
31
+ system("open ./#{file_name}")
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lunox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eugene Shitov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple html maker
14
+ email: fured.rb@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/lunox.rb
20
+ homepage: https://github.com/EugeneShitov/lunox
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.2.3
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Make html file
43
+ test_files: []