appli 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/appli.rb +1 -1
  2. data/lib/commands/cap.rb +20 -0
  3. metadata +1 -1
data/lib/appli.rb CHANGED
@@ -14,7 +14,7 @@ module Appli
14
14
  class NotConfiguredError < StandardError; end
15
15
  class MustBeInRepositoryError < StandardError; end
16
16
 
17
- VERSION = "0.0.11"
17
+ VERSION = "0.0.12"
18
18
 
19
19
  def run(command, args = [])
20
20
  load_commands
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke