git_compound 0.2.0 → 0.2.1

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: 06924151a5c14eac3ffebfc3005358de3e85a7e9
4
- data.tar.gz: bbb37c1178dea881ad1dbc016fe8047dc028eddd
3
+ metadata.gz: 5e4d0926ddcd0f190333508583f38a8f2460089d
4
+ data.tar.gz: 52d2af0cf79c22a69f97b51ba6a090d3debef4dd
5
5
  SHA512:
6
- metadata.gz: 84227d3ee9e3bb7abd77b61bab4600bd6a3b0d2fbd05a97c6470ac6f2933ea12700772d0a796cc1703254645997e537f000388ea7f0413a4bb6d94ae007a3c5a
7
- data.tar.gz: 64797a7958521128971997327b9f23f3ee46fdeafa7e1afe3f45d04b24ec39a9cedec7df20b246abe4a9b7051d67e812722e0e575e5fc3ee7cf784d4dd89c912
6
+ metadata.gz: 9b357d8c1bbc8b91caf86928fa51415b757614117ec35a4b928650fa39c990969f59a2025de35eb1a00aca7436a6efaa058d884a8fea2080176909a0449d86e7
7
+ data.tar.gz: 082737730b0039af37388af337798e931e4623f6a363598de1a4bc804f673d3e00e1fa60cbc8d395fe299eec9b23eb5144f4aacfc305d7d404b774af7203418d
data/README.md CHANGED
@@ -50,7 +50,7 @@ It is particularly useful when you need to develop your project dependencies at
50
50
 
51
51
  Core features:
52
52
 
53
- * GitCompound introduces Domain Specific Language desgined for writing manifests.
53
+ * GitCompound introduces Domain Specific Language designed for writing manifests.
54
54
 
55
55
  * Manifest file is used to specify dependencies of your project.
56
56
 
@@ -102,6 +102,9 @@ and name constraints
102
102
  ## Global options
103
103
 
104
104
  1. `--verbose` -- turns debug mode on
105
+
106
+ This will show you what happens under the hood. All Git commands, procedure steps and tasks being executed will be printed.
107
+
105
108
  2. `--disable-colors` -- disables ANSI colors in output
106
109
 
107
110
  ## Details
@@ -211,13 +214,13 @@ and name constraints
211
214
  task :print_component_name, :each do |dir, component|
212
215
  puts "Current component name: #{component.name}"
213
216
  puts "Current component source: #{component.origin}"
214
- puts "Current component destination: #{component.destination_path}"
217
+ puts "Current component destination: #{component.path}"
215
218
 
216
219
  puts "Component directory: #{dir}"
217
220
  end
218
221
  ```
219
222
 
220
- Note that `dir` here is the same as `component.destination_path`.
223
+ Note that `dir` here is the same as `component.path`.
221
224
 
222
225
  * `:all` type -- run task for all child components of this manifest
223
226
 
@@ -11,7 +11,7 @@ module GitCompound
11
11
  add_subprocedure :build_lock, BuildLock
12
12
  add_subprocedure :build_manifest, BuildManifest
13
13
 
14
- def execute
14
+ step :build do
15
15
  if locked?
16
16
  subprocedure(:build_lock)
17
17
  else
@@ -10,28 +10,21 @@ module GitCompound
10
10
 
11
11
  add_subprocedure :tasks_runner, Tasks
12
12
 
13
- def execute
13
+ step :build_info do
14
14
  Logger.info 'Building components from lockfile ...'
15
-
16
- verify_manifest
17
- build_locked_components
18
- execute_tasks
19
15
  end
20
16
 
21
- private
22
-
23
- def verify_manifest
24
- return if @manifest.md5sum == @lock.manifest
25
-
17
+ step :verify_manifest do
26
18
  raise GitCompoundError,
27
- 'Manifest md5sum has changed ! Use `update` command.'
19
+ 'Manifest md5sum has changed ! Use `update` command.' unless
20
+ @manifest.md5sum == @lock.manifest
28
21
  end
29
22
 
30
- def build_locked_components
23
+ step :build_lock do
31
24
  @lock.process(Worker::ComponentDispatcher.new(@lock))
32
25
  end
33
26
 
34
- def execute_tasks
27
+ step :execute_tasks do
35
28
  subprocedure(:tasks_runner)
36
29
  end
37
30
  end
@@ -11,30 +11,23 @@ module GitCompound
11
11
  add_subprocedure :check_dependencies, Check
12
12
  add_subprocedure :tasks_runner, Tasks
13
13
 
14
- def execute
14
+ step :build_info do
15
15
  Logger.info 'Building components ...'
16
-
17
- check_dependencies
18
- build_manifest
19
- execute_tasks
20
- lock_manifest
21
16
  end
22
17
 
23
- private
24
-
25
- def check_dependencies
18
+ step :check do
26
19
  subprocedure(:check_dependencies)
27
20
  end
28
21
 
29
- def build_manifest
22
+ step :build_manifest do
30
23
  @manifest.process(Worker::ComponentBuilder.new(@lock))
31
24
  end
32
25
 
33
- def execute_tasks
26
+ step :execute_tasks do
34
27
  subprocedure(:tasks_runner)
35
28
  end
36
29
 
37
- def lock_manifest
30
+ step :lock_manifest do
38
31
  @lock.lock_manifest(@manifest)
39
32
  @lock.write
40
33
  end
@@ -7,11 +7,11 @@ module GitCompound
7
7
  include Element::Manifest
8
8
 
9
9
  def execute!
10
- execute
10
+ super
11
11
  Logger.info 'OK'
12
12
  end
13
13
 
14
- def execute
14
+ step :check_dependencies do
15
15
  Logger.info 'Checking dependencies ...'
16
16
 
17
17
  @manifest.process(
@@ -4,12 +4,8 @@ module GitCompound
4
4
  # Help command procedure
5
5
  #
6
6
  class Help < Procedure
7
- def execute
8
- Logger.info(message)
9
- end
10
-
11
- def message
12
- self.class.message
7
+ step :print_help do
8
+ Logger.info(self.class.message)
13
9
  end
14
10
 
15
11
  # rubocop:disable Metrics/AbcSize
@@ -16,20 +16,45 @@ module GitCompound
16
16
  # Main procedure entry point
17
17
  #
18
18
  def execute
19
- raise NotImplementedError
19
+ self.class.steps.to_h.keys.each do |name|
20
+ execute_step(name)
21
+ end
20
22
  end
21
23
 
22
- # Valid options available for this procedure
23
- # see Element::Option
24
- #
25
- def self.options
26
- {}
24
+ def execute_step(name)
25
+ step_proc = self.class.steps.to_h[name]
26
+ instance_eval(&step_proc) if step_proc
27
27
  end
28
28
 
29
- # Name of procedure
30
- #
31
- def self.to_s
32
- name.split('::').last.downcase
29
+ class << self
30
+ attr_reader :steps
31
+
32
+ # Valid options available for this procedure
33
+ # see Element::Option
34
+ #
35
+ def options
36
+ {}
37
+ end
38
+
39
+ # Name of procedure
40
+ #
41
+ def to_s
42
+ name.split('::').last
43
+ .gsub(/::/, '/')
44
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
45
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
46
+ .tr('-', '_')
47
+ .downcase
48
+ end
49
+
50
+ private
51
+
52
+ def step(name, &block)
53
+ raise GitCompoundError, 'No block given !' unless block
54
+
55
+ @steps = {} unless @steps
56
+ @steps.store(name, block)
57
+ end
33
58
  end
34
59
  end
35
60
  end
@@ -8,10 +8,10 @@ module GitCompound
8
8
 
9
9
  def execute!
10
10
  Logger.info 'Processing components list ...'
11
- execute
11
+ super
12
12
  end
13
13
 
14
- def execute
14
+ step :pretty_print do
15
15
  @manifest.process(
16
16
  Worker::CircularDependencyChecker.new,
17
17
  Worker::PrettyPrint.new)
@@ -8,9 +8,8 @@ module GitCompound
8
8
  include Element::Option
9
9
 
10
10
  add_parameter :allow_nested_subtasks, type: :boolean, scope: :global
11
- # add_parameter :list, type: Argument::StringBoolean
12
11
 
13
- def execute
12
+ step :tasks do
14
13
  Logger.info 'Running tasks ...'
15
14
 
16
15
  if @opts[:allow_nested_subtasks]
@@ -11,44 +11,35 @@ module GitCompound
11
11
  add_subprocedure :check_dependencies, Check
12
12
  add_subprocedure :tasks_runner, Tasks
13
13
 
14
- def execute
14
+ step :check_lockfile do
15
15
  raise GitCompoundError,
16
16
  "Lockfile `#{Lock::FILENAME}` does not exist ! " \
17
17
  'You should use `build` command.' unless locked?
18
-
19
- protect_local_modifications
20
- check_dependencies
21
- update
22
- execute_tasks
23
- lock_updated_manifest
24
- remove_dormant_components
25
18
  end
26
19
 
27
- private
28
-
29
- def protect_local_modifications
20
+ step :protect_local_modifications do
30
21
  @lock.process(Worker::LocalChangesGuard.new(@lock))
31
22
  end
32
23
 
33
- def check_dependencies
24
+ step :check_dependencies do
34
25
  subprocedure(:check_dependencies)
35
26
  end
36
27
 
37
- def update
28
+ step :update do
38
29
  Logger.info 'Updating components ...'
39
30
  @manifest.process(Worker::ComponentDispatcher.new(@lock_new))
40
31
  end
41
32
 
42
- def execute_tasks
33
+ step :execute_tasks do
43
34
  subprocedure(:tasks_runner)
44
35
  end
45
36
 
46
- def lock_updated_manifest
37
+ step :lock_updated_manifest do
47
38
  @lock_new.lock_manifest(@manifest)
48
39
  @lock_new.write
49
40
  end
50
41
 
51
- def remove_dormant_components
42
+ step :remove_dormant_components do
52
43
  dormant_components = @lock.components.reject do |component|
53
44
  @lock_new.find(component) ? true : false
54
45
  end
@@ -0,0 +1,15 @@
1
+ module GitCompound
2
+ module Command
3
+ module Procedure
4
+ # Debug cases for Procedure
5
+ #
6
+ class Procedure
7
+ extend Logger::Debugger
8
+
9
+ debug_before(:execute_step) do |name|
10
+ "Executing step `#{name}` in `#{self.class}` procedure"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -53,6 +53,7 @@ module GitCompound
53
53
  require 'git_compound/logger/debug/command'
54
54
  require 'git_compound/logger/debug/repository'
55
55
  require 'git_compound/logger/debug/task'
56
+ require 'git_compound/logger/debug/procedure'
56
57
  end
57
58
  end
58
59
  end
@@ -1,5 +1,5 @@
1
1
  # GitCompound
2
2
  #
3
3
  module GitCompound
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_compound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Bizon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-08-21 00:00:00.000000000 Z
12
+ date: 2015-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -155,6 +155,7 @@ files:
155
155
  - lib/git_compound/logger/colors.rb
156
156
  - lib/git_compound/logger/core_ext/string.rb
157
157
  - lib/git_compound/logger/debug/command.rb
158
+ - lib/git_compound/logger/debug/procedure.rb
158
159
  - lib/git_compound/logger/debug/repository.rb
159
160
  - lib/git_compound/logger/debug/task.rb
160
161
  - lib/git_compound/logger/debugger.rb