Class: Orats::Commands::Role

Inherits:
Common
  • Object
show all
Includes:
Project::Rails
Defined in:
lib/orats/commands/role.rb

Constant Summary

Constants inherited from Common

Common::RELATIVE_PATHS

Instance Attribute Summary

Attributes inherited from Common

#local_paths, #remote_gem_version, #remote_paths

Instance Method Summary collapse

Methods included from Project::Rails

#bundle_binstubs, #bundle_install, #check_exit_conditions, #create_and_migrate_database, #custom_rails_template, #generate_favicons, #generate_home_page, #gsub_postgres_info, #gsub_project_path, #gsub_readme, #gsub_redis_info, #migrate_and_seed_database, #rails_template, #run_rake, #spring_binstub, #template_exist?

Methods inherited from Common

#base_path, copy_from_local_gem, #exit_if_path_exists, #exit_if_process, #file_to_string, #repo_path, #url_to_string

Methods included from Diff::Parse

#galaxyfile, #gem_version, #hosts, #inventory, #playbook

Methods included from UI

#git_commit, #log_error, #log_remote_info, #log_results, #log_status_bottom, #log_status_top, #log_task, #run_from

Constructor Details

#initialize(target_path = '', options = {}) ⇒ Role

Returns a new instance of Role.



9
10
11
# File 'lib/orats/commands/role.rb', line 9

def initialize(target_path = '', options = {})
  super
end

Instance Method Details

#initObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/orats/commands/role.rb', line 13

def init
  check_exit_conditions check_running_processes: false
  exit_if_invalid_role_name

  rails_template 'role'
  custom_rails_template unless @options[:custom].empty?

  repo_name = @options[:repo_name].empty? ? base_file_name :
      @options[:repo_name]

  log_task 'Update place holder repo name'
  gsub_file "#{@target_path}/README.md", 'repo_name',
            repo_name
  gsub_file "#{@target_path}/tests/main.yml", 'repo_name',
            repo_name
  git_commit 'Update place holder repo name'

  log_success
end