1
1
# frozen_string_literal: true
2
2
3
- Dir [ File . dirname ( __FILE__ ) + ' /**/*.rb' ] . each { |file | require file }
3
+ Dir [ File . dirname ( __FILE__ ) + " /**/*.rb" ] . each { |file | require file }
4
4
5
5
module DiscourseDevAssets
6
- require ' discourse_dev_assets/engine'
6
+ require " discourse_dev_assets/engine"
7
7
8
8
def self . avatars
9
9
# Using the stock avatar images from https://tinyfac.es
10
10
# Tiny Faces is a free crowd-sourced avatar gallery
11
- Dir [ File . join ( __dir__ , '..' , ' avatars' , ' *.*' ) ]
11
+ Dir [ File . join ( __dir__ , ".." , " avatars" , " *.*" ) ]
12
12
end
13
13
end
14
14
@@ -18,41 +18,45 @@ def self.avatars
18
18
alias_method :rails_each_current_configuration , :each_current_configuration
19
19
20
20
private
21
+
21
22
def each_current_configuration ( environment , name = nil )
22
- rails_each_current_configuration ( environment , name ) { |db_config |
23
- next if environment == "development" &&
24
- ENV [ "SKIP_TEST_DATABASE" ] == "1" &&
25
- db_config . configuration_hash [ :database ] != "discourse_development"
23
+ rails_each_current_configuration ( environment , name ) do |db_config |
24
+ if environment == "development" && ENV [ "SKIP_TEST_DATABASE" ] == "1" &&
25
+ db_config . configuration_hash [ :database ] != "discourse_development"
26
+ next
27
+ end
26
28
27
29
yield db_config
28
- }
30
+ end
29
31
end
30
32
end
31
33
32
- require ' faker'
34
+ require " faker"
33
35
34
36
Faker ::Base . instance_eval do
35
- alias : faker_translate : translate
37
+ alias faker_translate translate
36
38
37
39
def translate ( *args , **opts )
38
- if args [ 0 ] == "faker.lorem.words"
39
- args [ 0 ] = "faker.discourse.words"
40
- end
40
+ args [ 0 ] = "faker.discourse.words" if args [ 0 ] == "faker.lorem.words"
41
41
42
42
faker_translate ( *args , **opts )
43
43
end
44
44
end
45
45
46
- require ' literate_randomizer'
46
+ require " literate_randomizer"
47
47
48
48
Faker ::Lorem . instance_eval do
49
- alias : faker_sentence : sentence
50
- alias : faker_paragraph : paragraph
49
+ alias faker_sentence sentence
50
+ alias faker_paragraph paragraph
51
51
52
52
NOT_GIVEN = Object . new
53
53
54
54
def sentence ( word_count : 4 , supplemental : false , random_words_to_add : 15 )
55
- faker_sentence ( word_count : word_count , supplemental : supplemental , random_words_to_add : random_words_to_add )
55
+ faker_sentence (
56
+ word_count : word_count ,
57
+ supplemental : supplemental ,
58
+ random_words_to_add : random_words_to_add ,
59
+ )
56
60
end
57
61
58
62
def paragraph ( options = { } )
0 commit comments