brief 1.8.3 → 1.8.4

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: be0eef8f655a9b9d5ebe02b3b718ddc36d380bb5
4
- data.tar.gz: 2926731279f53b37faa4c905839fca50df24673b
3
+ metadata.gz: a5def0728ed54389129584f946fb33161b8ab138
4
+ data.tar.gz: 1792a378fa94f8475ebd3f88dd0d5ec9963c5b34
5
5
  SHA512:
6
- metadata.gz: 088bf02d1b3cb7399e8a43729da51bb7a42be252ecce8c2ccf704f6e467d00c206d7dcdab579711642bcda7459c3cde624ba8c1007792ce8a2fc643e13d83fe3
7
- data.tar.gz: 3e694d6d1114e770ad4792f6e6b685b502340b5d7a8d594213447c0154630e5851184b88624f81fdd4cff4f08c68e1931e3bb46376dc1e131c40d0ea1b4f7ae5
6
+ metadata.gz: df431f1e995f94e3841ed9a6473df7a2e254eb7f0801006f07a123411270bc44a26c14f52eee78777696c66b7bc81e679035ade1f76d2914392566fa489e9d63
7
+ data.tar.gz: 3c522d5ad2aecbe1dd8dff0a84100cad1dff2190ef69a1e4bd1f79ca5873d597978783335fa6dd1a36e17ea3fcc290fda1d8909ae3ceb2f0187e4a4469e861d9
@@ -20,6 +20,10 @@ module Brief
20
20
  Brief.cases[root.basename.to_s] ||= self
21
21
  end
22
22
 
23
+ def render_paths paths
24
+
25
+ end
26
+
23
27
  def present(style="default", params={})
24
28
  if respond_to?("as_#{style}")
25
29
  send("as_#{style}", params)
@@ -0,0 +1,50 @@
1
+ command 'parse' do |c|
2
+ c.syntax = 'brief parse PATH [OPTIONS]'
3
+ c.description = 'parse the briefcase path'
4
+
5
+ c.option '--root PATH', String, 'The briefcase root'
6
+ c.option '--output PATH', String, 'Save the output to the specified path'
7
+ c.option '--app APP', String, 'Use the specified app to get our models etc'
8
+ c.option '--config PATH', String, 'Use the specified config file'
9
+ c.option '--type TYPE', String, 'Valid options: hash, array; Output as a hash keyed by path, or an array. Defaults to array.'
10
+
11
+ c.action do |args, options|
12
+ options.default(root: Pathname(Dir.pwd), type: "array")
13
+
14
+ o = {
15
+ root: options.root
16
+ }
17
+
18
+ o[:app] = options.app if options.app
19
+ o[:config_path] = options.config if options.config
20
+
21
+ briefcase = Brief::Briefcase.new(o)
22
+
23
+ parsed = if args.empty?
24
+ briefcase.all_models.map do |model|
25
+ model.as_json(content:true, rendered: true)
26
+ end
27
+ else
28
+ args.map do |a|
29
+ Dir[briefcase.root.join(a)].map do |f|
30
+ doc = Brief::Document.new(f).in_briefcase(briefcase)
31
+ doc.to_model.as_json(content: true, rendered: true)
32
+ end
33
+ end.flatten
34
+ end
35
+
36
+ if options.type == "hash"
37
+ parsed = parsed.inject({}) do |memo, obj|
38
+ path = obj[:path]
39
+ memo[path] = obj
40
+ memo
41
+ end
42
+ end
43
+
44
+ if options.output
45
+ Pathname(options.output).open("w+") {|fh| fh.write(parsed.to_json) }
46
+ else
47
+ puts parsed.to_json
48
+ end
49
+ end
50
+ end
data/lib/brief/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Brief
2
- VERSION = '1.8.3'
2
+ VERSION = '1.8.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brief
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Soeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -260,6 +260,7 @@ files:
260
260
  - lib/brief/cli/change.rb
261
261
  - lib/brief/cli/export.rb
262
262
  - lib/brief/cli/init.rb
263
+ - lib/brief/cli/parse.rb
263
264
  - lib/brief/cli/write.rb
264
265
  - lib/brief/configuration.rb
265
266
  - lib/brief/core_ext.rb