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



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
33
34
35
36
37
38
39
# File 'lib/tetra/ui/dry_run_subcommand.rb', line 7

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. Build your project now!"
        puts "Note that:"
        puts " - \"mvn\" and \"ant\" are already bundled by tetra"
        puts " - you have to use \"gradlew\" instad of \"./gradlew\" to launch a Gradle wrapper"
        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