fontana_client_support 0.8.0 → 0.8.1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd1df0580d18385443b09b58a9e84e912c86ae3b
|
4
|
+
data.tar.gz: a16226f93506b90fa281cd84d9f0c631d5bcc2c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c20ca74ea7432989b4483dd21e568c512c3ba7a9d7c12c52d93e856da3969c38cdd2854fe732d543e44e055c19c2feabdecddfd26d036998b88bc266ec7c737
|
7
|
+
data.tar.gz: 5ed88c5ee9328d00aaa374a80b2567b4ae75cf97e3a8b53af5d9ef59747c228da94f515d2de1a8a2f34e80c6a7749dcadad30e46bb9b732758fcfcd3075dfe48
|
@@ -8,12 +8,13 @@ namespace :deploy do
|
|
8
8
|
namespace_with_fontana :scm, :"app:scm" do
|
9
9
|
|
10
10
|
set_url_and_branch = ->{
|
11
|
-
ENV['URL'] ||= FontanaClientSupport.repo_url
|
12
|
-
ENV['BRANCH'] ||= FontanaClientSupport.current_branch_name
|
13
11
|
}
|
14
12
|
|
15
13
|
desc "deploy:scm:setup + clone (+ checkout branch) + deploy:scm:update."
|
16
|
-
fontana_task :reset,
|
14
|
+
fontana_task :reset, env: {
|
15
|
+
'URL' => FontanaClientSupport.repo_url,
|
16
|
+
'BRANCH' => FontanaClientSupport.current_branch_name
|
17
|
+
}
|
17
18
|
|
18
19
|
desc "drop DB, initialize, clear runtime workspace."
|
19
20
|
fontana_task :setup
|
@@ -22,8 +22,10 @@ namespace :vendor do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def vendor_fontana_branch
|
25
|
-
|
26
|
-
|
25
|
+
return nil unless Dir.exist?(FontanaClientSupport.vendor_fontana)
|
26
|
+
Dir.chdir(FontanaClientSupport.vendor_fontana) do
|
27
|
+
return FontanaClientSupport.git_current_branch_name
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
def raise_if_fontana_branch_empty
|
@@ -133,7 +135,7 @@ namespace :vendor do
|
|
133
135
|
|
134
136
|
elsif vfb != Fontana.branch
|
135
137
|
# vendor/fontanaのブランチが FONTANA_BRANCH と異なる場合
|
136
|
-
puts "\e[33m but FONTANA_BRANCH is #{Fontana.branch}\e[0m"
|
138
|
+
# puts "\e[33m but FONTANA_BRANCH is #{Fontana.branch}\e[0m"
|
137
139
|
Rake::Task["vendor:fontana:reset"].delegate
|
138
140
|
|
139
141
|
elsif Fontana.version.nil? || Fontana.version.empty?
|
@@ -15,8 +15,17 @@ module FontanaClientSupport
|
|
15
15
|
@vendor_fontana ||= File.join(vendor_dir, "fontana")
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
18
|
+
def git_current_branch_name
|
19
|
+
# http://qiita.com/sugyan/items/83e060e895fa8ef2038c
|
20
|
+
result = `git symbolic-ref --short HEAD`.strip
|
21
|
+
return result unless result.nil? || result.empty?
|
22
|
+
result = `git status`.scan(/On branch\s*(.+)\s*$/).flatten.first
|
23
|
+
return result unless result.nil? || result.empty?
|
24
|
+
work = `git log --decorate -1`.scan(/^commit\s[0-9a-f]+\s\((.+)\)/).
|
25
|
+
flatten.first.split(/,/).map(&:strip).reject{|s| s =~ /HEAD\Z/}
|
26
|
+
r = work.select{|s| s =~ /origin\//}.first
|
27
|
+
r ||= work.first
|
28
|
+
result = r.sub(/\Aorigin\//, '')
|
20
29
|
rescue => e
|
21
30
|
puts "[#{e.class}] #{e.message}"
|
22
31
|
puts "Dir.pwd: #{Dir.pwd}"
|
@@ -24,6 +33,18 @@ module FontanaClientSupport
|
|
24
33
|
raise e
|
25
34
|
end
|
26
35
|
|
36
|
+
def current_branch_name
|
37
|
+
raise "missing root_dir" if root_dir.nil?
|
38
|
+
raise "root_dir does not exist: #{root_dir.inspect}" unless Dir.exist?(root_dir)
|
39
|
+
unless @current_branch_name
|
40
|
+
Dir.chdir(root_dir) do
|
41
|
+
@current_branch_name = git_current_branch_name
|
42
|
+
end
|
43
|
+
end
|
44
|
+
puts "@current_branch_name: #{@current_branch_name.inspect}"
|
45
|
+
return @current_branch_name
|
46
|
+
end
|
47
|
+
|
27
48
|
def repo_url
|
28
49
|
@repo_url ||= `git remote -v`.scan(/origin\s+(.+?)\s/).flatten.uniq.first
|
29
50
|
end
|