manifestly 2.1.0.pre.pre → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/lib/manifestly/cli.rb +14 -1
- data/lib/manifestly/manifest.rb +2 -3
- data/lib/manifestly/manifest_item.rb +2 -2
- data/lib/manifestly/repository.rb +29 -4
- data/lib/manifestly/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0c315b69f70efd0a0a9fbb96b837ec5b8003651
|
4
|
+
data.tar.gz: 252ae02ec9b3b53fe3f9022f5dac47be059d776f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddb360f349ff360da7593cecf02e6e0bfc8d94f181844cf4068866e5794f07c290fc5914835158d6e4db67a77957cc8be81c9dbffd43a7d79670ef1ac7c4fc71
|
7
|
+
data.tar.gz: b6a5647e87acad501c243acda516ff23a5f552f8c4439fc71bd0eefb64c3d798c84658042bbfc4689945f395ff4dc2d79d82fab4ca77523317b75a8b26bf99e2
|
data/README.md
CHANGED
@@ -11,13 +11,9 @@ Manifestly is run as a standalone executable. Install with:
|
|
11
11
|
|
12
12
|
$ gem install manifestly
|
13
13
|
|
14
|
-
|
14
|
+
To update to the latest version:
|
15
15
|
|
16
|
-
$
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install manifestly
|
16
|
+
$ gem update manifestly
|
21
17
|
|
22
18
|
## Usage
|
23
19
|
|
data/lib/manifestly/cli.rb
CHANGED
@@ -200,19 +200,32 @@ module Manifestly
|
|
200
200
|
desc "apply", "Sets the manifest's repository's current states to the commits listed in the manifest"
|
201
201
|
search_paths_option
|
202
202
|
file_option("apply")
|
203
|
+
method_option :update,
|
204
|
+
desc: "Updates (fetches) repository content if a manifest commit is not found",
|
205
|
+
banner: '',
|
206
|
+
aliases: "-u",
|
207
|
+
type: :boolean,
|
208
|
+
default: false,
|
209
|
+
required: false
|
203
210
|
long_desc <<-DESC
|
204
211
|
Check to make sure the repositories you are deploying from have their state committed.
|
205
212
|
DESC
|
206
213
|
def apply
|
207
214
|
begin
|
208
215
|
manifest = load_manifest(file: options[:file]) || return
|
216
|
+
manifest.items.each{ |item| item.checkout_commit!(options[:update]) }
|
209
217
|
rescue Manifestly::ManifestItem::MultipleSameNameRepositories => e
|
210
218
|
say "Multiple repositories have the same name (#{e.message}) so we " +
|
211
219
|
"can't apply the manifest. Try limiting the search_paths or " +
|
212
220
|
"separate the duplicates."
|
213
221
|
return
|
222
|
+
rescue Manifestly::Repository::CommitNotPresent => e
|
223
|
+
say "Could not find commit #{e.sha} in repository #{e.repository.github_name_or_path}. " +
|
224
|
+
"Try running again with the `--update` option."
|
225
|
+
return
|
214
226
|
end
|
215
|
-
|
227
|
+
|
228
|
+
|
216
229
|
end
|
217
230
|
|
218
231
|
desc "upload", "Upload a local manifest file to a manifest repository"
|
data/lib/manifestly/manifest.rb
CHANGED
@@ -30,9 +30,8 @@ module Manifestly
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.read_file(filename, repositories)
|
33
|
-
File.
|
34
|
-
|
35
|
-
end
|
33
|
+
lines = File.read(filename)
|
34
|
+
read_lines(lines, repositories)
|
36
35
|
end
|
37
36
|
|
38
37
|
def self.read_lines(lines, repositories)
|
@@ -26,8 +26,8 @@ module Manifestly
|
|
26
26
|
@repository.fetch
|
27
27
|
end
|
28
28
|
|
29
|
-
def checkout_commit!
|
30
|
-
@repository.checkout_commit(@commit.sha)
|
29
|
+
def checkout_commit!(fetch_if_unfound=false)
|
30
|
+
@repository.checkout_commit(@commit.sha, fetch_if_unfound)
|
31
31
|
end
|
32
32
|
|
33
33
|
def to_file_string
|
@@ -4,7 +4,15 @@ require 'ostruct'
|
|
4
4
|
module Manifestly
|
5
5
|
class Repository
|
6
6
|
|
7
|
-
class CommitNotPresent < StandardError
|
7
|
+
class CommitNotPresent < StandardError
|
8
|
+
attr_reader :sha, :repository
|
9
|
+
def initialize(sha, repository)
|
10
|
+
@sha = sha
|
11
|
+
@repository = repository
|
12
|
+
super("SHA '#{sha}' not found in repository '#{repository.github_name_or_path}'")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
class ManifestUnchanged < StandardError; end
|
9
17
|
class CommitContentError < StandardError; end
|
10
18
|
class NoCommitsError < StandardError; end
|
@@ -101,7 +109,7 @@ module Manifestly
|
|
101
109
|
begin
|
102
110
|
git.gcommit(sha).tap(&:sha)
|
103
111
|
rescue Git::GitExecuteError => e
|
104
|
-
raise CommitNotPresent,
|
112
|
+
raise CommitNotPresent.new(sha, self)
|
105
113
|
end
|
106
114
|
end
|
107
115
|
|
@@ -131,8 +139,25 @@ module Manifestly
|
|
131
139
|
end
|
132
140
|
end
|
133
141
|
|
134
|
-
def checkout_commit(sha)
|
135
|
-
|
142
|
+
def checkout_commit(sha, fetch_if_unfound=false)
|
143
|
+
begin
|
144
|
+
git.checkout(sha)
|
145
|
+
rescue Git::GitExecuteError => e
|
146
|
+
if is_commit_not_found_exception?(e)
|
147
|
+
if fetch_if_unfound
|
148
|
+
git.fetch
|
149
|
+
checkout_commit(sha, false)
|
150
|
+
else
|
151
|
+
raise CommitNotPresent.new(sha, self)
|
152
|
+
end
|
153
|
+
else
|
154
|
+
raise
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def is_commit_not_found_exception?(e)
|
160
|
+
e.message.include?("fatal: reference is not a tree")
|
136
161
|
end
|
137
162
|
|
138
163
|
def current_branch_name
|
data/lib/manifestly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifestly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -183,9 +183,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
|
-
- - "
|
186
|
+
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
191
|
rubygems_version: 2.4.8
|