Sha256: b8cbea6eeba3f453b17dfbe0deabde362fbae8c4de753c6de67b266f3c11dc03

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# encoding: UTF-8

module Tetra
  # tetra dry-run
  class DryRunSubcommand < Tetra::Subcommand
    option ["-s", "--script"], "SCRIPT", "Run these commands to build the project instead of the interactive shell"
    def execute
      checking_exceptions do
        project = Tetra::Project.new(".")

        if project.src_patched?
          puts "Changes detected in src/, please use:"
          puts " \"tetra patch\" to include those changes in the package as a patch file"
          puts " \"tetra change-sources\" to completely swap the source archive."
          puts "Dry run not started."
        else
          project.dry_run
          if script
            puts "Scripted dry-run started."
          else
            puts "Dry-run started in a new bash shell."
            puts "Build your project now, \"mvn\" and \"ant\" are already bundled by tetra."
            puts "If the build succeedes end this dry run with ^D (Ctrl+D),"
            puts "if the build does not succeed use ^C^D to abort and undo any change"
          end

          begin
            history = Tetra::Bash.new(project).bash(script)
            project.finish(history)
            puts "Dry-run finished"
          rescue ExecutionFailed
            project.abort
            puts "Project reverted as before dry-run"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tetra-2.0.5 lib/tetra/ui/dry_run_subcommand.rb