Class: FeatureflowGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/featureflow_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializer_fileObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/featureflow_generator.rb', line 11

def create_initializer_file
  unless /^srv-env-[a-f0-9]{32}$/ =~ api_key
    raise Thor::Error, "Invalid featureflow environment api key #{api_key.inspect}\nYou can find your environment api key on your featureflow dashboard at https://[APP-NAME].featureflow.io/"
  end

  initializer "featureflow.rb" do
    "Featureflow.configure(\napi_key: \#{api_key.inspect}\n)\n    EOF\n  end\nend\n"