fake_picture 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/License.txt +21 -0
  3. data/README.md +39 -0
  4. data/bin/fake_picture +5 -0
  5. data/lib/fake_picture/blog/blog.rb +5 -0
  6. data/lib/fake_picture/blog/pack/day_street-1.webp +0 -0
  7. data/lib/fake_picture/blog/pack/day_street-10.webp +0 -0
  8. data/lib/fake_picture/blog/pack/day_street-2.webp +0 -0
  9. data/lib/fake_picture/blog/pack/day_street-3.webp +0 -0
  10. data/lib/fake_picture/blog/pack/day_street-4.webp +0 -0
  11. data/lib/fake_picture/blog/pack/day_street-5.webp +0 -0
  12. data/lib/fake_picture/blog/pack/day_street-6.webp +0 -0
  13. data/lib/fake_picture/blog/pack/day_street-7.webp +0 -0
  14. data/lib/fake_picture/blog/pack/day_street-8.webp +0 -0
  15. data/lib/fake_picture/blog/pack/day_street-9.webp +0 -0
  16. data/lib/fake_picture/blog/pack/night_street-1.webp +0 -0
  17. data/lib/fake_picture/blog/pack/night_street-10.webp +0 -0
  18. data/lib/fake_picture/blog/pack/night_street-2.webp +0 -0
  19. data/lib/fake_picture/blog/pack/night_street-3.webp +0 -0
  20. data/lib/fake_picture/blog/pack/night_street-4.webp +0 -0
  21. data/lib/fake_picture/blog/pack/night_street-5.webp +0 -0
  22. data/lib/fake_picture/blog/pack/night_street-6.webp +0 -0
  23. data/lib/fake_picture/blog/pack/night_street-7.webp +0 -0
  24. data/lib/fake_picture/blog/pack/night_street-8.webp +0 -0
  25. data/lib/fake_picture/blog/pack/night_street-9.webp +0 -0
  26. data/lib/fake_picture/people/pack/man-1.webp +0 -0
  27. data/lib/fake_picture/people/pack/man-10.webp +0 -0
  28. data/lib/fake_picture/people/pack/man-2.webp +0 -0
  29. data/lib/fake_picture/people/pack/man-3.webp +0 -0
  30. data/lib/fake_picture/people/pack/man-4.webp +0 -0
  31. data/lib/fake_picture/people/pack/man-5.webp +0 -0
  32. data/lib/fake_picture/people/pack/man-6.webp +0 -0
  33. data/lib/fake_picture/people/pack/man-7.webp +0 -0
  34. data/lib/fake_picture/people/pack/man-8.webp +0 -0
  35. data/lib/fake_picture/people/pack/man-9.webp +0 -0
  36. data/lib/fake_picture/people/pack/woman-1.webp +0 -0
  37. data/lib/fake_picture/people/pack/woman-10.webp +0 -0
  38. data/lib/fake_picture/people/pack/woman-2.webp +0 -0
  39. data/lib/fake_picture/people/pack/woman-3.webp +0 -0
  40. data/lib/fake_picture/people/pack/woman-4.webp +0 -0
  41. data/lib/fake_picture/people/pack/woman-5.webp +0 -0
  42. data/lib/fake_picture/people/pack/woman-6.webp +0 -0
  43. data/lib/fake_picture/people/pack/woman-7.webp +0 -0
  44. data/lib/fake_picture/people/pack/woman-8.webp +0 -0
  45. data/lib/fake_picture/people/pack/woman-9.webp +0 -0
  46. data/lib/fake_picture/people/people.rb +5 -0
  47. data/lib/fake_picture/version.rb +5 -0
  48. data/lib/fake_picture.rb +58 -0
  49. metadata +136 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 883cd7ec6ed1cf3064070e02da5e782a52220a64e2db707ca46a7487a39aa0ff
4
+ data.tar.gz: 5e5d0877532e7621fe5a663766e7c110ee566dfc670999da1616a76c265c05f7
5
+ SHA512:
6
+ metadata.gz: f88a378d5c3dddf3f89340953fc770c42413dd2550b570db20969a9c89948e217d57940347c5acf15098b95f167233573ced00a3164407dab6c5161417a46e4c
7
+ data.tar.gz: 7833751a34172168a075dde6e3cc86ddfd3b35bb00985b3188d22dfe8a356a81731b5a0ae42d526b2ca1fb46225aaacd614567684198f56393fcac72107ec334
data/License.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 loqimean
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # FakePicture
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fake_picture`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fake_picture'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fake_picture
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fake_picture.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/fake_picture ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path('../lib', __dir__)
5
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
@@ -0,0 +1,5 @@
1
+ module FakePicture
2
+ class Blog < Base
3
+ define_methods(__dir__, :day_street, :night_street)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module FakePicture
2
+ class People < Base
3
+ define_methods(__dir__, :man, :woman)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FakePicture
4
+ VERSION = "0.1.1"
5
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FakePicture
4
+ class Base
5
+ PACK_PATH = '/pack'
6
+
7
+ def self.random_file(path, file: false)
8
+ path_to_file = Dir[path].select { |f| File.file?(f) }.sample
9
+
10
+ return false if path_to_file.nil?
11
+
12
+ file ? File.new(path_to_file) : path_to_file
13
+ end
14
+
15
+ def download(query)
16
+ #TODO: make downloading pictures to gem
17
+ end
18
+
19
+ def self.define_methods(path_to_directory, *method_names)
20
+ method_names.each do |name|
21
+ define_singleton_method :"#{name}" do
22
+ self.superclass.check_pack_directory_readiness(path_to_directory + PACK_PATH)
23
+
24
+ self.superclass.random_file("#{path_to_directory + PACK_PATH}/#{name}-*.webp")
25
+ end
26
+
27
+ define_singleton_method :"#{name}_file" do
28
+ self.superclass.check_pack_directory_readiness(path_to_directory + PACK_PATH)
29
+
30
+ self.superclass.random_file("#{path_to_directory + PACK_PATH}/#{name}-*.webp", file: true)
31
+ end
32
+
33
+ define_singleton_method :random do
34
+ self.superclass.check_pack_directory_readiness(path_to_directory + PACK_PATH)
35
+
36
+ self.superclass.random_file("#{path_to_directory + self::PACK_PATH}/*.webp")
37
+ end
38
+
39
+ define_singleton_method :random_file do
40
+ self.superclass.check_pack_directory_readiness(path_to_directory + PACK_PATH)
41
+
42
+ self.superclass.random_file("#{path_to_directory + self::PACK_PATH}/*.webp", file: true)
43
+ end
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def self.check_pack_directory_readiness(path)
50
+ raise 'Pack folder doesn\'t exist or empty' unless File.directory?(path) and !Dir.empty?(path)
51
+ end
52
+ end
53
+ end
54
+
55
+ # require fake_picture objects
56
+ Dir.glob(File.join(__dir__, 'fake_picture', '/**/*.rb')).sort.each { |file| require file }
57
+
58
+ # add photos like icons animals posts avatarsма
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fake_picture
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - loqimean
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: debug
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: simple way for fake pictures some categories
56
+ email:
57
+ - vanuha277@gmail.com
58
+ executables:
59
+ - fake_picture
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - License.txt
64
+ - README.md
65
+ - bin/fake_picture
66
+ - lib/fake_picture.rb
67
+ - lib/fake_picture/blog/blog.rb
68
+ - lib/fake_picture/blog/pack/day_street-1.webp
69
+ - lib/fake_picture/blog/pack/day_street-10.webp
70
+ - lib/fake_picture/blog/pack/day_street-2.webp
71
+ - lib/fake_picture/blog/pack/day_street-3.webp
72
+ - lib/fake_picture/blog/pack/day_street-4.webp
73
+ - lib/fake_picture/blog/pack/day_street-5.webp
74
+ - lib/fake_picture/blog/pack/day_street-6.webp
75
+ - lib/fake_picture/blog/pack/day_street-7.webp
76
+ - lib/fake_picture/blog/pack/day_street-8.webp
77
+ - lib/fake_picture/blog/pack/day_street-9.webp
78
+ - lib/fake_picture/blog/pack/night_street-1.webp
79
+ - lib/fake_picture/blog/pack/night_street-10.webp
80
+ - lib/fake_picture/blog/pack/night_street-2.webp
81
+ - lib/fake_picture/blog/pack/night_street-3.webp
82
+ - lib/fake_picture/blog/pack/night_street-4.webp
83
+ - lib/fake_picture/blog/pack/night_street-5.webp
84
+ - lib/fake_picture/blog/pack/night_street-6.webp
85
+ - lib/fake_picture/blog/pack/night_street-7.webp
86
+ - lib/fake_picture/blog/pack/night_street-8.webp
87
+ - lib/fake_picture/blog/pack/night_street-9.webp
88
+ - lib/fake_picture/people/pack/man-1.webp
89
+ - lib/fake_picture/people/pack/man-10.webp
90
+ - lib/fake_picture/people/pack/man-2.webp
91
+ - lib/fake_picture/people/pack/man-3.webp
92
+ - lib/fake_picture/people/pack/man-4.webp
93
+ - lib/fake_picture/people/pack/man-5.webp
94
+ - lib/fake_picture/people/pack/man-6.webp
95
+ - lib/fake_picture/people/pack/man-7.webp
96
+ - lib/fake_picture/people/pack/man-8.webp
97
+ - lib/fake_picture/people/pack/man-9.webp
98
+ - lib/fake_picture/people/pack/woman-1.webp
99
+ - lib/fake_picture/people/pack/woman-10.webp
100
+ - lib/fake_picture/people/pack/woman-2.webp
101
+ - lib/fake_picture/people/pack/woman-3.webp
102
+ - lib/fake_picture/people/pack/woman-4.webp
103
+ - lib/fake_picture/people/pack/woman-5.webp
104
+ - lib/fake_picture/people/pack/woman-6.webp
105
+ - lib/fake_picture/people/pack/woman-7.webp
106
+ - lib/fake_picture/people/pack/woman-8.webp
107
+ - lib/fake_picture/people/pack/woman-9.webp
108
+ - lib/fake_picture/people/people.rb
109
+ - lib/fake_picture/version.rb
110
+ homepage: https://github.com/loqimean/fake_picture
111
+ licenses:
112
+ - MIT
113
+ metadata:
114
+ allowed_push_host: https://rubygems.org/
115
+ homepage_uri: https://github.com/loqimean/fake_picture
116
+ source_code_uri: https://github.com/loqimean/fake_picture
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 2.3.0
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubygems_version: 3.2.3
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: fake pictures
136
+ test_files: []