Class: Stevenson::Application

Inherits:
Thor
  • Object
show all
Defined in:
lib/stevenson/application.rb

Instance Method Summary collapse

Instance Method Details

#generate_dotfileObject



77
78
79
80
# File 'lib/stevenson/application.rb', line 77

def generate_dotfile
  Dotfile.install
  puts "Generated dotfile at #{Dotfile.path}"
end

#new(output_directory, config_path) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/stevenson/application.rb', line 47

def new(output_directory, config_path)
  if options[:private_template]
    template_url, git_username, git_password = options[:private_template]
    git_username ||= ENV["GITHUB_SERVICE_ACCOUNT_USERNAME"]
    git_password ||= ENV["GITHUB_SERVICE_ACCOUNT_PASSWORD"]
    template = template_url.gsub("github", "#{git_username}:#{git_password}@github")
  else
    template = options[:template]
  end

  # Load the template using the template loader
  template = Stevenson::Template.load(template, options)

  # Place yml files
  template.place_config(config_path)
  template.place_files(options[:data], '_data') if options[:data]

  # Run output filters, in order, against the template
  directory = Stevenson::OutputFilter.generate!(template, options)

  # Run deployers against filtered template directory
  Stevenson::Deployer.deploy(directory, options)

rescue Stevenson::Error => e
  say e.message
ensure
  template.close if template
end