brief 1.8.6 → 1.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -3
  3. data/.travis.yml +8 -0
  4. data/Gemfile.lock +9 -8
  5. data/Rakefile +19 -15
  6. data/apps/blueprint/models/page.rb +1 -1
  7. data/apps/blueprint/models/roadmap.rb +14 -0
  8. data/apps/blueprint/templates/epic.md.erb +0 -0
  9. data/apps/blueprint/templates/milestone.md.erb +0 -0
  10. data/apps/blueprint/templates/page.md.erb +0 -0
  11. data/apps/blueprint/templates/persona.md.erb +0 -0
  12. data/apps/blueprint/templates/user_story.md.erb +0 -0
  13. data/bin/brief +3 -3
  14. data/brief.gemspec +9 -3
  15. data/examples/blog/brief.rb +13 -18
  16. data/examples/blog/docs/posts/this-is-my-first-post.md +12 -0
  17. data/lib/brief.rb +10 -4
  18. data/lib/brief/apps.rb +1 -1
  19. data/lib/brief/briefcase.rb +13 -8
  20. data/lib/brief/briefcase/initializer.rb +64 -0
  21. data/lib/brief/cli/all.rb +69 -0
  22. data/lib/brief/cli/export.rb +21 -10
  23. data/lib/brief/cli/parse.rb +1 -1
  24. data/lib/brief/cli/render.rb +1 -1
  25. data/lib/brief/data.rb +1 -1
  26. data/lib/brief/document.rb +18 -15
  27. data/lib/brief/document/rendering.rb +18 -33
  28. data/lib/brief/document_mapper.rb +1 -1
  29. data/lib/brief/model/serializers.rb +2 -2
  30. data/lib/brief/version.rb +1 -1
  31. data/packaging/wrapper.sh +32 -0
  32. data/spec/fixtures/example/docs/epics/epic.html.md +25 -0
  33. data/spec/fixtures/example/docs/index.md +15 -0
  34. data/spec/fixtures/example/docs/page.html.md +14 -0
  35. data/spec/fixtures/example/docs/persona.html.md +5 -0
  36. data/spec/fixtures/example/docs/release.html.md +9 -0
  37. data/spec/fixtures/example/docs/resource.html.md +5 -0
  38. data/spec/fixtures/example/docs/user_story.html.md +24 -0
  39. data/spec/fixtures/example/docs/wireframe.html.md +5 -0
  40. data/spec/fixtures/example/models/page.rb +2 -1
  41. data/spec/lib/brief/serializers_spec.rb +1 -1
  42. data/tasks/distribution/configuration.rb +15 -0
  43. data/tasks/distribution/executable.rb +28 -0
  44. data/tasks/distribution/package.rb +85 -0
  45. data/tasks/distribution/package_helpers.rb +12 -0
  46. data/tasks/distribution/release.rb +49 -0
  47. data/tasks/distribution/release_notes.erb +14 -0
  48. data/tasks/distribution/release_notes.rb +62 -0
  49. data/tasks/distribution/tarball.rb +47 -0
  50. data/tasks/distribution/travelling_ruby.rb +87 -0
  51. data/tasks/package.rake +41 -0
  52. data/tasks/styles.rake +47 -0
  53. data/tasks/upload.rake +40 -0
  54. metadata +51 -18
  55. data/clients/package.json +0 -11
  56. data/examples/blog/docs/an-intro-to-brief.html.md +0 -9
  57. data/lib/.DS_Store +0 -0
  58. data/lib/brief/cli/change.rb +0 -14
  59. data/lib/brief/cli/init.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 142e8f462cc9f7d9a8a504788cff6a7b7562f2d8
4
- data.tar.gz: 54f32f83c554275697f798a377498f6eb75ae9a7
3
+ metadata.gz: 903817ba42bbf2c8231ebe66c95bf636feea9094
4
+ data.tar.gz: fdc126615c19f6d93f6221501e65b92c0153e860
5
5
  SHA512:
6
- metadata.gz: fdad0e4836b46a6e474cff0732f90a467013315f18f75377dbb4880fdc28896ead148c1ab6942fbff4678c330496c877d1378b933ce9dd93951b0d40039c3250
7
- data.tar.gz: 34506086a0dad0d5d91484da8af8922e726322e5c7f3a023f79d7833ac85310c70cc7df12df7cd00b5e7d8a51549e1ac52c00e18cc6996528044ba4655481b35
6
+ metadata.gz: 246599c7a7fe9c2fd1ce77fca49f53767d9927c9f7a935cc1a94acc649f805147a8b889e4f1753a0ecd06862fdcbbb8dd92b23c00a688a2879076709aefff1da
7
+ data.tar.gz: 4dabf6f9d9d274b8af89ff2122f302b63bce3a594a17d7a70466a034b87362b4d3ffbe445cc9cb1ae86dcfb63a3af8df5e303b86ad2cfd3ac6d350f155ed7609
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
- # the test suite writes to this
2
- spec/fixtures/example/docs
3
- spec/fixtures/example/docs
1
+ spec/fixtures/example/docs/concept.html.md
4
2
  tests/middleman/build
3
+ distro/
4
+ pkg/
5
+ .DS_Store
6
+ node_modules/
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+
3
+ script:
4
+ - bundle exec rake
5
+
6
+ rvm:
7
+ - '2.2.0'
8
+ - '2.1.5'
@@ -1,24 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brief (1.8.6)
4
+ brief (1.8.7)
5
5
  activemodel
6
6
  activesupport (>= 4.0)
7
7
  commander (>= 4.2.1)
8
8
  github-fs
9
+ github-markdown (~> 0.6.8)
9
10
  hashie
10
11
  inflecto
11
- nokogiri
12
- redcarpet (>= 3.2.2)
12
+ nokogiri (= 1.6.5)
13
13
  virtus (>= 1.0.3)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- activemodel (4.2.0)
19
- activesupport (= 4.2.0)
18
+ activemodel (4.2.1)
19
+ activesupport (= 4.2.1)
20
20
  builder (~> 3.1)
21
- activesupport (4.2.0)
21
+ activesupport (4.2.1)
22
22
  i18n (~> 0.7)
23
23
  json (~> 1.7, >= 1.7.7)
24
24
  minitest (~> 5.1)
@@ -45,6 +45,7 @@ GEM
45
45
  activesupport (> 3.2.0)
46
46
  octokit
47
47
  rack
48
+ github-markdown (0.6.8)
48
49
  hashie (3.4.0)
49
50
  highline (1.6.21)
50
51
  i18n (0.7.0)
@@ -55,7 +56,7 @@ GEM
55
56
  mini_portile (0.6.2)
56
57
  minitest (5.5.1)
57
58
  multipart-post (2.0.0)
58
- nokogiri (1.6.6.2)
59
+ nokogiri (1.6.5)
59
60
  mini_portile (~> 0.6.0)
60
61
  octokit (3.8.0)
61
62
  sawyer (~> 0.6.0, >= 0.5.3)
@@ -69,7 +70,6 @@ GEM
69
70
  rack-test (0.6.3)
70
71
  rack (>= 1.0)
71
72
  rake (10.4.2)
72
- redcarpet (3.2.2)
73
73
  rspec (3.1.0)
74
74
  rspec-core (~> 3.1.0)
75
75
  rspec-expectations (~> 3.1.0)
@@ -101,6 +101,7 @@ PLATFORMS
101
101
  DEPENDENCIES
102
102
  brief!
103
103
  bundler (~> 1.3)
104
+ octokit
104
105
  pry
105
106
  pry-nav
106
107
  rack-test
data/Rakefile CHANGED
@@ -1,21 +1,25 @@
1
- require "bundler/gem_tasks"
2
-
3
- #!/usr/bin/env rake
4
- begin
5
- require 'bundler/setup'
6
- rescue LoadError
7
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
- end
9
-
10
- Bundler::GemHelper.install_tasks
11
-
12
- Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+ Dir[File.join(Dir.pwd, 'tasks', '*.rake')].each { |f| load f }
13
3
 
14
- require 'rspec/core'
4
+ require "bundler/gem_tasks"
15
5
  require 'rspec/core/rake_task'
16
6
 
17
- desc "Run all specs in spec directory (excluding plugin specs)"
18
-
19
7
  RSpec::Core::RakeTask.new(:spec)
20
8
 
9
+ Distribution.configure do |config|
10
+ config.package_name = 'brief'
11
+ config.version = Brief::VERSION
12
+ config.rb_version = '20150210-2.1.5'
13
+ config.packaging_dir = File.expand_path 'packaging'
14
+ config.native_extensions = [
15
+ 'github-markdown-0.6.8',
16
+ 'escape_utils-1.0.1',
17
+ #'charlock_holmes-0.7.3',
18
+ #'posix-spawn-0.3.9',
19
+ #'nokogumbo-1.3.0',
20
+ #'rugged-0.21.4',
21
+ 'nokogiri-1.6.5',
22
+ ]
23
+ end
24
+
21
25
  task :default => :spec
@@ -11,6 +11,6 @@ class Brief::Apps::Blueprint::Page
11
11
  paragraph "p:first-of-type"
12
12
  title "h1:first-of-type", :hide => true
13
13
  tagline "h2:first-of-type", :hide => true
14
- yaml_data "code.yaml:first-of-type", :serialize => :yaml, :hide => true
14
+ yaml "pre[lang='yaml'] code:first-of-type", :serialize => :yaml, :hide => true
15
15
  end
16
16
  end
@@ -0,0 +1,14 @@
1
+ class Brief::Apps::Blueprint::Roadmap
2
+ include Brief::Model
3
+
4
+ meta do
5
+ title
6
+ subheading
7
+ end
8
+
9
+ content do
10
+ define_section "Milestones" do
11
+ each("h2").has(:title => "h2", :due_date => "li:first-of-type", :paragraph => "p:first-of-type")
12
+ end
13
+ end
14
+ end
File without changes
File without changes
data/bin/brief CHANGED
@@ -6,17 +6,17 @@ require 'rubygems'
6
6
  require 'brief'
7
7
  require 'brief/dsl'
8
8
 
9
- $briefcase = Brief::Briefcase.new(root: Dir.pwd())
10
9
 
11
10
  if ARGV[0] == "console"
12
11
  require 'pry'
12
+ $briefcase = Brief::Briefcase.new(root: Brief.pwd)
13
13
  Pry.start($briefcase)
14
14
  else
15
15
  require 'commander/import'
16
16
 
17
17
  program :name, "Brief"
18
- program :description, "Brief makes writing markdown more productive"
19
- program :version, "0.0.1"
18
+ program :description, "Brief lets you treat your markdown files like active record objects"
19
+ program :version, Brief::VERSION
20
20
 
21
21
  Brief.load_commands()
22
22
  end
@@ -25,8 +25,14 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'inflecto'
26
26
  spec.add_dependency 'activemodel'
27
27
  spec.add_dependency 'activesupport', '>= 4.0'
28
- spec.add_dependency 'redcarpet', '>= 3.2.2'
29
- spec.add_dependency 'nokogiri'
28
+ spec.add_dependency 'nokogiri', '1.6.5'
29
+
30
+ #spec.add_dependency 'github-markup', '~> 1.3.1'
31
+ #spec.add_dependency 'github-linguist', '~> 4.2.5'
32
+ #spec.add_dependency 'html-pipeline', '~> 1.11.0'
33
+ #spec.add_dependency 'sanitize', '~> 3.1.0'
34
+ spec.add_dependency 'github-markdown', '~> 0.6.8'
35
+
30
36
 
31
37
  spec.add_development_dependency "bundler", "~> 1.3"
32
38
  spec.add_development_dependency "rake"
@@ -34,7 +40,7 @@ Gem::Specification.new do |spec|
34
40
  spec.add_development_dependency "pry-nav"
35
41
  spec.add_development_dependency "rspec"
36
42
  spec.add_development_dependency "rack-test"
37
-
43
+ spec.add_development_dependency 'octokit'
38
44
  end
39
45
 
40
46
 
@@ -1,28 +1,23 @@
1
- # configuration options for this briefcase
1
+ root = Pathname(Dir.pwd)
2
+
2
3
  config do
3
- set(:models_path => Pathname(__FILE__).parent.join("models"))
4
+ # You can put any special brief configuration here
5
+ # set(models_path: root.join('models')) if root.join('models').exist?
6
+ # set(templates_path: root.join('templates')) if root.join('templates').exist?
7
+ # set(docs_path: root.join('documents')) if root.join('documents').exist?
4
8
  end
5
9
 
6
- # define a Post model
7
- define("Post") do
8
10
 
9
- # the post model will have YAML frontmatter
10
- # with values for 'status' and 'date'
11
+ define "Post" do
11
12
  meta do
12
- status
13
- date DateTime, :default => lambda {|post, attr| post.document.created_at }
13
+ title
14
+ status :in => %w(draft published)
15
+ tags Array
14
16
  end
17
+
15
18
 
16
- # the post model will have a 'title' method which returns the text
17
- # from the first h1 heading
18
19
  content do
19
- title "h1"
20
- has_many :subheadings, "h2"
21
- end
22
-
23
- actions do
24
- def publish(options={})
25
- puts "The publish action"
26
- end
20
+ title "h1:first-of-type"
21
+ subheading "h2:first-of-type"
27
22
  end
28
23
  end
@@ -0,0 +1,12 @@
1
+ ---
2
+ type: post
3
+ title: This is my first post
4
+ status: published
5
+ tags:
6
+ - default
7
+ - intro
8
+ ---
9
+
10
+ # This is my first post
11
+
12
+ I should write something clever.
@@ -5,12 +5,18 @@ require 'virtus'
5
5
  require 'inflecto'
6
6
  require 'active_support'
7
7
  require 'active_support/core_ext'
8
- require 'redcarpet'
8
+ require 'github/markdown'
9
9
  require 'nokogiri'
10
10
  require 'yaml'
11
11
  require 'erb'
12
12
 
13
13
  module Brief
14
+ # When packaging this up through the traveling ruby system
15
+ # Dir.pwd is not accurate because of the wrapper. We shim it
16
+ # by setting a special ENV variable in that file
17
+ def self.pwd
18
+ ENV.fetch('BRIEF_PWD') { Dir.pwd }
19
+ end
14
20
 
15
21
  def self.cases
16
22
  @cases ||= {}
@@ -32,16 +38,16 @@ module Brief
32
38
  Brief::Configuration.instance
33
39
  end
34
40
 
35
- def self.gem_root
41
+ def self.lib_root
36
42
  Pathname(File.dirname(__FILE__))
37
43
  end
38
44
 
39
45
  def self.apps_path
40
- gem_root.join("..","apps")
46
+ lib_root.join("..","apps")
41
47
  end
42
48
 
43
49
  def self.load_commands
44
- Dir[gem_root.join('brief', 'cli', '**/*.rb')].each { |f| require(f) }
50
+ Dir[lib_root.join('brief', 'cli', '**/*.rb')].each { |f| require(f) }
45
51
 
46
52
  # the instance methods which get defined with the helper
47
53
  Brief::Model.classes.each do |klass|
@@ -1,7 +1,7 @@
1
1
  module Brief
2
2
  class Apps
3
3
  def self.default_path
4
- Brief.gem_root.join("..","apps")
4
+ Brief.lib_root.join("..","apps")
5
5
  end
6
6
 
7
7
  def self.search_paths
@@ -94,9 +94,7 @@ module Brief
94
94
  def use(module_type=:app, module_id)
95
95
  options[:app] = module_id.to_s
96
96
 
97
- if app_path && app_path.exist?
98
- instance_eval(app_config_path.read)
99
- end
97
+ run(app_config_path) if app_path.try(&:exist?)
100
98
  end
101
99
 
102
100
  def data
@@ -132,9 +130,12 @@ module Brief
132
130
  config_path = root.join(config_path)
133
131
  end
134
132
 
135
- if config_path.exist?
136
- instance_eval(config_path.read) rescue nil
137
- end
133
+ run(config_path) if config_path.exist?
134
+ end
135
+
136
+ def run(code_or_file)
137
+ code = code_or_file.is_a?(Pathname) ? code_or_file.read : code
138
+ instance_eval(code)
138
139
  end
139
140
 
140
141
  def uses_app?
@@ -191,7 +192,7 @@ module Brief
191
192
  end
192
193
 
193
194
  def root
194
- Pathname(options.fetch(:root) { Dir.pwd })
195
+ Pathname(options.fetch(:root) { Brief.pwd })
195
196
  end
196
197
 
197
198
  def docs_path
@@ -206,7 +207,7 @@ module Brief
206
207
  value = options.fetch(:models_path) { config.models_path }
207
208
 
208
209
  if value.to_s.match(/\./)
209
- Pathname(Dir.pwd).join(value)
210
+ Pathname(Brief.pwd).join(value)
210
211
  elsif value.to_s.match(/\//)
211
212
  Pathname(value)
212
213
  else
@@ -228,5 +229,9 @@ module Brief
228
229
  super
229
230
  end
230
231
  end
232
+
233
+ def self.create_new_briefcase(options={})
234
+ Brief::Briefcase::Initializer.new(options).run
235
+ end
231
236
  end
232
237
  end
@@ -0,0 +1,64 @@
1
+ class Brief::Briefcase
2
+ class Initializer
3
+ def initialize(options={})
4
+ @options = options.to_mash
5
+ end
6
+
7
+ def run
8
+ options = @options
9
+ root = options.root
10
+
11
+ FileUtils.mkdir_p(root.join("docs","posts"))
12
+
13
+ config = "use(#{options.app})\n" if options.app
14
+
15
+ config = <<-EOF
16
+ root = Pathname(Dir.pwd)
17
+
18
+ config do
19
+ # You can put any special brief configuration here
20
+ # set(models_path: root.join('models')) if root.join('models').exist?
21
+ # set(templates_path: root.join('templates')) if root.join('templates').exist?
22
+ # set(docs_path: root.join('documents')) if root.join('documents').exist?
23
+ end
24
+ \n
25
+ define "Post" do
26
+ meta do
27
+ title
28
+ status :in => %w(draft published)
29
+ tags Array
30
+ end
31
+ \n
32
+ content do
33
+ title "h1:first-of-type"
34
+ subheading "h2:first-of-type"
35
+ end
36
+ end
37
+ EOF
38
+
39
+ example = <<-EOF
40
+ ---
41
+ type: post
42
+ title: This is my first post
43
+ status: published
44
+ tags:
45
+ - default
46
+ - intro
47
+ ---
48
+
49
+ # This is my first post
50
+
51
+ I should write something clever.
52
+ EOF
53
+
54
+ config.gsub!(/^\ {1,6}/m, '')
55
+ example.gsub!(/^\ {1,6}/m, '')
56
+
57
+ root.join("docs","posts","this-is-my-first-post.md").open("w+") {|fh| fh.write(example) }
58
+
59
+ root.join("brief.rb").open("w+") do |fh|
60
+ fh.write(config)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,69 @@
1
+ command 'change' do |c|
2
+ c.syntax = 'brief change ATTRIBUTE [OPTIONS]'
3
+ c.description = 'change attributes of brief documents'
4
+
5
+ c.option '--from VALUE', String, 'Only apply when the attributes current value matches.'
6
+ c.option '--to VALUE', String, 'Only apply when the attributes current value matches.'
7
+ c.option '--root PATH', String, 'The root directory for the briefcase'
8
+ c.option '--operator VALUE', String, 'What operator to use in matching the from value. (eq,neq,gt,gte,lt,lte). defaults: eq'
9
+ c.option '--dry-run', nil, "Don't actually save"
10
+
11
+ c.action do |args, options|
12
+ options.default(root: Pathname(Brief.pwd), operator: "eq")
13
+ attribute = args.shift
14
+ paths = args.map {|a| Dir[options.root.join(a)] }.flatten
15
+
16
+ briefcase = Brief::Briefcase.new(root: options.root)
17
+ documents = briefcase.documents_at(*paths)
18
+
19
+ if options.from
20
+ #attribute = attribute.to_sym.send(options.operator)
21
+ attribute = attribute.to_sym
22
+ documents = Brief::DocumentMapper::Query.new(documents).where({attribute => options.from}).all
23
+ end
24
+
25
+ if documents.length == 0
26
+ puts "No documents match this selection"
27
+ end
28
+
29
+ if options.dry_run
30
+ puts documents
31
+ end
32
+ end
33
+ end
34
+
35
+ command 'init' do |c|
36
+ c.syntax = 'brief init NAME [OPTIONS]'
37
+ c.description = 'Create a new brief project, aka a briefcase'
38
+
39
+ c.option '--root', String, 'The root folder for the new project.'
40
+ c.option '--app', String, 'Which existing app would you like to use?'
41
+
42
+ c.action do |args, options|
43
+ options.default :root => (args.first || Brief.pwd)
44
+
45
+ root = Pathname(options.root)
46
+
47
+ if root.join('brief.rb').exist?
48
+ puts "A Brief project already exists in this folder"
49
+ else
50
+ require 'brief/briefcase/initializer'
51
+ Brief::Briefcase.create_new_briefcase(root: root, app: options.app)
52
+ end
53
+ end
54
+ end
55
+
56
+ command 'info' do |c|
57
+ c.syntax = 'brief info'
58
+ c.description = 'View info about the brief environment'
59
+
60
+ c.action do |args, options|
61
+ # traveling ruby is reporting this incorrectly
62
+ puts "\n-- Paths:"
63
+ puts "Dir.pwd = #{ Dir.pwd }"
64
+ puts "Brief.pwd = #{ Brief.pwd }"
65
+
66
+ puts "\n-- Available apps:"
67
+ puts Brief::Apps.available_apps.join("\n")
68
+ end
69
+ end