Class: SvnAuto::Create

Inherits:
Command show all
Defined in:
lib/svnauto/commands/create.rb

Constant Summary

Constants inherited from Command

SvnAuto::Command::VALID_SET_KEYS

Instance Method Summary collapse

Methods inherited from Command

commands, force?, inherited, options, reset!

Instance Method Details

#run(project, args) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/svnauto/commands/create.rb', line 42

def run (project, args)
  project.name = Project.clean_name(args.first)

  unless opthash[:force]
    if project.name != args.first and !Constants::TERMINAL.agree("Is #{project.name} OK for the project name? ")
      raise "please pick a project name that doesn't contain any special characters"
    end

    exit unless Constants::TERMINAL.agree("Create project " +
                  Constants::TERMINAL.color(project.name, :green) + " in " +
                  Constants::TERMINAL.color(project.repository.to_s, :blue) + "? ")
  end

  if project.name != args.first
    Constants::TERMINAL.say("using #{Constants::TERMINAL.color(project.name, :green)}) for the project name")
  end

  project.create

  unless opthash[:no_checkout]
    Constants::TERMINAL.say("Checked out to: #{Constants::TERMINAL.color(Path.relative_to_home(project.checkout), :green)}")
  end
end