algoheader 0.0.1
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 +7 -0
- data/bin/algoheader +33 -0
- data/lib/algoheader/base.rb +115 -0
- data/lib/algoheader/helpers.rb +65 -0
- data/lib/algoheader/png_transformer.rb +49 -0
- data/lib/algoheader/service_object.rb +35 -0
- data/lib/algoheader/svg_generator.rb +103 -0
- data/lib/algoheader/version.rb +30 -0
- data/lib/algoheader.rb +29 -0
- data/lib/assets/config.yml +14 -0
- data/test/test_hello.rb +42 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 872e496205849f1f92511391292617b2720ad1ce07b3d2d4b4741fc15eca7dfe
|
4
|
+
data.tar.gz: 1f4d286c9c1a967762669cf200432d0849923d9aa3fbc2d4ef7b6d8455a37963
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6b2490b76285ce91ce13e13c19c7269d699a136b3dce4d8bd40ec1fa888c21a880aadfa15925c27509288330ea79037e4d8d911327063700a6370ed390212438
|
7
|
+
data.tar.gz: b0ea6d4f0195cc0469149c2ae9e4f230d70f8c9cc99982045c37084f79d05fe11b9f92070bd744382dad839b49f181f2e402467b7db10e62e19e9075bf6fc127
|
data/bin/algoheader
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby'
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright 2021 Dick Davis
|
5
|
+
#
|
6
|
+
# This file is part of algoheader.
|
7
|
+
#
|
8
|
+
# algoheader is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# algoheader is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
##
|
22
|
+
# = /bin/algoheader
|
23
|
+
# Author:: Dick Davis
|
24
|
+
# Copyright:: Copyright 2021 Dick Davis
|
25
|
+
# License:: GNU Public License 3
|
26
|
+
#
|
27
|
+
# Project executable file.
|
28
|
+
begin
|
29
|
+
require 'algoheader'
|
30
|
+
rescue LoadError
|
31
|
+
require 'rubygems'
|
32
|
+
require 'algoheader'
|
33
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
##
|
21
|
+
# = /lib/algoheader.rb
|
22
|
+
# Author:: Dick Davis
|
23
|
+
# Copyright:: Copyright 2021 Dick Davis
|
24
|
+
# License:: GNU Public License 3
|
25
|
+
#
|
26
|
+
# Main application file that loads other files.
|
27
|
+
|
28
|
+
require 'algoheader/helpers'
|
29
|
+
require 'algoheader/png_transformer'
|
30
|
+
require 'algoheader/svg_generator'
|
31
|
+
require 'algoheader/version'
|
32
|
+
|
33
|
+
require 'optparse'
|
34
|
+
require 'English'
|
35
|
+
require 'fileutils'
|
36
|
+
require 'yaml'
|
37
|
+
|
38
|
+
trap('INT') do
|
39
|
+
puts "\nTerminating..."
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
options = {}
|
44
|
+
|
45
|
+
# rubocop:disable Metrics/BlockLength
|
46
|
+
optparse = OptionParser.new do |opts|
|
47
|
+
opts.banner = 'Usage: algoheader [options]'
|
48
|
+
|
49
|
+
opts.on('-c', '--config FILE', 'Specifies the configuration file to use.') do |config|
|
50
|
+
options[:config] = config
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on('-d', '--directory NAME', 'Sets the output directory.') do |dir|
|
54
|
+
options[:dir] = dir
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on('-i', '--images NUMBER', 'Sets the number of images to generate (max 99.)') do |images|
|
58
|
+
options[:images] = images.to_i > 99 ? 99 : images.to_i
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on('-r', '--raster', 'Create PNG copies of the generated SVGs.') do
|
62
|
+
options[:raster] = true
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on('-l', '--license', 'Displays the copyright notice') do
|
66
|
+
puts "This program is free software: you can redistribute it and/or modify
|
67
|
+
it under the terms of the GNU General Public License as published by
|
68
|
+
the Free Software Foundation, either version 3 of the License, or
|
69
|
+
(at your option) any later version.
|
70
|
+
"
|
71
|
+
end
|
72
|
+
|
73
|
+
opts.on('-w', '--warranty', 'Displays the warranty statement') do
|
74
|
+
puts "This program is distributed in the hope that it will be useful,
|
75
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
76
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
77
|
+
GNU General Public License for more details.
|
78
|
+
"
|
79
|
+
end
|
80
|
+
|
81
|
+
opts.on('-v', '--version', 'Displays the program version') do
|
82
|
+
puts "algoheader v#{Algoheader::VERSION}"
|
83
|
+
end
|
84
|
+
|
85
|
+
opts.on_tail('-h', '--help', 'Displays the help screen') do
|
86
|
+
puts opts
|
87
|
+
exit
|
88
|
+
end
|
89
|
+
end
|
90
|
+
# rubocop:enable Metrics/BlockLength
|
91
|
+
|
92
|
+
begin
|
93
|
+
optparse.parse!
|
94
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
95
|
+
puts $ERROR_INFO.to_s
|
96
|
+
puts 'Use -h or --help for options.'
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
|
100
|
+
output_dir = options[:dir] || 'algoheader_output'
|
101
|
+
FileUtils.mkdir_p(output_dir)
|
102
|
+
|
103
|
+
config_file = options[:config] || Algoheader::Helpers.config_from_home
|
104
|
+
config = YAML.load_file(config_file)
|
105
|
+
|
106
|
+
selection = Algoheader::Helpers.selection_from_user(config)
|
107
|
+
|
108
|
+
(options[:images] || 50).times do |index|
|
109
|
+
filename = "#{selection[:name]}_#{(index + 1).to_s.rjust(2, '0')}"
|
110
|
+
|
111
|
+
svg_blob = Algoheader::SvgGenerator.call(**selection.slice(:fill_colors, :stroke_colors))
|
112
|
+
File.write("#{output_dir}/#{filename}.svg", svg_blob)
|
113
|
+
|
114
|
+
Algoheader::PngTransformer.call(svg_blob, output_dir, filename) if options[:raster]
|
115
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Algoheader
|
21
|
+
##
|
22
|
+
# = Helpers
|
23
|
+
# Author:: Dick Davis
|
24
|
+
# Copyright:: Copyright 2021 Dick Davis
|
25
|
+
# License:: GNU Public License 3
|
26
|
+
#
|
27
|
+
# Module that provides helper methods.
|
28
|
+
module Helpers
|
29
|
+
def self.config_from_home
|
30
|
+
config_dir = "#{ENV['XDG_CONFIG_HOME'] || "#{Dir.home}/.config"}/algoheader"
|
31
|
+
FileUtils.mkdir_p(config_dir)
|
32
|
+
|
33
|
+
config_filename = "#{config_dir}/config.yml"
|
34
|
+
unless File.exist?(config_filename)
|
35
|
+
config_asset = File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets', 'config.yml'))
|
36
|
+
FileUtils.cp(config_asset, config_filename)
|
37
|
+
end
|
38
|
+
|
39
|
+
config_filename
|
40
|
+
end
|
41
|
+
|
42
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
43
|
+
def self.selection_from_user(config, selection = '')
|
44
|
+
while selection.empty?
|
45
|
+
puts 'Choose a color scheme from the list below:'
|
46
|
+
|
47
|
+
schemes = config['color_schemes'].collect { |scheme| scheme['name'] }
|
48
|
+
schemes.each.with_index do |scheme, index|
|
49
|
+
puts "#{index}: #{scheme}"
|
50
|
+
end
|
51
|
+
|
52
|
+
puts 'Selection => '
|
53
|
+
user_input = gets.chomp.to_i
|
54
|
+
next unless (0..schemes.length - 1).include?(user_input)
|
55
|
+
|
56
|
+
selection = config['color_schemes'].select { |scheme| scheme['name'] == schemes[user_input] }
|
57
|
+
.first
|
58
|
+
.transform_keys(&:to_sym)
|
59
|
+
end
|
60
|
+
|
61
|
+
selection
|
62
|
+
end
|
63
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'rmagick'
|
21
|
+
require_relative 'service_object'
|
22
|
+
|
23
|
+
module Algoheader
|
24
|
+
##
|
25
|
+
# = PngTransformer
|
26
|
+
# Author:: Dick Davis
|
27
|
+
# Copyright:: Copyright 2021 Dick Davis
|
28
|
+
# License:: GNU Public License 3
|
29
|
+
#
|
30
|
+
# Service object that writes SVG blobs to PNG files.
|
31
|
+
class PngTransformer < ServiceObject
|
32
|
+
attr_reader :svg, :dir, :filename
|
33
|
+
|
34
|
+
def initialize(svg, dir, filename)
|
35
|
+
super
|
36
|
+
@svg = svg
|
37
|
+
@dir = dir
|
38
|
+
@filename = filename
|
39
|
+
end
|
40
|
+
|
41
|
+
def call
|
42
|
+
img = Magick::Image.from_blob(svg) do
|
43
|
+
self.format = 'SVG'
|
44
|
+
self.background_color = 'transparent'
|
45
|
+
end
|
46
|
+
img[0].write("#{dir}/#{filename}.png")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Algoheader
|
21
|
+
##
|
22
|
+
# = ServiceObject
|
23
|
+
# Author:: Dick Davis
|
24
|
+
# Copyright:: Copyright 2021 Dick Davis
|
25
|
+
# License:: GNU Public License 3
|
26
|
+
#
|
27
|
+
# Superclass for classes using the service object design pattern.
|
28
|
+
class ServiceObject
|
29
|
+
##
|
30
|
+
# Allows subclasses to be initialized and called at the same time.
|
31
|
+
def self.call(*args, **kwargs, &block)
|
32
|
+
new(*args, **kwargs, &block).call
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'ascii_to_svg'
|
21
|
+
require_relative 'service_object'
|
22
|
+
|
23
|
+
module Algoheader
|
24
|
+
##
|
25
|
+
# = SvgGenerator
|
26
|
+
# Author:: Dick Davis
|
27
|
+
# Copyright:: Copyright 2021 Dick Davis
|
28
|
+
# License:: GNU Public License 3
|
29
|
+
#
|
30
|
+
# Generates SVGs by providing randomized input to algorithm.
|
31
|
+
class SvgGenerator < ServiceObject
|
32
|
+
SYMBOLS = ['/', '|', '\\', '-', '+', 'x', 'o', "\#", '.'].freeze
|
33
|
+
WIDTHS = [0.75, 1.0, 1.5].freeze
|
34
|
+
LINECAPS = %w[butt round square].freeze
|
35
|
+
OPACITIES = [0.8, 0.9, 1.0].freeze
|
36
|
+
|
37
|
+
attr_reader :fill_colors, :stroke_colors
|
38
|
+
|
39
|
+
def initialize(fill_colors:, stroke_colors:)
|
40
|
+
super
|
41
|
+
@fill_colors = fill_colors
|
42
|
+
@stroke_colors = stroke_colors
|
43
|
+
end
|
44
|
+
|
45
|
+
def call
|
46
|
+
ascii = AsciiToSvg.example_string(random_symbol_sample, 80)
|
47
|
+
AsciiToSvg.from_string(ascii, 16, **options)
|
48
|
+
rescue ZeroDivisionError
|
49
|
+
retry
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def canvas_color
|
55
|
+
@canvas_color ||= random_fill_color
|
56
|
+
end
|
57
|
+
|
58
|
+
# rubocop:disable Metrics/MethodLength
|
59
|
+
def options
|
60
|
+
{
|
61
|
+
canvas__size__x: 1500,
|
62
|
+
style__canvas__fill__color: canvas_color,
|
63
|
+
style__line__stroke__width: random_width,
|
64
|
+
style__line__stroke__color: random_stroke_color,
|
65
|
+
style__line__stroke__opacity: random_opacity,
|
66
|
+
style__line__stroke__linecap: random_linecap,
|
67
|
+
style__ellipse__stroke__width: random_width,
|
68
|
+
style__ellipse__stroke__color: random_stroke_color,
|
69
|
+
style__ellipse__stroke__opacity: random_opacity,
|
70
|
+
style__ellipse__stroke__linecap: random_linecap,
|
71
|
+
style__ellipse__fill: random_fill_color,
|
72
|
+
style__rectangle__fill__color: random_fill_color
|
73
|
+
}
|
74
|
+
end
|
75
|
+
# rubocop:enable Metrics/MethodLength
|
76
|
+
|
77
|
+
def random_symbol_sample
|
78
|
+
SYMBOLS.sample(rand(SYMBOLS.length))
|
79
|
+
end
|
80
|
+
|
81
|
+
def random_width
|
82
|
+
WIDTHS.sample
|
83
|
+
end
|
84
|
+
|
85
|
+
def random_opacity
|
86
|
+
OPACITIES.sample
|
87
|
+
end
|
88
|
+
|
89
|
+
def random_linecap
|
90
|
+
LINECAPS.sample
|
91
|
+
end
|
92
|
+
|
93
|
+
def random_fill_color
|
94
|
+
return fill_colors.sample if @canvas_color.nil?
|
95
|
+
|
96
|
+
fill_colors.reject { |color| color == canvas_color }.sample
|
97
|
+
end
|
98
|
+
|
99
|
+
def random_stroke_color
|
100
|
+
stroke_colors.reject { |color| color == canvas_color }.sample
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
##
|
21
|
+
# = version.rb
|
22
|
+
# Author:: Dick Davis
|
23
|
+
# Copyright:: Copyright 2021 Dick Davis
|
24
|
+
# License:: GNU Public License 3
|
25
|
+
#
|
26
|
+
# Module for namespacing application classes.
|
27
|
+
module Algoheader
|
28
|
+
# Program version number
|
29
|
+
VERSION = '0.0.1'
|
30
|
+
end
|
data/lib/algoheader.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'algoheader/base'
|
21
|
+
|
22
|
+
##
|
23
|
+
# = Algoheader
|
24
|
+
# Author:: Dick Davis
|
25
|
+
# Copyright:: Copyright 2021 Dick Davis
|
26
|
+
# License:: GNU Public License 3
|
27
|
+
#
|
28
|
+
# Module for namespacing application classes.
|
29
|
+
module Algoheader; end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
color_schemes:
|
2
|
+
- name: 'magnolia'
|
3
|
+
fill_colors:
|
4
|
+
- 'rgb(246,238,235)'
|
5
|
+
- 'rgb(234,213,207)'
|
6
|
+
- 'rgb(200,224,228)'
|
7
|
+
- 'white'
|
8
|
+
stroke_colors:
|
9
|
+
- 'rgb(246,238,235)'
|
10
|
+
- 'rgb(234,213,207)'
|
11
|
+
- 'rgb(200,224,228)'
|
12
|
+
- 'rgb(113,151,160)'
|
13
|
+
- 'rgb(34,48,83)'
|
14
|
+
- 'white'
|
data/test/test_hello.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Dick Davis
|
4
|
+
#
|
5
|
+
# This file is part of algoheader.
|
6
|
+
#
|
7
|
+
# algoheader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# algoheader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with algoheader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'minitest/autorun'
|
21
|
+
require_relative '../lib/algoheader/hello'
|
22
|
+
|
23
|
+
##
|
24
|
+
# = HelloTest
|
25
|
+
# Author:: Dick Davis
|
26
|
+
# Copyright:: Copyright 2021 Dick Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Contains tests for Hello class.
|
30
|
+
class HelloTest < Minitest::Test
|
31
|
+
##
|
32
|
+
# Initializes test with sample data
|
33
|
+
def setup
|
34
|
+
@name = 'friend'
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Ensures the greeter is behaving as expected
|
39
|
+
def test_hello
|
40
|
+
assert_equal('Hello, friend.', Algoheader::Hello.greeting(@name))
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: algoheader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dick Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ascii_to_svg
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.4
|
27
|
+
description: 'Programmatically generate beautiful header images for blogs or social
|
28
|
+
media accounts.
|
29
|
+
|
30
|
+
'
|
31
|
+
email: dick@hey.com
|
32
|
+
executables:
|
33
|
+
- algoheader
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- bin/algoheader
|
38
|
+
- lib/algoheader.rb
|
39
|
+
- lib/algoheader/base.rb
|
40
|
+
- lib/algoheader/helpers.rb
|
41
|
+
- lib/algoheader/png_transformer.rb
|
42
|
+
- lib/algoheader/service_object.rb
|
43
|
+
- lib/algoheader/svg_generator.rb
|
44
|
+
- lib/algoheader/version.rb
|
45
|
+
- lib/assets/config.yml
|
46
|
+
- test/test_hello.rb
|
47
|
+
homepage: https://github.com/d3d1rty/algoheader
|
48
|
+
licenses:
|
49
|
+
- GPL-3.0
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3.0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.2.15
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Programmatically generate beautiful header images for blogs or social media
|
70
|
+
accounts.
|
71
|
+
test_files:
|
72
|
+
- test/test_hello.rb
|