3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/generators/mini_program/install/install_generator.rb', line 3
def create_initializer_file
appid = if Object.const_defined? "WechatPayment"
WechatPayment.sub_appid || WechatPayment.appid || "your appid"
else
"your appid"
end
app_secret = if Object.const_defined? "WechatPayment"
WechatPayment.sub_app_secret || WechatPayment.app_secret || "your app secret"
else
"your app_secret"
end
create_file "config/initializers/mini_program.rb", <<~INITIALIZER
MiniProgram.setup do |config|
config.appid = "#{appid}"
config.app_secret = "#{app_secret}"
end
INITIALIZER
end
|