Class: Tetra::DryRunSubcommand

Inherits:
Subcommand
  • Object
show all
Defined in:
lib/tetra/ui/dry_run_subcommand.rb

Overview

tetra dry-run

Instance Method Summary collapse

Methods inherited from Subcommand

#bypass_parsing, #checking_exceptions, #configure_log_level, #ensure_dry_running, #format_path, #print_generation_result, #verbose=, #very_verbose=, #very_very_verbose=

Methods included from Logging

#log

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tetra/ui/dry_run_subcommand.rb', line 6

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
      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"

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