metaverse 0.1.8.5 → 0.1.9
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/lib/metaverse/base.rb +24 -8
- data/lib/metaverse/cli.rb +1 -0
- data/lib/metaverse/repo.rb +9 -3
- data/lib/metaverse/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: 3e05af7356cbdcb5593e140a14bb0729bce9f58d
|
4
|
+
data.tar.gz: fdf0413fff4d96a459ddf57150a4d40ab42215bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f73d9bf92d9e66e966a4170487644b8512396115fd40b8939b71d8b05364de1c7707dfcead2a6a0d5c7811307b616c032fc6988c651580a20bf00611012c35
|
7
|
+
data.tar.gz: c9ccc42a19f3a9fe5617a3d2bf156883f1c7946539814be2813dcb2eb05c779c4af702090a228eb9b313180f5aac1f7b92eca5446543f04ccdaa338f96f5c582
|
data/lib/metaverse/base.rb
CHANGED
@@ -23,6 +23,7 @@ module Metaverse
|
|
23
23
|
|
24
24
|
def status
|
25
25
|
check_dirtiness
|
26
|
+
check_consistency
|
26
27
|
end
|
27
28
|
|
28
29
|
|
@@ -40,7 +41,7 @@ module Metaverse
|
|
40
41
|
}
|
41
42
|
}
|
42
43
|
|
43
|
-
if check_dirtiness
|
44
|
+
if check_dirtiness and check_consistency
|
44
45
|
actions = @repos.map {|repo|
|
45
46
|
puts "\n # #{repo.name}".blue
|
46
47
|
Transacted::Action.new action_options.call(repo)
|
@@ -61,7 +62,7 @@ module Metaverse
|
|
61
62
|
puts "\n # #{repo.name}".blue
|
62
63
|
repo.create_state prefix, state
|
63
64
|
repo.checkout "#{prefix}/#{state}" if not prefix == "snapshot"
|
64
|
-
} if check_dirtiness
|
65
|
+
} if check_dirtiness and check_consistency
|
65
66
|
end
|
66
67
|
|
67
68
|
|
@@ -74,12 +75,13 @@ module Metaverse
|
|
74
75
|
},
|
75
76
|
down: -> {
|
76
77
|
puts "\n # Rolling back in #{repo.name}".blue
|
77
|
-
|
78
|
+
repo.checkout repo.peek_previous_branch
|
79
|
+
repo.delete_branch repo.pop_previous_branch if should_create_branch
|
78
80
|
}
|
79
81
|
}
|
80
82
|
}
|
81
83
|
|
82
|
-
if check_dirtiness
|
84
|
+
if check_dirtiness and check_consistency
|
83
85
|
|
84
86
|
actions = @repos.map { |repo|
|
85
87
|
Transacted::Action.new action_options.call repo
|
@@ -99,8 +101,8 @@ module Metaverse
|
|
99
101
|
@repos.each { |repo|
|
100
102
|
puts "\n # #{repo.name}".blue
|
101
103
|
is_branch = repo.current_branch.match /refs\/heads\/(.*)/
|
102
|
-
repo.send_state prefix, state, remote,
|
103
|
-
} if check_dirtiness
|
104
|
+
repo.send_state prefix, state, remote, should_clean
|
105
|
+
} if check_dirtiness and check_consistency
|
104
106
|
end
|
105
107
|
|
106
108
|
|
@@ -108,7 +110,7 @@ module Metaverse
|
|
108
110
|
@repos.each { |repo|
|
109
111
|
puts "\n # #{repo.name}".blue
|
110
112
|
repo.update remote
|
111
|
-
} if check_dirtiness
|
113
|
+
} if check_dirtiness and check_consistency
|
112
114
|
end
|
113
115
|
|
114
116
|
|
@@ -138,6 +140,20 @@ module Metaverse
|
|
138
140
|
dirty_repos.length == 0
|
139
141
|
end
|
140
142
|
|
143
|
+
def check_consistency
|
144
|
+
branch_name = system_state.first
|
145
|
+
inconsistent_repos = @repos.reject { |repo|
|
146
|
+
repo.current_branch == branch_name
|
147
|
+
}.map &:name
|
148
|
+
|
149
|
+
if inconsistent_repos.length == 0
|
150
|
+
puts 'The system is consistent'.green
|
151
|
+
else
|
152
|
+
puts 'The system is inconsistent. Please check the following repos :'.red , inconsistent_repos
|
153
|
+
end
|
154
|
+
inconsistent_repos.length == 0
|
155
|
+
end
|
156
|
+
|
141
157
|
def read_config path
|
142
158
|
Errors::config_not_found! if not File.exist? path
|
143
159
|
|
@@ -170,7 +186,7 @@ module Metaverse
|
|
170
186
|
@repos.each { |repo|
|
171
187
|
puts "\n # #{repo.name}".blue
|
172
188
|
repo.pull @origin_remote
|
173
|
-
} if check_dirtiness
|
189
|
+
} if check_dirtiness and check_consistency
|
174
190
|
end
|
175
191
|
|
176
192
|
def add_remote name, base_url
|
data/lib/metaverse/cli.rb
CHANGED
data/lib/metaverse/repo.rb
CHANGED
@@ -127,7 +127,7 @@ module Metaverse
|
|
127
127
|
end
|
128
128
|
|
129
129
|
|
130
|
-
def send_state prefix, state, remote,
|
130
|
+
def send_state prefix, state, remote, should_clean = false
|
131
131
|
refs = ["refs/meta/local/#{prefix}/#{state}"]
|
132
132
|
branch_name = "#{prefix}/#{state}"
|
133
133
|
branch = @repo.branches[branch_name]
|
@@ -143,7 +143,7 @@ module Metaverse
|
|
143
143
|
return false
|
144
144
|
end
|
145
145
|
|
146
|
-
if (not prefix == 'snapshot') and
|
146
|
+
if (not prefix == 'snapshot') and ahead_of_develop? branch
|
147
147
|
refs << branch_name
|
148
148
|
update_ref refs[0], @repo.branches[branch_name]
|
149
149
|
end
|
@@ -166,6 +166,12 @@ module Metaverse
|
|
166
166
|
changed
|
167
167
|
end
|
168
168
|
|
169
|
+
def delete_branch branch
|
170
|
+
if not @repo.branches[branch].nil?
|
171
|
+
@repo.branches.delete branch
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
169
175
|
def dirty?
|
170
176
|
is_dirty = false
|
171
177
|
@repo.status { |file, data|
|
@@ -177,7 +183,7 @@ module Metaverse
|
|
177
183
|
|
178
184
|
|
179
185
|
def update remote = nil
|
180
|
-
if @repo.remotes[remote].nil?
|
186
|
+
if not remote.nil? and @repo.remotes[remote].nil?
|
181
187
|
return Errors::remote_not_found remote
|
182
188
|
end
|
183
189
|
Dir.chdir(@repo.workdir) do
|
data/lib/metaverse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Omar Kamali
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|