docman 0.0.76 → 0.0.77

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: 8be94daef026188f376e990598508337b640edbb
4
- data.tar.gz: 9e6bd0190d00092bc09562abf1a3e5d362b64fd6
3
+ metadata.gz: 2e2afd9b63d84de74e86fac27722672576120501
4
+ data.tar.gz: bd1940da413dbe6f6ae113375e5ced359561e9c5
5
5
  SHA512:
6
- metadata.gz: bd07ab28468f3373189433cb2ab82a81b2c7ea00e29b17db8a28790add824ffe0b745df3d045b2526a946c3d9219ac89b296d672e0ee5e3ab5cd46daec68cf9c
7
- data.tar.gz: 204f8c2bd9221c232d1613ad201309f985adc58c207fe8cb20f48538b7943d23afc08117e92b547da42f921122efe42cf8df8e4a13eb888a7e51ba1a05bc2e2a
6
+ metadata.gz: 74a5cf325c5282c0974b95ca90967508c7034439f7bf8db27818f12140a8aa6093e85314fe8a7bb584cab0a7a8d207e91549babb80d040ff409c2e91cd6a0c5d
7
+ data.tar.gz: b37781c99b404e2fcac0988010d4f83ca4ec2bccc9a248233c3a086b1f974e345a1fdf0d3474cb78e768643126d363fa506696e50b5292e5b3985f092e44f484
data/config/config.yaml CHANGED
@@ -7,10 +7,31 @@ deploy_targets:
7
7
  handler: :dir_builder
8
8
  root_chain:
9
9
  handler: :git_direct_builder
10
+ hooks:
11
+ builder:
12
+ after_execute:
13
+ - type: :yaml_execute
14
+ source_type: file
15
+ order: -10
16
+ stage: build
10
17
  drupal:
11
18
  handler: :drupal_drush_builder
19
+ hooks:
20
+ builder:
21
+ after_execute:
22
+ - type: :yaml_execute
23
+ source_type: file
24
+ order: -10
25
+ stage: build
12
26
  repo:
13
27
  handler: :git_direct_builder
28
+ hooks:
29
+ builder:
30
+ after_execute:
31
+ - type: :yaml_execute
32
+ source_type: file
33
+ order: -10
34
+ stage: build
14
35
  dir:
15
36
  handler: :dir_builder
16
37
  symlink:
@@ -35,6 +56,11 @@ deploy_targets:
35
56
  hooks:
36
57
  builder:
37
58
  after_execute:
59
+ - type: :yaml_execute
60
+ source_type: file
61
+ order: -10
62
+ execution_dir: $PROJECT$
63
+ stage: build
38
64
  - type: :git_commit
39
65
  order: 100
40
66
  execution_dir: $PROJECT$
@@ -54,6 +80,11 @@ deploy_targets:
54
80
  - type: :git_pull
55
81
  execution_dir: $PROJECT$
56
82
  after_execute:
83
+ - type: :yaml_execute
84
+ source_type: file
85
+ order: -10
86
+ execution_dir: $PROJECT$
87
+ stage: build
57
88
  - type: :git_commit
58
89
  order: 100
59
90
  execution_dir: $PROJECT$
data/lib/application.rb CHANGED
@@ -28,6 +28,7 @@ require 'docman/commands/create_symlink_cmd'
28
28
  require 'docman/commands/execute_script_cmd'
29
29
  require 'docman/commands/clean_changed_cmd'
30
30
  require 'docman/commands/git_commit_cmd'
31
+ require 'docman/commands/yaml_execute_cmd'
31
32
  require 'docman/commands/git_pull_cmd'
32
33
  require 'docman/commands/git_copy_repo_content_cmd'
33
34
  require 'docman/taggers/tagger'
data/lib/docman/cli.rb CHANGED
@@ -44,7 +44,7 @@ module Docman
44
44
  def build(deploy_target, state)
45
45
  get_to_root_dir
46
46
  if options[:force]
47
- FileUtils.rm_r('master') if File.directory? 'master'
47
+ FileUtils.rm_rf('master') if File.directory? 'master'
48
48
  end
49
49
  Application.instance.build(deploy_target, state, options)
50
50
  say('Complete!', :green)
@@ -67,11 +67,14 @@ module Docman
67
67
  end
68
68
 
69
69
  def add_action(name, hook, context = nil)
70
- hook['order'] = 0 unless hook['order']
71
- if @hooks.has_key? name
72
- @hooks[name] << hook
73
- else
74
- @hooks[name] = [hook]
70
+ version = Docman::Application.instance.config.version
71
+ unless hook['version'].nil? || hook['version'] != version
72
+ hook['order'] = 0 unless hook['order']
73
+ if @hooks.has_key? name
74
+ @hooks[name] << hook
75
+ else
76
+ @hooks[name] = [hook]
77
+ end
75
78
  end
76
79
  end
77
80
 
@@ -137,6 +140,7 @@ module Docman
137
140
  value.gsub!('$PROJECT$', @context['full_build_path']) unless @context['full_build_path'].nil?
138
141
  value.gsub!('$INFO$', @context['full_path']) unless @context['full_path'].nil?
139
142
  value.gsub!('$ENVIRONMENT$', @context.environment_name) unless @context.environment_name.nil?
143
+ value.gsub!('$DOCMAN_BIN$', Application::bin)
140
144
  end
141
145
 
142
146
  end
@@ -4,7 +4,6 @@ module Docman
4
4
 
5
5
  register_command :script
6
6
 
7
-
8
7
  def validate_command
9
8
  raise Docman::CommandValidationError.new("Please provide 'execution_dir' param") if self['execution_dir'].nil?
10
9
  raise Docman::CommandValidationError.new("Please provide 'location' param") if self['location'].nil?
@@ -0,0 +1,46 @@
1
+ module Docman
2
+ class YamlExecuteCmd < Docman::Command
3
+
4
+ register_command :yaml_execute
5
+
6
+ def validate_command
7
+ raise "Please provide 'context'" if @context.nil?
8
+ raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
9
+ raise "Both file & inline could not be se for this command" if self['yaml_file_name'] && self['inline']
10
+ end
11
+
12
+ before_execute do
13
+ self['source_type'] = 'inline' if self['source_type'].nil?
14
+ end
15
+
16
+ def execute
17
+ with_logging('yaml_execute') do
18
+ if self['environments'].nil? || self['environments'] == 'all' || self['environments'].include?(@context.environment_name)
19
+ commands = nil
20
+ if self['source_type'] == 'file'
21
+ yaml_file_name = self['yaml_file_name'].nil? ? '.build.yml' : self['yaml_file_name']
22
+ build_file = File.join(@context['full_build_path'], yaml_file_name)
23
+ if File.file? build_file
24
+ build_file_yaml = YAML::load_file(build_file)
25
+ commands = build_file_yaml[self['stage']]
26
+ source = yaml_file_name
27
+ end
28
+ end
29
+ if self['source_type'] == 'inline'
30
+ commands = self['commands']
31
+ source = 'inline'
32
+ end
33
+ unless commands.nil?
34
+ commands.each do |cmd|
35
+ logger.info "Execute from #{source}: #{cmd}"
36
+ logger.info `#{cmd}`
37
+ if $?.exitstatus > 0
38
+ raise "Command #{cmd} was failed"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
data/lib/docman/config.rb CHANGED
@@ -23,6 +23,7 @@ module Docman
23
23
  def merge_config_from_file(file)
24
24
  config = YAML::load_file(file)
25
25
  @config.deep_merge(config)
26
+ @config['version'] = config['version'].nil? ? 1 : config['version']
26
27
  assign_to_self
27
28
  end
28
29
 
@@ -30,5 +31,9 @@ module Docman
30
31
  Digest::MD5.hexdigest(Marshal::dump(@unmutable_config))
31
32
  end
32
33
 
34
+ def version
35
+ @config['version']
36
+ end
37
+
33
38
  end
34
39
  end
data/lib/docman/info.rb CHANGED
@@ -61,8 +61,9 @@ module Docman
61
61
  to_save['result'] = result
62
62
  to_save['type'] = self['type']
63
63
  to_save['build_type'] = self['build_type']
64
-
65
- File.open(File.join(self['full_build_path'], 'info.yaml'), 'w') {|f| f.write to_save.to_yaml}
64
+ if environment_name() != 'local'
65
+ File.open(File.join(self['full_build_path'], 'info.yaml'), 'w') {|f| f.write to_save.to_yaml}
66
+ end
66
67
  to_save
67
68
  end
68
69
 
@@ -1,3 +1,3 @@
1
1
  module Docman
2
- VERSION = "0.0.76"
2
+ VERSION = "0.0.77"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.76
4
+ version: 0.0.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tolstikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -188,6 +188,7 @@ files:
188
188
  - lib/docman/commands/git_pull_cmd.rb
189
189
  - lib/docman/commands/ssh_target_checker.rb
190
190
  - lib/docman/commands/target_checker.rb
191
+ - lib/docman/commands/yaml_execute_cmd.rb
191
192
  - lib/docman/config.rb
192
193
  - lib/docman/context.rb
193
194
  - lib/docman/deployers/common_deployer.rb