Class: Tetra::ChangeSourcesSubcommand

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

Overview

tetra change-sources

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



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tetra/ui/change_sources_subcommand.rb', line 11

def execute
  if source_archive.nil? && no_archive? == false
    signal_usage_error "please specify a source archive file or use \"--no-archive\" (see SPECIAL_CASES.md)."
  end

  checking_exceptions do
    project = Tetra::Project.new(".")
    ensure_dry_running(:is_not_in_progress, project) do
      if no_archive? == false
        project.commit_source_archive(File.expand_path(source_archive), message)
        puts "New sources committed."
        puts "Please delete any stale source archives from packages/ before proceeding."
      else
        project.commit_sources(message, true)
        puts "New sources committed."
        puts "Please copy source archive(s) corresponding to src/ in packages/ before proceeding."
      end
    end
  end
end