Sha256: a3b5ab0488ed1b79610ab03a7309774095f6fb1ce2df48541fa9665c234fb2df

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

class FakeProject
  def initialize(root)
    @root = root || '.'
  end

  def create_eb_config
    data = <<-EOL
---
global:
  application_name: blah
  default_platform: 64bit Amazon Linux 2014.09 v1.2.0 running Docker 1.3.3
EOL
    path = "#{@root}/.elasticbeanstalk/config.yml"
    create_file(path, data)
  end

  def create_settings
    data = <<-EOL
create:
  keyname: default
  platform: "Fake Platform From Project Settings"
conventions:
  app_name_pattern: !ruby/regexp /(\\w+)-\\w+-\\w+/
EOL
    # really tricky but when writting yaml file like this the \ needs to be escaped
    # when writing the yaml file normal, they do not need to be escaped
    create_file(settings_path, data)
  end

  def remove_settings
    remove_file(settings_path)
  end

  def settings_path
    "#{@root}/jack/settings.yml"
  end

  def create_file(path, contents)
    ensure_parent_folder(path)
    File.write(path, contents) unless File.exist?(path)
  end

  def remove_file(path)
    FileUtils.rm_f(path)
  end

  def ensure_parent_folder(path)
    dir = File.dirname(path)
    FileUtils.mkdir_p(dir) unless File.exist?(path)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
jack-eb-1.4.4 spec/support/fake_project.rb
jack-eb-1.4.3 spec/support/fake_project.rb
jack-eb-1.4.2 spec/support/fake_project.rb
jack-eb-1.4.1 spec/support/fake_project.rb
jack-eb-1.4.0 spec/support/fake_project.rb
jack-eb-1.3.0 spec/support/fake_project.rb
jack-eb-1.2.1 spec/support/fake_project.rb
jack-eb-1.2.0 spec/support/fake_project.rb
jack-eb-1.1.2 spec/support/fake_project.rb
jack-eb-1.1.1 spec/support/fake_project.rb
jack-eb-1.1.0 spec/support/fake_project.rb
jack-eb-1.0.1 spec/support/fake_project.rb
jack-eb-1.0.0 spec/support/fake_project.rb
jack-eb-0.3.0 spec/support/fake_project.rb