appli 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/appli.rb +1 -1
- data/lib/commands/cap.rb +20 -0
- metadata +1 -1
data/lib/appli.rb
CHANGED
data/lib/commands/cap.rb
CHANGED
@@ -2,6 +2,26 @@ desc 'Generates a pre-configured capistrano deployment recipe.'
|
|
2
2
|
usage "appli [application] capify {export path}"
|
3
3
|
command "capify", :required_args => 1 do |file|
|
4
4
|
contents = get("applications/#{@options[:application]}/capistrano")['config']
|
5
|
+
|
6
|
+
## Insert the Repository URL if we can...
|
7
|
+
repository_url = `git config remote.origin.url`
|
8
|
+
if $?.success?
|
9
|
+
contents.gsub!(/git\@\[...\]/, repository_url.chomp)
|
10
|
+
end
|
11
|
+
|
12
|
+
## Add the current branch name
|
13
|
+
branch_name = `git status > /dev/null 2>&1`.split("\n").first
|
14
|
+
if $?.success?
|
15
|
+
branch_name branch_name.split(/\s+/).last
|
16
|
+
contents.gsub!(/set \:branch, \"master\"/, "set :branch, \"#{branch_name.chomp}\"")
|
17
|
+
end
|
18
|
+
|
19
|
+
## Add any configuration files from your local config/ folder if you have one
|
20
|
+
if File.directory?('config')
|
21
|
+
config_files = Dir["config/*.yml"].map{|f| f.split('/').last }
|
22
|
+
contents.gsub!(/\%w\{ database\.yml \}/, "%w{ #{config_files.join(' ')} }")
|
23
|
+
end
|
24
|
+
|
5
25
|
File.open(file, 'w') {|f| f.write(contents) }
|
6
26
|
puts "Generated capistrano deployment receipe at '#{file}'."
|
7
27
|
puts
|