Module: DocOpsLab::Dev::Initializer

Defined in:
lib/docopslab/dev/initializer.rb

Class Method Summary collapse

Class Method Details

.bootstrap_projectObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/docopslab/dev/initializer.rb', line 65

def bootstrap_project
  puts '� Bootstrapping DocOps Lab project...'
  puts ''

  created = []

  # Core project files
  created << 'Git repository' if init_git_repository
  created << '.gitignore' if create_gitignore_stub
  # Skip Gemfile; not needed for Docker workflow, template available if needed
  created << 'Rakefile' if create_rakefile_stub

  # DocOpsLab-specific
  create_project_manifest
  created << '.config/docopslab-dev.yml' unless File.exist?(MANIFEST_PATH)

  puts ''
  if created.any?
    puts "✅ Bootstrap complete! Created: #{created.join(', ')}"
    puts ''
    puts 'Next steps:'
    puts '  1. bundle exec rake labdev:sync:all  # or: docker run ... labdev:sync:all'
    puts '  2. Start using labdev tasks!'
  else
    puts '✅ Project already initialized, nothing to create'
  end
end

.create_gemfile_stubObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/docopslab/dev/initializer.rb', line 32

def create_gemfile_stub
  if File.exist?('Gemfile')
    puts '⏭️  Gemfile already exists, skipping'
    return false
  end

  FileUtils.cp(GEMFILE_STUB_SOURCE_PATH, 'Gemfile')
  puts '✅ Created Gemfile'
  true
end

.create_gitignore_stubObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/docopslab/dev/initializer.rb', line 21

def create_gitignore_stub
  if File.exist?('.gitignore')
    puts '⏭️  .gitignore already exists, skipping'
    return false
  end

  FileUtils.cp(GITIGNORE_STUB_SOURCE_PATH, '.gitignore')
  puts '✅ Created .gitignore file'
  true
end

.create_project_manifestObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/docopslab/dev/initializer.rb', line 9

def create_project_manifest
  return if File.exist?(MANIFEST_PATH)

  puts '📋 Creating docopslab-dev.yml...'

  FileUtils.mkdir_p('.config')

  # Copy template from gem
  FileUtils.cp(MANIFEST_DEF_PATH, MANIFEST_PATH)
  puts "✅ Created #{MANIFEST_PATH}"
end

.create_rakefile_stubObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/docopslab/dev/initializer.rb', line 43

def create_rakefile_stub
  if File.exist?('Rakefile')
    puts '⏭️  Rakefile already exists, skipping'
    return false
  end

  FileUtils.cp(RAKEFILE_STUB_SOURCE_PATH, 'Rakefile')
  puts '✅ Created Rakefile'
  true
end

.init_git_repositoryObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/docopslab/dev/initializer.rb', line 54

def init_git_repository
  if Dir.exist?('.git')
    puts '⏭️  Git repository already initialized, skipping'
    return false
  end

  system('git', 'init')
  puts '✅ Initialized Git repository'
  true
end