module FontanaClientSupport
Constants
- DEPLOY_STRATEGY_NAMES
- VERSION
Attributes
root_dir[RW]
Public Class Methods
configure() { |self| ... }
click to toggle source
# File lib/fontana_client_support.rb, line 65 def configure yield(self) if block_given? self end
current_branch_name()
click to toggle source
# File lib/fontana_client_support.rb, line 36 def current_branch_name raise "missing root_dir" if root_dir.nil? raise "root_dir does not exist: #{root_dir.inspect}" unless Dir.exist?(root_dir) unless @current_branch_name Dir.chdir(root_dir) do @current_branch_name = git_current_branch_name end end puts "@current_branch_name: #{@current_branch_name.inspect}" return @current_branch_name end
deploy_strategy()
click to toggle source
# File lib/fontana_client_support.rb, line 52 def deploy_strategy @deploy_strategy ||= :deploy end
deploy_strategy=(v)
click to toggle source
# File lib/fontana_client_support.rb, line 58 def deploy_strategy=(v) unless DEPLOY_STRATEGY_NAMES.include?(v) raise ArgumentError, "invalid deploy_strategy: #{v.inspect} must be one of #{DEPLOY_STRATEGY_NAMES.inspect}" end @deploy_strategy = v end
git_current_branch_name()
click to toggle source
# File lib/fontana_client_support.rb, line 18 def git_current_branch_name # http://qiita.com/sugyan/items/83e060e895fa8ef2038c result = `git symbolic-ref --short HEAD`.strip return result unless result.nil? || result.empty? result = `git status`.scan(/On branch\s*(.+)\s*$/).flatten.first return result unless result.nil? || result.empty? work = `git log --decorate -1`.scan(/^commit\s[0-9a-f]+\s\((.+)\)/). flatten.first.split(/,/).map(&:strip).reject{|s| s =~ /HEAD\Z/} r = work.select{|s| s =~ /origin\//}.first r ||= work.first result = r.sub(/\Aorigin\//, '') rescue => e puts "[#{e.class}] #{e.message}" puts "Dir.pwd: #{Dir.pwd}" puts "git status\n" << `git status` raise e end
repo_url()
click to toggle source
# File lib/fontana_client_support.rb, line 48 def repo_url @repo_url ||= `git remote -v`.scan(/origin\s+(.+?)\s/).flatten.uniq.first end
vendor_dir()
click to toggle source
# File lib/fontana_client_support.rb, line 10 def vendor_dir @vendor_dir ||= File.join(root_dir, "vendor") end
vendor_fontana()
click to toggle source
# File lib/fontana_client_support.rb, line 14 def vendor_fontana @vendor_fontana ||= File.join(vendor_dir, "fontana") end