docman 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/bin/project-template.sh +5 -0
- data/config/config.yaml +1 -0
- data/lib/application.rb +21 -2
- data/lib/docman/builders/builder.rb +3 -1
- data/lib/docman/cli.rb +25 -3
- data/lib/docman/deployers/deployer.rb +2 -0
- data/lib/docman/docroot_config.rb +9 -2
- data/lib/docman/info.rb +11 -9
- data/lib/docman/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75c527ffe147b306981988ec6e43c9a8f52b5655
|
4
|
+
data.tar.gz: 29c28bb15683e9d69de0b1dd2aafeacdecaa12c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd302dc345e6aadd97b11cc3dc7ade6d1646bf1dfb57043537e5ea8226f55eb5cab11bd2c74ead4364d8994d5441a8a2ae4f08a6fbfc2356584e5170f8f2e7f
|
7
|
+
data.tar.gz: 045be0319d90b1c7de8dc3cc354fff15a9bed63f10d2bfaf87713789019e98060de658ed978fae3e497c7c95aa9c79d3ad3d0b95d1273fb0be313a70005c1f59
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Docman made for DOCroot MANagement for Drupal projects. Useful to manage multipl
|
|
4
4
|
|
5
5
|
Notes: we are speaking about the code only, media files should be managed separately and for now are out of scope of this tool.
|
6
6
|
|
7
|
+
Docman requires Linux or OS X.
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
$ gem install docman
|
@@ -37,4 +39,4 @@ Build the destination docroot using your settings:
|
|
37
39
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
40
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
41
|
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
-
5. Create a new Pull Request
|
42
|
+
5. Create a new Pull Request
|
data/config/config.yaml
CHANGED
data/lib/application.rb
CHANGED
@@ -54,7 +54,7 @@ module Docman
|
|
54
54
|
#`git checkout #{branch} & git branch -u origin #{branch}`
|
55
55
|
end
|
56
56
|
|
57
|
-
def with_rescue
|
57
|
+
def with_rescue(write_to_file = true)
|
58
58
|
failed_filepath = File.join(@workspace_dir, 'failed')
|
59
59
|
if File.file?(failed_filepath)
|
60
60
|
log 'Last operation failed, forced rebuild mode'
|
@@ -64,7 +64,9 @@ module Docman
|
|
64
64
|
yield
|
65
65
|
rescue Exception => e
|
66
66
|
log "Operation failed: #{e.message}", 'error'
|
67
|
-
|
67
|
+
if write_to_file
|
68
|
+
File.open(failed_filepath, 'w') {|f| f.write(e.message) }
|
69
|
+
end
|
68
70
|
raise e
|
69
71
|
end
|
70
72
|
|
@@ -96,6 +98,19 @@ module Docman
|
|
96
98
|
result
|
97
99
|
end
|
98
100
|
|
101
|
+
def template(name, options = false)
|
102
|
+
with_rescue(false) do
|
103
|
+
@options = options
|
104
|
+
@docroot_config = DocrootConfig.new(@workspace_dir, nil)
|
105
|
+
project = @docroot_config.project(name)
|
106
|
+
unless project['template'].nil?
|
107
|
+
Dir.chdir project['full_build_path']
|
108
|
+
Exec.do "#{Application::bin}/project-template.sh #{project['template']}"
|
109
|
+
log "Project had been initialized with template: #{project['template']}"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
99
114
|
def write_state state
|
100
115
|
filepath = File.join(@workspace_dir, 'state')
|
101
116
|
File.open(filepath, 'w') { |file| file.write(state) }
|
@@ -125,6 +140,10 @@ module Docman
|
|
125
140
|
Pathname(__FILE__).dirname.parent
|
126
141
|
end
|
127
142
|
|
143
|
+
def environment(name)
|
144
|
+
@config['environments'][name]
|
145
|
+
end
|
146
|
+
|
128
147
|
def self.bin
|
129
148
|
File.join root, 'bin'
|
130
149
|
end
|
@@ -23,7 +23,9 @@ module Docman
|
|
23
23
|
def config
|
24
24
|
super
|
25
25
|
@version = nil
|
26
|
-
|
26
|
+
environment = Application.instance.environment(@context.environment_name)
|
27
|
+
clean_changed = environment['clean_changed'].nil? ? true : environment['clean_changed']
|
28
|
+
add_action('before_execute', {'type' => :clean_changed}, @context) if clean_changed
|
27
29
|
end
|
28
30
|
|
29
31
|
def validate_command
|
data/lib/docman/cli.rb
CHANGED
@@ -41,7 +41,7 @@ module Docman
|
|
41
41
|
method_option :force, :aliases => '-f', :desc => 'Force full rebuild'
|
42
42
|
option :tag
|
43
43
|
def build(deploy_target, state)
|
44
|
-
|
44
|
+
get_to_root_dir
|
45
45
|
if options[:force]
|
46
46
|
FileUtils.rm_r('master') if File.directory? 'master'
|
47
47
|
end
|
@@ -52,11 +52,11 @@ module Docman
|
|
52
52
|
desc 'deploy', 'Deploy to target'
|
53
53
|
method_option :force, :aliases => '-f', :desc => 'Force full deploy'
|
54
54
|
def deploy(deploy_target, name, type, version)
|
55
|
+
get_to_root_dir
|
55
56
|
if version.start_with?('state_')
|
56
57
|
state = version.partition('_').last
|
57
58
|
build(deploy_target, state)
|
58
59
|
else
|
59
|
-
config_dir?
|
60
60
|
result = Application.instance.deploy(deploy_target, name, type, version, options)
|
61
61
|
say(result, :green)
|
62
62
|
end
|
@@ -75,9 +75,31 @@ module Docman
|
|
75
75
|
say('Complete!', :green)
|
76
76
|
end
|
77
77
|
|
78
|
+
desc 'template', 'Reinit project from template'
|
79
|
+
method_option :force, :aliases => '-f', :desc => 'Force project override with template'
|
80
|
+
option :name
|
81
|
+
def template(name = nil)
|
82
|
+
current_dir_name = File.basename(Dir.pwd)
|
83
|
+
get_to_root_dir
|
84
|
+
name = current_dir_name if name.nil?
|
85
|
+
Application.instance.template(name, options)
|
86
|
+
say('Complete!', :green)
|
87
|
+
end
|
88
|
+
|
78
89
|
no_commands {
|
90
|
+
def current_dir_has_config_dir
|
91
|
+
File.directory?('config')
|
92
|
+
end
|
93
|
+
|
79
94
|
def config_dir?
|
80
|
-
raise 'ERROR: No config directory in docroot' unless
|
95
|
+
raise 'ERROR: No config directory in docroot' unless current_dir_has_config_dir
|
96
|
+
end
|
97
|
+
|
98
|
+
def get_to_root_dir
|
99
|
+
until current_dir_has_config_dir
|
100
|
+
raise 'ERROR: No config directory in docroot' if File.basename(Dir.pwd) == '/'
|
101
|
+
Dir.chdir('..')
|
102
|
+
end
|
81
103
|
end
|
82
104
|
}
|
83
105
|
end
|
@@ -79,11 +79,14 @@ module Docman
|
|
79
79
|
@names[name]
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def project(name)
|
83
83
|
raise "There is no project with name '#{name}' exists in config" unless @names.has_key? name
|
84
|
+
@names[name]
|
85
|
+
end
|
84
86
|
|
87
|
+
def states_dependin_on(name, version)
|
85
88
|
states = {}
|
86
|
-
|
89
|
+
project(name).states.each do |state, info|
|
87
90
|
states[state] = info if info['version'] == version
|
88
91
|
end
|
89
92
|
states
|
@@ -97,5 +100,9 @@ module Docman
|
|
97
100
|
@root['fuil_build_path']
|
98
101
|
end
|
99
102
|
|
103
|
+
def deploy_target_name
|
104
|
+
@deploy_target.name
|
105
|
+
end
|
106
|
+
|
100
107
|
end
|
101
108
|
end
|
data/lib/docman/info.rb
CHANGED
@@ -12,17 +12,19 @@ module Docman
|
|
12
12
|
hash.each_pair do |k, v|
|
13
13
|
self[k] = v
|
14
14
|
end
|
15
|
-
self['build_type'] = self['docroot_config'].deploy_target['builders'][self['type']]['handler']
|
15
|
+
self['build_type'] = self['docroot_config'].deploy_target['builders'][self['type']]['handler'] unless self['docroot_config'].deploy_target.nil?
|
16
16
|
@need_rebuild = Hash.new
|
17
17
|
@changed = Hash.new
|
18
18
|
@state_name = nil
|
19
|
-
|
20
|
-
self
|
21
|
-
|
22
|
-
if state
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
unless self['docroot_config'].deploy_target.nil?
|
20
|
+
if self.has_key? 'states'
|
21
|
+
self['states'].each_pair do |name, state|
|
22
|
+
if state.has_key?('source')
|
23
|
+
if state['source']['type'] == :retrieve_from_repo
|
24
|
+
repo = state['source']['repo'] == :project_repo ? self['repo'] : state['source']['repo']
|
25
|
+
external_state_info = read_yaml_from_file(repo, self['states_path'], state['source']['branch'], state['source']['file'])
|
26
|
+
state.deep_merge! external_state_info unless external_state_info.nil? or state.nil?
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -138,7 +140,7 @@ module Docman
|
|
138
140
|
end
|
139
141
|
|
140
142
|
def environment_name
|
141
|
-
self['docroot_config'].deploy_target['states'][@state_name]
|
143
|
+
self['docroot_config'].deploy_target['states'][@state_name] unless self['docroot_config'].deploy_target.nil?
|
142
144
|
end
|
143
145
|
|
144
146
|
end
|
data/lib/docman/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tolstikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -145,6 +145,7 @@ executables:
|
|
145
145
|
- docman
|
146
146
|
- docman.rb
|
147
147
|
- functions.sh
|
148
|
+
- project-template.sh
|
148
149
|
extensions: []
|
149
150
|
extra_rdoc_files: []
|
150
151
|
files:
|
@@ -158,6 +159,7 @@ files:
|
|
158
159
|
- bin/docman
|
159
160
|
- bin/docman.rb
|
160
161
|
- bin/functions.sh
|
162
|
+
- bin/project-template.sh
|
161
163
|
- config/config.yaml
|
162
164
|
- config/cucumber.yml
|
163
165
|
- docman.gemspec
|