dimples 10.7.0 → 10.7.2

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
  SHA256:
3
- metadata.gz: 4b5c714d45ca9e2ea1acc71d9cd7f4ce61baf15da289780e3bcca06195f7688d
4
- data.tar.gz: 347fce125c6cae601b18d6becd20715203f1ebe98ffb265300eb1a5bfc0fc371
3
+ metadata.gz: 4b348602f3096e0062a5bfe4a1a69c7396e28e06fb505b86e6f265418b31ae1e
4
+ data.tar.gz: 2335b720796fdbd545f0ca7813f720de50ad6cf39f6aabf9a624f26cf569707c
5
5
  SHA512:
6
- metadata.gz: f9086e486dc0a12e6ec28a526382f806dc338c45852ffb3226e571d135c2d1520662c8d49127076646edc416fef4a0cd68009410a8709631436fe53e5d31f654
7
- data.tar.gz: 7481579f5ad52500f7085e1ce28a8f158066baf38fbe292c0cf903cbf2ca2f94dae23fb5e9336cdfc643e931c98a7bc554d4d2c598a62d6444dfd95c141e4ec3
6
+ metadata.gz: 907c0fec40c9bbd9f2b572021008f30cfa8e37a5c07a696eafdc9c7f4f45328e07ce05945be9806bc0df6dc9c67b090688a73918645df5b7d46390f10c9fc37b
7
+ data.tar.gz: 9ad1d9698bd51ca77010a172e4901887f919a724285b20b0e451f11d33742aada0442aacb66f3ecd6e338ab195794dab40773be208131744188171892d8099c8
data/bin/dimples CHANGED
@@ -4,6 +4,7 @@
4
4
  $LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
5
5
 
6
6
  require 'dimples'
7
+ require 'optparse'
7
8
  require 'yaml'
8
9
 
9
10
  config_path = File.join(Dir.pwd, 'config.yml')
@@ -17,6 +18,14 @@ if File.exist?(config_path)
17
18
  end
18
19
  end
19
20
 
21
+ OptionParser.new do |parser|
22
+ parser.banner = "Usage: dimples [options]"
23
+
24
+ parser.on("-o [path]", "--output-path [path]", String, "The directory where your site will be generated") do |option|
25
+ config[:build] = option unless option.nil?
26
+ end
27
+ end.parse!
28
+
20
29
  begin
21
30
  Dimples::Site.generate(config: config)
22
31
  rescue StandardError => e
@@ -15,10 +15,10 @@ module Dimples
15
15
  def self.defaults
16
16
  {
17
17
  source: Dir.pwd,
18
- build: './site',
18
+ build: File.expand_path(File.join(Dir.pwd, 'site')),
19
19
  pathnames: { posts: 'posts', categories: 'categories' },
20
20
  pagination: { page_prefix: 'page_', per_page: 5 },
21
- generation: { main_feed: true, category_feeds: false }
21
+ generation: { main_feed: true, category_feeds: false, overwrite_existing_site: false }
22
22
  }
23
23
  end
24
24
 
data/lib/dimples/site.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'date'
3
4
  require 'fileutils'
4
5
  require 'tilt'
5
- require 'date'
6
6
  require 'yaml'
7
7
 
8
8
  module Dimples
@@ -111,10 +111,14 @@ module Dimples
111
111
 
112
112
  def prepare_output_directory
113
113
  if Dir.exist?(@config.build_paths[:root])
114
- raise "The site directory (#{@config.build_paths[:root]}) already exists."
115
- end
114
+ unless @config.generation[:overwrite_existing_site]
115
+ raise "The site directory (#{@config.build_paths[:root]}) already exists."
116
+ end
116
117
 
117
- Dir.mkdir(@config.build_paths[:root])
118
+ FileUtils.rm_rf(File.join(@config.build_paths[:root], '**', '*'), secure: true)
119
+ else
120
+ Dir.mkdir(@config.build_paths[:root])
121
+ end
118
122
  end
119
123
 
120
124
  def copy_assets
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '10.7.0'
4
+ VERSION = '10.7.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.7.0
4
+ version: 10.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubygems_version: 3.6.7
92
+ rubygems_version: 3.7.2
93
93
  specification_version: 4
94
94
  summary: A basic static site generator
95
95
  test_files: []