middleman-navtree 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTNhZGU3MjU2YmRkZmMzMWNkMGI2N2Q2NDNhYjFlZmJkYjhhYjQxZA==
4
+ NjY4ZjAzZDIyMGM1MzNmODJhZGQ2ZGM1NWVlMzNjZGRkODdiYzBhNg==
5
5
  data.tar.gz: !binary |-
6
- MGNlNTYxYTg1MzZkN2FjZmE3NDEyM2NlNDUxZTViMjU2MzgzOGMxNQ==
6
+ NWIzNDFlYzBlOTAzOGY3N2FmZWJkODZhYWU2YTE0ZDIxODBhODI5Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzViNmVhMDU1NmY2OWU4MzFiMzJkZjg1YTFiYTgyYTM4ZGY1NDUzMDQxNWYx
10
- YzM2OTcwNTc0NjEwZmY4ZTUyZTgzNWJlMTg4ZDRjOWE2ZWZhNWVkOTE0MDc1
11
- N2UzMDRlOWZjNjQ3YzM1NzZhZGRhM2JjYTllYmEwZjUyMmE3MzI=
9
+ YTZhOWU5Yzg3ZTAxOTc2MWJhMWEyNDFhZmQ4MjkwYjI2YzgxYWY0NTcxODE5
10
+ YTk4NjUyN2U5OTJkZTQ0YjlkNmMwNmVhNzZhMTIzNjk5YWFiZjBiNGFhZDJm
11
+ YmZmZjE3ZDdjOWUxYjY4MmVhYTAyZDYzYmU0YzJiNjM3M2EzMjg=
12
12
  data.tar.gz: !binary |-
13
- MmJmNjQyZTMzMGJhNjRmYmMzMzFkZDY1MmQ5OGY1ZmVkZDk0YzY5YmQzODYz
14
- YTczZmViYzQ2MmU2YWM0OTE1ZjA4ZDBjZjNjZDM4MmYwODgxZDYwNzAyNTE4
15
- YzkzMzM2MGIzM2JhMmY1NDE5OWQzOGU1OGYwOWZjYzdlNWQ5N2E=
13
+ NjVkNTM0MDQ2YzAyM2Q5YWRlM2RmNjI1MTk2YzBhZjdmYWIzMWU3ZGVjMThi
14
+ YjhkZGQwNTYwN2UyYzE1Y2ExMjhiODg5ZjdkMDNmMDUxNzkxOTNlNjk5NTk5
15
+ MTdkMGEyMzE0OTYxMjg4M2U3NGZkODJjMWY1N2ZmNzc5MWJhNDM=
data/README.md CHANGED
@@ -21,7 +21,6 @@ Alternatively, you can specify the options you want. Here's an example showing t
21
21
  activate :navtree do |options|
22
22
  options.data_file = 'tree.yml' # The data file where our navtree is stored.
23
23
  options.automatic_tree_updates = true # The tree.yml file will be updated automatically when source files are changed.
24
- options.source_dir = 'source' # The `source` directory we want to represent in our nav tree.
25
24
  options.ignore_files = ['sitemap.xml', 'robots.txt'] # An array of files we want to ignore when building our tree.
26
25
  options.ignore_dir = ['assets'] # An array of directories we want to ignore when building our tree.
27
26
  options.home_title = 'Home' # The default link title of the home page (located at "/"), if otherwise not detected.
@@ -8,7 +8,7 @@ module Middleman
8
8
  # @todo: Test the extension against a middleman-blog install.
9
9
  class NavTreeExtension < ::Middleman::Extension
10
10
  # All the options for this extension
11
- option :source_dir, 'source', 'The directory our tree will begin at.'
11
+ option :source_dir, 'source', 'The directory our tree will begin at.' # This setting does nothing but remains listed for backwards compatibility.
12
12
  option :data_file, 'tree.yml', 'The file we will write our directory tree to.'
13
13
  option :automatic_tree_updates, true, 'The tree.yml file will be updated automatically when source files are changed.'
14
14
  option :ignore_files, ['sitemap.xml', 'robots.txt'], 'A list of filenames we want to ignore when building our tree.'
@@ -44,7 +44,7 @@ module Middleman
44
44
  options.ignore_dir << app.settings.partials_dir
45
45
 
46
46
  # Build a hash out of our directory information
47
- tree_hash = scan_directory(options.source_dir, options)
47
+ tree_hash = scan_directory(app.settings.source, options)
48
48
 
49
49
  # Promote any promoted files to the beginning of our hash.
50
50
  tree_hash = promote_files(tree_hash, options)
@@ -53,6 +53,8 @@ module Middleman
53
53
  # @todo: This step doesn't rebuild during live-reload, which causes errors if you move files
54
54
  # around during development. It may not be that hard to set up. Low priority though.
55
55
  if options.automatic_tree_updates
56
+ FileUtils.mkdir_p(app.settings.data_dir)
57
+
56
58
  data_path = app.settings.data_dir + '/' + options.data_file
57
59
  IO.write(data_path, YAML::dump(tree_hash))
58
60
  end
@@ -73,7 +75,7 @@ module Middleman
73
75
  next if options.ignore_files.include? filename
74
76
 
75
77
  if options.promote_files.include? filename
76
- original_path = path.sub(/^#{options.source_dir}/, '') + '/' + filename
78
+ original_path = path.sub(/^#{app.settings.source}/, '') + '/' + filename
77
79
  @existing_promotes << original_path
78
80
  next
79
81
  end
@@ -94,7 +96,7 @@ module Middleman
94
96
  next unless options.ext_whitelist.include? File.extname(filename)
95
97
  end
96
98
 
97
- original_path = path.sub(/^#{options.source_dir}/, '') + '/' + filename
99
+ original_path = path.sub(/^#{app.settings.source}/, '') + '/' + filename
98
100
  data.store(filename.gsub(' ', '%20'), original_path.gsub(' ', '%20'))
99
101
  end
100
102
  end
@@ -144,4 +146,4 @@ module Middleman
144
146
 
145
147
  end
146
148
  end
147
- end
149
+ end
@@ -142,4 +142,4 @@ module Middleman
142
142
 
143
143
  end
144
144
  end
145
- end
145
+ end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module NavTree
3
- VERSION = "0.1.9"
3
+ VERSION = "0.1.10"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "middleman-navtree"
6
- s.version = "0.1.9"
6
+ s.version = "0.1.10"
7
7
  s.licenses = ['MIT']
8
8
  s.date = Date.today.to_s
9
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-navtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Braun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-02 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core