Class: Petticoat::Installer
- Inherits:
-
Object
- Object
- Petticoat::Installer
- Defined in:
- lib/petticoat/installer.rb
Overview
Create-only publication: a preflight conflict never causes partial installation.
Constant Summary collapse
- FILES =
{ 'bin/petticoat' => 0o755, 'config/petticoat.rb' => 0o644 }.freeze
Instance Method Summary collapse
- #call(dry_run: false, out: $stdout) ⇒ Object
-
#initialize(root:) ⇒ Installer
constructor
A new instance of Installer.
Constructor Details
#initialize(root:) ⇒ Installer
Returns a new instance of Installer.
13 14 15 |
# File 'lib/petticoat/installer.rb', line 13 def initialize(root:) @root = File.realpath(root) end |
Instance Method Details
#call(dry_run: false, out: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/petticoat/installer.rb', line 17 def call(dry_run: false, out: $stdout) entries = plan entries.each { |entry| out.puts "#{entry.fetch(:state)} #{entry.fetch(:relative)}" } additions = entries.select { |entry| entry.fetch(:state) == 'create' } publish(additions) unless dry_run || additions.empty? out.puts(dry_run ? 'Petticoat dry run: no files written.' : 'Petticoat starter installed.') out.puts 'Next: edit config/petticoat.rb.' unless dry_run out.puts 'See the Petticoat README. Install does not configure or start your app, or generate catalogues.' entries end |