Module: DocOpsLab::Dev::Initializer
- Defined in:
- lib/docopslab/dev/initializer.rb
Class Method Summary collapse
- .bootstrap_project ⇒ Object
- .create_gemfile_stub ⇒ Object
- .create_gitignore_stub ⇒ Object
- .create_project_manifest ⇒ Object
- .create_rakefile_stub ⇒ Object
- .init_git_repository ⇒ Object
Class Method Details
.bootstrap_project ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/docopslab/dev/initializer.rb', line 74 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_stub ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/docopslab/dev/initializer.rb', line 35 def create_gemfile_stub if File.exist?('Gemfile') puts '⏭️ Gemfile already exists, skipping' return false end Library.ensure_available! stub = Library.resolve('templates/Gemfile') || raise('Library templates/Gemfile not found; run `labdev:sync:library`.') FileUtils.cp(stub, 'Gemfile') puts '✅ Created Gemfile' true end |
.create_gitignore_stub ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/docopslab/dev/initializer.rb', line 21 def create_gitignore_stub if File.exist?('.gitignore') puts '⏭️ .gitignore already exists, skipping' return false end Library.ensure_available! stub = Library.resolve('templates/gitignore') || raise('Library templates/gitignore not found; run `labdev:sync:library`.') FileUtils.cp(stub, '.gitignore') puts '✅ Created .gitignore file' true end |
.create_project_manifest ⇒ Object
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(Dev.manifest_def_path, MANIFEST_PATH) puts "✅ Created #{MANIFEST_PATH}" end |
.create_rakefile_stub ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/docopslab/dev/initializer.rb', line 49 def create_rakefile_stub if File.exist?('Rakefile') puts '⏭️ Rakefile already exists, skipping' return false end Library.ensure_available! stub = Library.resolve('templates/Rakefile') || raise('Library templates/Rakefile not found; run `labdev:sync:library`.') FileUtils.cp(stub, 'Rakefile') puts '✅ Created Rakefile' true end |
.init_git_repository ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/docopslab/dev/initializer.rb', line 63 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 |