fake_picture 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -13
- data/lib/fake_picture/avatar/avatar.rb +1 -1
- data/lib/fake_picture/blog/blog.rb +1 -1
- data/lib/fake_picture/blog/pack/{night_street-1.jpg → preview-1.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-10.jpg → preview-10.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-10.jpg → preview-11.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-1.jpg → preview-12.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-2.jpg → preview-13.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-3.jpg → preview-14.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-4.jpg → preview-15.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-5.jpg → preview-16.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-6.jpg → preview-17.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-7.jpg → preview-18.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-8.jpg → preview-19.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-2.jpg → preview-2.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{day_street-9.jpg → preview-20.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-3.jpg → preview-3.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-4.jpg → preview-4.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-5.jpg → preview-5.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-6.jpg → preview-6.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-7.jpg → preview-7.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-8.jpg → preview-8.jpg} +0 -0
- data/lib/fake_picture/blog/pack/{night_street-9.jpg → preview-9.jpg} +0 -0
- data/lib/fake_picture/version.rb +1 -1
- data/lib/fake_picture.rb +2 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 850dc51a67a336556a31295842e922a4723fbe02980389afc00c0a899131d038
|
4
|
+
data.tar.gz: 2a3e61481c93777d81eb1c0f1e7afc76cf47806363f604b24561fc5e35eb91d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 958493be0c2d260faf4fd418ae96ad21b5c7ccb88cf69b7a229a2330d3f88dc0bdc54ca2374a352ff47c7312805f321e055eec6ccab3d030addd0ec2d5068537
|
7
|
+
data.tar.gz: 99b9d4eb63975d07afa9dcc3e2d1a43509e009bb9433b02c89ee3a7841f739badcc5ee7f1736e389df5d35761f68a66068c810a29247eeb6cec995018155fe47
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Actions Status](https://github.com/loqimean/fake_picture/actions/workflows/CI.yml/badge.svg)](https://github.com/loqimean/fake_picture/actions)
|
1
2
|
|
2
3
|
# FakePicture
|
3
4
|
|
@@ -24,37 +25,66 @@ Or install it yourself as:
|
|
24
25
|
###### FakePicture::Avatar:
|
25
26
|
|
26
27
|
```ruby
|
27
|
-
FakePicture::Avatar.man
|
28
|
-
|
29
|
-
FakePicture::Avatar.man_file #=> #<File:/Users/username/workdirectory/fake_picture/lib/fake_picture/avatar/pack/man-2.jpg>
|
28
|
+
FakePicture::Avatar.man #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/avatar/pack/man-4.jpg
|
30
29
|
|
31
30
|
FakePicture::Avatar.woman #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/avatar/pack/woman-4.jpg
|
31
|
+
```
|
32
|
+
|
33
|
+
You can also call method `person` if you want to get random `avatar`:
|
32
34
|
|
33
|
-
|
35
|
+
```ruby
|
36
|
+
FakePicture::Avatar.person #=> "/Users/xi-master/Workplace/fake_picture/lib/fake_picture/avatar/pack/woman-5.svg"
|
34
37
|
```
|
35
38
|
|
36
39
|
###### FakePicture::Blog:
|
37
40
|
|
38
41
|
```ruby
|
39
|
-
FakePicture::Blog.
|
42
|
+
FakePicture::Blog.preview #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/blog/pack/preview-4.jpg
|
43
|
+
```
|
40
44
|
|
41
|
-
FakePicture::
|
45
|
+
###### FakePicture::People:
|
42
46
|
|
43
|
-
|
47
|
+
```ruby
|
48
|
+
FakePicture::People.man #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/people/pack/man-4.jpg
|
44
49
|
|
45
|
-
FakePicture::
|
50
|
+
FakePicture::People.woman #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/people/pack/woman-4.jpg
|
46
51
|
```
|
47
52
|
|
48
|
-
|
53
|
+
#### As file:
|
54
|
+
|
55
|
+
You can call a method ending in "_file" if you want to get an instance of the File class
|
49
56
|
|
50
57
|
```ruby
|
51
|
-
FakePicture::People.
|
58
|
+
FakePicture::People.man_file #=> /Users/username/workdirectory/fake_picture/lib/fake_picture/people/pack/woman-4.jpg
|
59
|
+
```
|
52
60
|
|
53
|
-
|
61
|
+
#### In factories:
|
54
62
|
|
55
|
-
|
63
|
+
```ruby
|
64
|
+
FactoryBot.define do
|
65
|
+
factory :gallery do
|
66
|
+
file { FakePicture::Blog.preview_file }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
#### In specs:
|
56
72
|
|
57
|
-
|
73
|
+
```ruby
|
74
|
+
it 'some create user test' do
|
75
|
+
post :create, params: {
|
76
|
+
user: {
|
77
|
+
name: 'John',
|
78
|
+
avatar: FakePicture::Avatar.man_file
|
79
|
+
}
|
80
|
+
}
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
#### In seeds:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
User.create(name: 'John', avatar: FakePicture::Avatar.man_file)
|
58
88
|
```
|
59
89
|
|
60
90
|
## Development
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/fake_picture/version.rb
CHANGED
data/lib/fake_picture.rb
CHANGED
@@ -14,13 +14,14 @@ module FakePicture
|
|
14
14
|
#TODO: make downloading pictures to gem
|
15
15
|
# end
|
16
16
|
|
17
|
-
def self.initialize_fake_picture_methods(*method_names)
|
17
|
+
def self.initialize_fake_picture_methods(*method_names, new_random_method_name: nil)
|
18
18
|
path_to_pack = "#{__dir__}/fake_picture/#{self.name.split('::').last.downcase}/pack"
|
19
19
|
|
20
20
|
self.superclass.check_pack_directory_readiness(path_to_pack)
|
21
21
|
|
22
22
|
[*method_names, :random].each do |name|
|
23
23
|
selector = name == :random ? '/*' : "/#{name}-*"
|
24
|
+
name = new_random_method_name if name == :random && !new_random_method_name.nil?
|
24
25
|
|
25
26
|
define_singleton_method :"#{name}" do
|
26
27
|
self.superclass.random_file("#{path_to_pack + selector}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_picture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- loqimean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|
@@ -80,26 +80,26 @@ files:
|
|
80
80
|
- lib/fake_picture/avatar/pack/woman-7.svg
|
81
81
|
- lib/fake_picture/avatar/pack/woman-8.svg
|
82
82
|
- lib/fake_picture/blog/blog.rb
|
83
|
-
- lib/fake_picture/blog/pack/
|
84
|
-
- lib/fake_picture/blog/pack/
|
85
|
-
- lib/fake_picture/blog/pack/
|
86
|
-
- lib/fake_picture/blog/pack/
|
87
|
-
- lib/fake_picture/blog/pack/
|
88
|
-
- lib/fake_picture/blog/pack/
|
89
|
-
- lib/fake_picture/blog/pack/
|
90
|
-
- lib/fake_picture/blog/pack/
|
91
|
-
- lib/fake_picture/blog/pack/
|
92
|
-
- lib/fake_picture/blog/pack/
|
93
|
-
- lib/fake_picture/blog/pack/
|
94
|
-
- lib/fake_picture/blog/pack/
|
95
|
-
- lib/fake_picture/blog/pack/
|
96
|
-
- lib/fake_picture/blog/pack/
|
97
|
-
- lib/fake_picture/blog/pack/
|
98
|
-
- lib/fake_picture/blog/pack/
|
99
|
-
- lib/fake_picture/blog/pack/
|
100
|
-
- lib/fake_picture/blog/pack/
|
101
|
-
- lib/fake_picture/blog/pack/
|
102
|
-
- lib/fake_picture/blog/pack/
|
83
|
+
- lib/fake_picture/blog/pack/preview-1.jpg
|
84
|
+
- lib/fake_picture/blog/pack/preview-10.jpg
|
85
|
+
- lib/fake_picture/blog/pack/preview-11.jpg
|
86
|
+
- lib/fake_picture/blog/pack/preview-12.jpg
|
87
|
+
- lib/fake_picture/blog/pack/preview-13.jpg
|
88
|
+
- lib/fake_picture/blog/pack/preview-14.jpg
|
89
|
+
- lib/fake_picture/blog/pack/preview-15.jpg
|
90
|
+
- lib/fake_picture/blog/pack/preview-16.jpg
|
91
|
+
- lib/fake_picture/blog/pack/preview-17.jpg
|
92
|
+
- lib/fake_picture/blog/pack/preview-18.jpg
|
93
|
+
- lib/fake_picture/blog/pack/preview-19.jpg
|
94
|
+
- lib/fake_picture/blog/pack/preview-2.jpg
|
95
|
+
- lib/fake_picture/blog/pack/preview-20.jpg
|
96
|
+
- lib/fake_picture/blog/pack/preview-3.jpg
|
97
|
+
- lib/fake_picture/blog/pack/preview-4.jpg
|
98
|
+
- lib/fake_picture/blog/pack/preview-5.jpg
|
99
|
+
- lib/fake_picture/blog/pack/preview-6.jpg
|
100
|
+
- lib/fake_picture/blog/pack/preview-7.jpg
|
101
|
+
- lib/fake_picture/blog/pack/preview-8.jpg
|
102
|
+
- lib/fake_picture/blog/pack/preview-9.jpg
|
103
103
|
- lib/fake_picture/people/pack/man-1.jpg
|
104
104
|
- lib/fake_picture/people/pack/man-10.jpg
|
105
105
|
- lib/fake_picture/people/pack/man-2.jpg
|