docman 0.0.63 → 0.0.64

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19c3a69b03efda337d0b625c26c91014c3f246de
4
- data.tar.gz: ccbb246502c329c0a28eefa6ee9f4efed719690b
3
+ metadata.gz: c7a813f823100ee3b02a0f00202a92234e1bfe9b
4
+ data.tar.gz: 37f2e54df5edbbf5cc61844f69563b219918f4a4
5
5
  SHA512:
6
- metadata.gz: 1fdf55c25421e73feaec580dc9dddeef23925189cf973287de7a058f3910983fd3c46ba89126385456bd7c13fc21dc80c101e2c422c38271c626b376a44ef755
7
- data.tar.gz: 0521179f42c31eda70de92bb5b362c5a136801d09f973860b8b23e077192f85f9a1f214e1a7849020a905656c7675055e0e060829b8189c7c07671f39f5a99d2
6
+ metadata.gz: 5424b8fdbc34aa06aeefd9ace6c3a64ee235d1a3a74a1cc282133ef527b289a8fba4dfccf8b788492ae43b5ff28d0ce15ff9787d284de7dabe2c9c23911d4b18
7
+ data.tar.gz: 02c69adae575188c5803a801f6755b800f65fb9af15ddf4e5560d7ba64629ba4e294257e07a8b8a17655b60812ed4f7363da88183b9e2cee24d0eb0907f1b68f
@@ -137,6 +137,29 @@ module Docman
137
137
  end
138
138
  end
139
139
 
140
+ def info(command, file, options = false)
141
+ result = {}
142
+ with_rescue(false) do
143
+ @docroot_config = DocrootConfig.new(@workspace_dir, deploy_target)
144
+ info = info ? info : @docroot_config.structure
145
+ @docroot_config.chain(info).values.each do |item|
146
+ #result[item['name']] = item['repo']
147
+ result.merge! info_recursive(item)
148
+ end
149
+ end
150
+ File.open(file, 'w') {|f| f.write result}
151
+ result
152
+ end
153
+
154
+ def info_recursive(info)
155
+ result = {}
156
+ result[info['name']] = info['repo'] if info.key?('repo')
157
+ info['children'].each do |child|
158
+ result.merge! info_recursive(child)
159
+ end
160
+ result
161
+ end
162
+
140
163
  def write_state state
141
164
  filepath = File.join(@workspace_dir, 'state')
142
165
  File.open(filepath, 'w') { |file| file.write(state) }
@@ -1,6 +1,7 @@
1
1
  require 'thor'
2
2
  require 'application'
3
3
  require 'docman/git_util'
4
+ require 'json'
4
5
 
5
6
  module Docman
6
7
  class CLI < Thor
@@ -92,6 +93,14 @@ module Docman
92
93
  say('Complete!', :green)
93
94
  end
94
95
 
96
+ desc 'info', 'Get info'
97
+ method_option :force, :aliases => '-f', :desc => 'Force full rebuild'
98
+ option :tag
99
+ def info(command, file)
100
+ say(Application.instance.info(command, file, options).to_json);
101
+ # say('Complete!', :green)
102
+ end
103
+
95
104
  no_commands {
96
105
  def current_dir_has_config_dir
97
106
  File.directory?('config')
@@ -7,7 +7,7 @@ module Docman
7
7
 
8
8
  attr_reader :structure, :deploy_target, :docroot_dir, :root, :raw_infos
9
9
 
10
- def initialize(docroot_dir, deploy_target)
10
+ def initialize(docroot_dir, deploy_target = nil)
11
11
  @docroot_dir = docroot_dir
12
12
  @deploy_target = deploy_target
13
13
  @docroot_config_dir = File.join(docroot_dir, 'config')
@@ -1,3 +1,3 @@
1
1
  module Docman
2
- VERSION = "0.0.63"
2
+ VERSION = "0.0.64"
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.63
4
+ version: 0.0.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tolstikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2016-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler