Class: Bosh::Gen::Generators::NewReleaseGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Bosh::Gen::Generators::NewReleaseGenerator
show all
- Includes:
- Settings, Thor::Actions
- Defined in:
- lib/bosh/gen/generators/new_release_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Settings
#migrate_old_settings, #reload_settings!, #save_settings!, #setting, #settings, #settings_dir, #settings_dir=, #settings_path, #settings_ssh_dir
Class Method Details
.source_root ⇒ Object
15
16
17
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 15
def self.source_root
File.join(File.dirname(__FILE__), "new_release_generator", "templates")
end
|
Instance Method Details
#blobs_yaml ⇒ Object
54
55
56
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 54
def blobs_yaml
create_file "config/blobs.yml", YAML.dump({})
end
|
#config_dev_yml ⇒ Object
58
59
60
61
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 58
def config_dev_yml
config_dev = { "dev_name" => project_name }
create_file "config/dev.yml", YAML.dump(config_dev)
end
|
#config_final_yml ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 96
def config_final_yml
case blobstore_type
when :local
say_status "warning", "config/final.yml defaulting to local blobstore /tmp/blobstore", :yellow
config_final = { "blobstore" => {
"provider" => "local",
"options" => { "blobstore_path" => '/tmp/blobstore' }
}
}
when :s3
config_final = { "blobstore" => {
"provider" => "s3",
"options" => {
"bucket_name" => repository_name
}
}
}
when :swift
config_final = { "blobstore" => {
"provider" => "swift",
"options" => {
"container_name" => repository_name,
"swift_provider" => swift_provider
}
}
}
end
config_final["final_name"] = project_name
create_file "config/final.yml", YAML.dump(config_final)
end
|
#config_private_yml ⇒ Object
63
64
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
92
93
94
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 63
def config_private_yml
case blobstore_type
when :local
config_private = {
"blobstore" => {
"simple" => {
"user" => "USER",
"password" => "PASSWORD"
}
}
}
when :s3
config_private = {
"blobstore" => {
"s3" => {
"access_key_id" => settings.provider.credentials.aws_access_key_id,
"secret_access_key" => settings.provider.credentials.aws_secret_access_key
}
}
}
when :swift
config_private = {
"blobstore" => {
"swift" => {
settings.provider.name => settings.provider.credentials.to_hash
}
}
}
end
create_file "config/private.yml", YAML.dump(config_private)
end
|
#create_blobstore ⇒ Object
164
165
166
167
168
169
170
171
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 164
def create_blobstore
say ""
say "Finally..."
blobstore = Cyoi::Cli::Blobstore.new([blobstore_name, settings_dir])
blobstore.execute!
reload_settings!
say ""
end
|
#create_root ⇒ Object
19
20
21
22
23
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 19
def create_root
self.destination_root = File.expand_path(repository_path, destination_root)
empty_directory '.'
FileUtils.cd(destination_root) unless options[:pretend]
end
|
#directories ⇒ Object
44
45
46
47
48
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 44
def directories
%w[jobs packages src blobs templates].each do |dir|
directory dir
end
end
|
#executables ⇒ Object
50
51
52
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 50
def executables
chmod "templates/make_manifest", 0755
end
|
#git_init ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 128
def git_init
create_file ".gitignore", <<-IGNORE.gsub(/^\s{8}/, '')
config/dev.yml
config/private.yml
config/settings.yml
releases/**/*.tgz
dev_releases
blobs/*
.blobs
.dev_builds
.vagrant
.idea
.DS_Store
.final_builds/jobs/**/*.tgz
.final_builds/packages/**/*.tgz
*.swp
*~
*#
#*
tmp
my*.yml
IGNORE
end
|
#license ⇒ Object
36
37
38
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 36
def license
template "LICENSE.md.tt", "LICENSE.md"
end
|
#rakefile ⇒ Object
40
41
42
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 40
def rakefile
copy_file "Rakefile"
end
|
#readme ⇒ Object
32
33
34
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 32
def readme
template "README.md.tt", "README.md"
end
|
#select_provider ⇒ Object
25
26
27
28
29
30
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 25
def select_provider
self.settings_dir = File.expand_path("config")
provider = Cyoi::Cli::Provider.new([settings_dir])
provider.execute!
reload_settings!
end
|
#setup_git ⇒ Object
152
153
154
155
156
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 152
def setup_git
git :init
git :add => "."
git :commit => "-m 'Initial scaffold'"
end
|
#show_location ⇒ Object
158
159
160
161
162
|
# File 'lib/bosh/gen/generators/new_release_generator.rb', line 158
def show_location
say ""
say "Next, change to BOSH release location:"
say "cd #{repository_path}", :yellow
end
|