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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db65337119285c48fb7bee58c88a23c0b1955d21
4
- data.tar.gz: a4706e05a71978f59554ee5172f51d29d46bde67
3
+ metadata.gz: 7db6fd563e5dbf53544681b4ebd016d80777252f
4
+ data.tar.gz: 6ce2ecbf513d1195d2a5237c8e763bba7441ccf9
5
5
  SHA512:
6
- metadata.gz: b67a34cfbad4508a753890098b364421873e2a12c1c350c2b8860b1fb86cce59d479febfd778ffa9af85397dbc77949ac4bf55adf8f78f30690ca9029ce34301
7
- data.tar.gz: c78471207691dab0b62163c42a2a0cb704ad052df44a74dc47b0c7676bb66736d08e149a5e264aae3df9d95dbb16aaf7dc4a1e3e84ac21c29a8efc7d305a8edb
6
+ metadata.gz: eeb144ad8a2543d8589e7e046f4bdc582b8b87945cbf696efbba214ce5ac4ea1d3e586bdf980453025708d123de9028cbfbfe31ea05b543efd7e0a3e465939b8
7
+ data.tar.gz: c977ff9b2708cdf095fad721865d8b371e8667672565fad33d52b04caa5e3ed4eeccdab2d502d0632410f15d134f5b3ec6c6a3f7efc16fd3d8f4b266f711f148
@@ -1,3 +1,6 @@
1
+ ## 0.6.6
2
+ - Fix bug on `service` resource
3
+
1
4
  ## 0.6.5
2
5
  - Use `sudo -H` option
3
6
 
@@ -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 origin/master")
76
+ run_command("cd #{path} && git fetch origin && git reset --hard FETCH_HEAD")
63
77
  end
64
78
 
65
79
  def updated?
@@ -7,7 +7,7 @@ module Serverkit
7
7
 
8
8
  # @note Override
9
9
  def apply
10
- run_command_from_identifier(:start, name)
10
+ run_command_from_identifier(:start_service, name)
11
11
  end
12
12
 
13
13
  # @note Override
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  end
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.5
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: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel