11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/generators/productive/productive_generator.rb', line 11
def create_initializer_file
if /^[a-f0-9\-]{36}$/ !~ api_key
raise Thor::Error, "Invalid Productive API key #{api_key.inspect}\nYou can find the API key on the Settings -> Security page of https://productive.io"
end
if /^[0-9]*$/ !~ account_id
raise Thor::Error, "Invalid Productive Account ID #{account_id.inspect}\n"
end
initializer 'productive.rb' do
<<-CONFIG.strip_heredoc
Productive.configure do |config|
config.api_key = #{api_key.inspect}
config.account_id = #{account_id.inspect}
end
CONFIG
end
end
|