Class: Soaring::Initializer

Inherits:
Object
  • Object
show all
Defined in:
lib/soaring/initializer.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Initializer

Returns a new instance of Initializer.



3
4
5
# File 'lib/soaring/initializer.rb', line 3

def initialize(options)
  @options = options
end

Instance Method Details



40
41
42
# File 'lib/soaring/initializer.rb', line 40

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

#get_soar_sc_templateObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/soaring/initializer.rb', line 14

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 [email protected]: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}/spec #{@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]}`
    `yes | cp -rf #{temporary_soar_sc_folder}/.rspec #{@options[:project_root]}`
    `yes | cp -rf #{temporary_soar_sc_folder}/docker-compose.yml #{@options[:project_root]}`
    `yes | cp -rf #{temporary_soar_sc_folder}/Dockerfile.for_service_component #{@options[:project_root]}/Dockerfile`
  }
end

#initialize_projectObject



7
8
9
10
11
12
# File 'lib/soaring/initializer.rb', line 7

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