eternity 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 319437ad396ef5f306feb9578edf4a890dc2ecfc
4
- data.tar.gz: e2ae5f04b986d60ab7a5fdcd26fe3c7614f0c1a7
3
+ metadata.gz: d3c5b9f3dd98ebf47e906a3ea8a97213bbbe22e3
4
+ data.tar.gz: 3b22572ec87e97029cb40cac6d7fed5cd284b584
5
5
  SHA512:
6
- metadata.gz: c95bcefe396e0751d1165ae01b69d7500b277c2ab48228c82fda06f5bae0de1c7b651c02852c9b3b9035d8c68521c05f2ba071e47576507861d0ed8c4976656f
7
- data.tar.gz: b1082bb669fedc219e0a82326ecbb8298e70cc0365393935cf49384c1f92533342c1af44891cdb100687d1b6ffc29da32107fe5784474b2080ca59fdfb6b158a
6
+ metadata.gz: 9e95c9952cf6ee5b3915a31dfc84cb470a5631a8250474a68db32ead4bfd0e3aaff4a79abc03503400317d3e6dab0955325d70ae1a5c784f9035ecb2857cc79d
7
+ data.tar.gz: 8a54e838947cb958fedbd20be7fcc1e4ca162b6098a3636963093f0f1eada3c43fa5dbc788be9e6211080ae99235fa497932ae1bf4a544e066ec19396f61283e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby 2.1
1
+ ruby 2.1.0
data/lib/eternity.rb CHANGED
@@ -48,7 +48,6 @@ module Eternity
48
48
  end
49
49
 
50
50
  require_relative 'eternity/version'
51
- require_relative 'eternity/log'
52
51
  require_relative 'eternity/blob'
53
52
  require_relative 'eternity/repository'
54
53
  require_relative 'eternity/object_tracker'
@@ -74,7 +74,7 @@ module Eternity
74
74
 
75
75
 
76
76
  class Merge
77
- extend Log
77
+
78
78
  include Common
79
79
 
80
80
  def merged?
@@ -95,12 +95,11 @@ module Eternity
95
95
  Delta.merge [revert_delta, target_delta, remaining_delta], base_index
96
96
  end
97
97
 
98
- log :calculate_delta
99
98
  end
100
99
 
101
100
 
102
101
  class Diff
103
- extend Log
102
+
104
103
  include Common
105
104
 
106
105
  private
@@ -109,7 +108,6 @@ module Eternity
109
108
  Delta.merge [revert_delta, target_delta], base_index
110
109
  end
111
110
 
112
- log :calculate_delta
113
111
  end
114
112
 
115
113
  end
@@ -1,8 +1,6 @@
1
1
  module Eternity
2
2
  class Repository
3
3
 
4
- extend Log
5
-
6
4
  attr_reader :name, :id, :branches
7
5
 
8
6
  def initialize(name, options={})
@@ -77,6 +75,8 @@ module Eternity
77
75
  raise "Can't checkout with uncommitted changes" if changes?
78
76
 
79
77
  locker.lock! :checkout do
78
+ Eternity.logger.info(self.class) { "Checkout #{name} (#{options.map { |k,v| "#{k}: #{v}" }.join(', ')})" }
79
+
80
80
  original_commit = current_commit
81
81
 
82
82
  commit_id, branch = extract_commit_and_branch options
@@ -113,6 +113,9 @@ module Eternity
113
113
 
114
114
  def push!
115
115
  raise "Can't push without commit" unless current_commit?
116
+
117
+ Eternity.logger.info(self.class) { "Push #{name} (#{current_commit.id})" }
118
+
116
119
  Branch[current_branch] = current_commit.id
117
120
  end
118
121
 
@@ -122,6 +125,8 @@ module Eternity
122
125
 
123
126
  target_commit = Branch[current_branch]
124
127
 
128
+ Eternity.logger.info(self.class) { "Pull #{name} (#{target_commit.id})" }
129
+
125
130
  if current_commit == target_commit || current_commit.fast_forward?(target_commit)
126
131
  {}
127
132
  elsif target_commit.fast_forward?(current_commit)
@@ -133,6 +138,8 @@ module Eternity
133
138
 
134
139
  def revert
135
140
  locker.lock! :revert do
141
+ Eternity.logger.info(self.class) { "Revert #{name}" }
142
+
136
143
  current_commit.with_index do |index|
137
144
  Delta.revert(delta, index).tap { tracker.revert }
138
145
  end
@@ -164,13 +171,13 @@ module Eternity
164
171
  self.delta = dump['delta']
165
172
  end
166
173
 
167
- [:delta, :delta=, :commit, :pull, :push, :checkout, :merge, :revert, :destroy, :dump].each { |m| log m }
168
-
169
174
  private
170
175
 
171
176
  attr_reader :tracker, :current, :locker
172
177
 
173
178
  def commit!(options)
179
+ Eternity.logger.info(self.class) { "Commit #{name} (author: #{options[:author]}, message: #{options[:message]})" }
180
+
174
181
  changes = delta
175
182
  options[:parents] ||= [current_commit.id]
176
183
  options[:delta] ||= write_delta changes
@@ -186,6 +193,8 @@ module Eternity
186
193
 
187
194
  def merge!(target_commit)
188
195
  locker.lock! :merge do
196
+ Eternity.logger.info(self.class) { "Merge #{name} (#{target_commit.short_id} into #{current_commit.short_id})" }
197
+
189
198
  patch = Patch.merge current_commit, target_commit
190
199
 
191
200
  raise 'Already merged' if patch.merged?
@@ -1,3 +1,3 @@
1
1
  module Eternity
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eternity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-25 00:00:00.000000000 Z
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redic
@@ -204,7 +204,6 @@ files:
204
204
  - lib/eternity/conflict_resolver.rb
205
205
  - lib/eternity/delta.rb
206
206
  - lib/eternity/index.rb
207
- - lib/eternity/log.rb
208
207
  - lib/eternity/object_tracker.rb
209
208
  - lib/eternity/patch.rb
210
209
  - lib/eternity/repository.rb
@@ -249,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
248
  version: '0'
250
249
  requirements: []
251
250
  rubyforge_project:
252
- rubygems_version: 2.4.3
251
+ rubygems_version: 2.2.2
253
252
  signing_key:
254
253
  specification_version: 4
255
254
  summary: Distributed database version control system
data/lib/eternity/log.rb DELETED
@@ -1,22 +0,0 @@
1
- module Eternity
2
- module Log
3
-
4
- private
5
-
6
- def log(method)
7
- original_method = "__#{method}_without_log__"
8
-
9
- alias_method original_method, method
10
-
11
- define_method method do |*args, &block|
12
- Eternity.logger.info(self.class.name) { "#{method} (Start)" }
13
- result = send original_method, *args, &block
14
- Eternity.logger.info(self.class.name) { "#{method} (End)" }
15
- result
16
- end
17
-
18
- private original_method
19
- end
20
-
21
- end
22
- end