Sha256: befd5ba4a711a4530d0df8eb6db5b02f27907fbdaacd0170e14f258804882c58

Contents?: true

Size: 1.49 KB

Versions: 73

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require 'eac_cli/core_ext'
require 'avm/eac_rails_base1/runner/code_runner'

module Avm
  module Tools
    class Runner
      class EacRedmineBase0 < ::Avm::EacRailsBase1::Runner
        class ProjectRename
          runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle do
            pos_arg :from
            pos_arg :to
          end

          def run
            bundle_run
          end

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

          delegate :from, :to, to: :parsed

          def bundle_args
            %w[exec rails runner] + [code]
          end

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

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
avm-tools-0.124.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.10.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.123.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.9.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.122.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.8.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.7.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.6.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.121.2 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.5.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.4.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.3.0 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
eac_tools-0.2.2 sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.121.1 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.121.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.120.2 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.120.1 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.120.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.119.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
avm-tools-0.118.0 lib/avm/tools/runner/eac_redmine_base0/project_rename.rb