Class: Activerse::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



10
11
12
# File 'lib/generators/activerse/install_generator.rb', line 10

def copy_templates
  template "activerse.rb", "config/initializers/activerse.rb"
end

#ensure_credentials_filesObject



14
15
16
17
18
19
# File 'lib/generators/activerse/install_generator.rb', line 14

def ensure_credentials_files
  key_path = Rails.application.config.credentials.key_path
  credentials_path = Rails.application.config.credentials.content_path
  encryption_key_file_generator.add_key_file(key_path) unless File.exists? key_path
  credentials_generator.add_credentials_file_silently unless File.exists? credentials_path
end

#show_readmeObject



34
35
36
# File 'lib/generators/activerse/install_generator.rb', line 34

def show_readme
  readme "README" if behavior == :invoke
end

#update_gitObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/activerse/install_generator.rb', line 21

def update_git
  return unless Dir.exists? ".git"
  if File.exists? "config/credentials.enc.yml"
    git rm: "--cached config/credentials.enc.yml"
  end

  append_to_file ".gitignore", <<-GIT
  # Ignore credentials file (Activerse)
  config/master.key
  config/credentials.enc.yml
  GIT
end