Class: Avm::Tools::Runner::EacRedmineBase0::ProjectRename

Inherits:
Rails::Runners::Runner
  • Object
show all
Includes:
EacCli::DefaultRunner
Defined in:
lib/avm/tools/runner/eac_redmine_base0/project_rename.rb

Constant Summary

Constants inherited from Rails::Runners::Runner

Rails::Runners::Runner::DOC

Instance Method Summary collapse

Methods inherited from Rails::Runners::Runner

#bundle_args, #runner_args, #runner_command_uncached

Instance Method Details

#codeObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 39

def code
  "    from_arg = '\#{from}'\n    to_arg = '\#{to}'\n    project = ::Project.where(identifier: from_arg).first\n    if project.present?\n      puts \"Project found: \\\#{project}\"\n      puts \"Renaming...\"\n      project.update_column(:identifier, to_arg)\n      puts \"Renamed. Testing...\"\n      project = ::Project.where(identifier: to_arg).first\n      if project\n        puts \"Project found: \\\#{project}\"\n      else\n        fail \"After rename: project not found with identifier \\\\\"\\\#{to_arg}\\\\\"\"\n      end\n    else\n      fail \"Before rename: project not found with identifier \\\\\"\\\#{from_arg}\\\\\"\"\n    end\n  CODE\nend\n"

#commandObject



35
36
37
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 35

def command
  context(:instance).bundle('exec', 'rails', 'runner', code)
end

#fromObject



27
28
29
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 27

def from
  options.fetch('<from>')
end

#runObject



17
18
19
20
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 17

def run
  start_banner
  command.system!
end

#start_bannerObject



22
23
24
25
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 22

def start_banner
  infov 'From', from
  infov 'To', to
end

#toObject



31
32
33
# File 'lib/avm/tools/runner/eac_redmine_base0/project_rename.rb', line 31

def to
  options.fetch('<to>')
end