art_css 1.0.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 +7 -0
- data/lib/art_css.rb +63 -0
- data/lib/version.rb +1 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7f037c355ddc3bd3d8d83c43fc385186c78ae37b
|
4
|
+
data.tar.gz: 21d547eecb9476d584e74b4579d33e3bab9a5d52
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01adcf376bc525757c221cf7179a95b85fbe732d5b13785648c613b29b2841cc3d4df3b87f3c09c89064866c8f553676e70723ab554b108e7acd67e22f2c6e9b
|
7
|
+
data.tar.gz: 40dc51770abd0586d10a6b0bce1c300eb97fae6fc8d463b2dace5d48a34c8e0b992a3f8cb7055e554d154f173e37a092d37e83920bff1ccd869d1bb36f6c060d
|
data/lib/art_css.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require_relative "version"
|
3
|
+
|
4
|
+
def return_random_image(array)
|
5
|
+
random_image = Random.new
|
6
|
+
random_image = random_image.rand(0...array.size)
|
7
|
+
array.each_index do |index|
|
8
|
+
random_image = array[random_image] if index == random_image
|
9
|
+
end
|
10
|
+
|
11
|
+
random_image
|
12
|
+
end
|
13
|
+
|
14
|
+
def write_css(output_path, css_code)
|
15
|
+
File.open("#{output_path}.css", 'w') do |file|
|
16
|
+
file.puts(css_code)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def write_fullscreen_background_no_repeat_css(input_path, section, output_path)
|
21
|
+
css_code = "#{section} {
|
22
|
+
background-image: url('#{input_path}');
|
23
|
+
background-repeat:no-repeat;
|
24
|
+
background-size:cover;
|
25
|
+
}"
|
26
|
+
|
27
|
+
write_css(output_path, css_code)
|
28
|
+
end
|
29
|
+
|
30
|
+
def write_background_with_two_images_css(input_path1, input_path2, section, output_path)
|
31
|
+
css_code = "#{section} {
|
32
|
+
background-image: url('#{input_path1}'), url('#{input_path2}');
|
33
|
+
}"
|
34
|
+
|
35
|
+
write_css(output_path, css_code)
|
36
|
+
end
|
37
|
+
|
38
|
+
def write_background_with_three_images_css(input_path1, input_path2, input_path3, section, output_path)
|
39
|
+
css_code = "#{section} {
|
40
|
+
background-image: url('#{input_path1}'), url('#{input_path2}'), url('#{input_path3}');
|
41
|
+
}"
|
42
|
+
|
43
|
+
write_css(output_path, css_code)
|
44
|
+
end
|
45
|
+
|
46
|
+
def write_background_with_four_images_css(input_path1, input_path2, input_path3, input_path4, section, output_path)
|
47
|
+
css_code = "#{section} {
|
48
|
+
background-image: url('#{input_path1}'), url('#{input_path2}'), url('#{input_path3}'), url('#{input_path4}');
|
49
|
+
}"
|
50
|
+
|
51
|
+
write_css(output_path, css_code)
|
52
|
+
end
|
53
|
+
|
54
|
+
def return_array_of_images(dir)
|
55
|
+
images = []
|
56
|
+
FileUtils.cd(dir) do
|
57
|
+
Dir.entries(".").each do |entry|
|
58
|
+
images.push(entry) if File.extname(entry) == ".png" || File.extname(entry) == ".jpg" || File.extname(entry) == ".gif"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
images
|
63
|
+
end
|
data/lib/version.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ART_CSS_VERSION = "1.0.0"
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: art_css
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ralph Desir
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A library that generates stylesheets for art websites. It can be used
|
14
|
+
to display random backgrounds for art websites and portfolios.
|
15
|
+
email: battleroundscool@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/art_css.rb
|
21
|
+
- lib/version.rb
|
22
|
+
homepage: https://github.com/Mav7/art_css
|
23
|
+
licenses:
|
24
|
+
- GPL-2.0
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.5.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: art_css
|
46
|
+
test_files: []
|