Sha256: 275fcae50753ed45e2e68206d57eb18a8bbd095feb02c294228c0f8809bd9f0a

Contents?: true

Size: 1.83 KB

Versions: 5

Compression:

Stored size: 1.83 KB

Contents

module Soaring
  class Initializer
    def initialize(options)
      @options = options
    end

    def initialize_project
      Dir.chdir(@options[:project_root]) do
        get_soar_sc_template
        create_symlink_to_public_folder
      end
    end

    def get_soar_sc_template
      Dir.mktmpdir { |dir|
        temporary_folder = dir
        temporary_soar_sc_folder = "#{temporary_folder}/soar_sc"
        `git --git-dir=/dev/null clone --quiet --progress --branch #{@options[:soar_sc_refspec]} --depth=1 git@gitlab.host-h.net:hetznerZA/soar_sc.git #{temporary_soar_sc_folder}`

        `yes | cp -rf #{temporary_soar_sc_folder}/config #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/docker #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/lib #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/smaak #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/config.ru #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/Gemfile #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/.ruby-gemset #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/.ruby-version #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/.gitignore #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/.ebextensions #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/jewels #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/features #{@options[:project_root]}`
        `yes | cp -rf #{temporary_soar_sc_folder}/Rakefile #{@options[:project_root]}`
      }
    end

    def create_symlink_to_public_folder
      File.symlink("lib/web/public", "public") if not File.symlink?("public")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
soaring-0.1.19 lib/soaring/initializer.rb
soaring-0.1.18 lib/soaring/initializer.rb
soaring-0.1.17 lib/soaring/initializer.rb
soaring-0.1.16 lib/soaring/initializer.rb
soaring-0.1.15 lib/soaring/initializer.rb