serverkit 0.6.5 → 0.6.6
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/doc/resource_git.md +1 -0
- data/lib/serverkit/resources/git.rb +16 -2
- data/lib/serverkit/resources/service.rb +1 -1
- data/lib/serverkit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7db6fd563e5dbf53544681b4ebd016d80777252f
|
4
|
+
data.tar.gz: 6ce2ecbf513d1195d2a5237c8e763bba7441ccf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb144ad8a2543d8589e7e046f4bdc582b8b87945cbf696efbba214ce5ac4ea1d3e586bdf980453025708d123de9028cbfbfe31ea05b543efd7e0a3e465939b8
|
7
|
+
data.tar.gz: c977ff9b2708cdf095fad721865d8b371e8667672565fad33d52b04caa5e3ed4eeccdab2d502d0632410f15d134f5b3ec6c6a3f7efc16fd3d8f4b266f711f148
|
data/CHANGELOG.md
CHANGED
data/doc/resource_git.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
- path - where repository is cloned (required, type: `String`)
|
6
6
|
- repository - repository URL (required, type: `String`)
|
7
7
|
- state - whether it must be same revision with origin (`"cloned"` or `"updated"`, default: `"cloned"`)
|
8
|
+
- branch - branch name (type: `String`)
|
8
9
|
|
9
10
|
## Example
|
10
11
|
This recipe ensures a git repository is cloned from
|
@@ -8,16 +8,18 @@ module Serverkit
|
|
8
8
|
attribute :path, required: true, type: String
|
9
9
|
attribute :repository, required: true, type: String
|
10
10
|
attribute :state, default: DEFAULT_STATE, inclusion: %w[cloned updated], type: String
|
11
|
+
attribute :branch, type: String
|
11
12
|
|
12
13
|
# @note Override
|
13
14
|
def apply
|
14
15
|
_clone if clonable?
|
16
|
+
checkout if checkoutable?
|
15
17
|
update if updatable?
|
16
18
|
end
|
17
19
|
|
18
20
|
# @note Override
|
19
21
|
def check
|
20
|
-
has_git? && cloned? && !updatable?
|
22
|
+
has_git? && cloned? && !checkoutable? && !updatable?
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
@@ -35,6 +37,18 @@ module Serverkit
|
|
35
37
|
check_command_from_identifier(:check_file_is_directory, git_path)
|
36
38
|
end
|
37
39
|
|
40
|
+
def checkoutable?
|
41
|
+
branch && !checkouted?
|
42
|
+
end
|
43
|
+
|
44
|
+
def checkout
|
45
|
+
run_command("git -C #{path} checkout #{branch}")
|
46
|
+
end
|
47
|
+
|
48
|
+
def checkouted?
|
49
|
+
check_command("cd #{path} && test `git rev-parse HEAD` = `git rev-parse #{branch}`")
|
50
|
+
end
|
51
|
+
|
38
52
|
# @return [String] Path to .git directory in the cloned repository
|
39
53
|
def git_path
|
40
54
|
::File.join(path, ".git")
|
@@ -59,7 +73,7 @@ module Serverkit
|
|
59
73
|
end
|
60
74
|
|
61
75
|
def update
|
62
|
-
run_command("cd #{path} && git fetch origin && git reset --hard
|
76
|
+
run_command("cd #{path} && git fetch origin && git reset --hard FETCH_HEAD")
|
63
77
|
end
|
64
78
|
|
65
79
|
def updated?
|
data/lib/serverkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|