benofsky-bolt 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bolt.rb CHANGED
@@ -40,7 +40,7 @@ module Bolt
40
40
  # a bolt project and saving all files into the "out" directory.
41
41
  def build
42
42
  require 'bolt/build'
43
- Build.new($config).run
43
+ Build.new().run
44
44
  end
45
45
 
46
46
  # Parses command line options
@@ -48,8 +48,8 @@ module Bolt
48
48
  $config.resources = "resources"
49
49
  $config.lib = "lib"
50
50
  $config.views = "views"
51
- $config.pages = "pages"
52
51
  $config.out = "out"
52
+ $config.pages = "pages"
53
53
  $config.config = "config.yml"
54
54
 
55
55
  opts = OptionParser.new do |opts|
data/lib/bolt/base.rb CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  require 'fileutils'
10
10
 
11
+ # Deprecated library in Ruby 1.9
11
12
  require 'ftools' if RUBY_VERSION.to_f <= 1.8
12
13
 
13
14
  $BOLT_BASE = File.dirname(__FILE__) + "/../../"
@@ -23,7 +24,7 @@ module Bolt
23
24
  # Creates a directory, prefixes $config.base_dir if required
24
25
  def create_directory(directory, options = {})
25
26
  options[:error_if_exists] = (options[:error_if_exists].nil?) ? true : options[:error_if_exists]
26
- directory = d(directory) if options[:base_dir].nil?
27
+ directory = directory
27
28
 
28
29
  if File.directory?(directory)
29
30
  raise ArgumentError, "#{directory} exists already." if options[:error_if_exists]
@@ -35,7 +36,7 @@ module Bolt
35
36
 
36
37
  # Forces removal of directory, <tt>directory</tt>
37
38
  def remove_directory(directory)
38
- directory = d(directory)
39
+ directory = directory
39
40
  FileUtils.rm_rf(directory)
40
41
  puts "Removed #{directory}"
41
42
  end
data/lib/bolt/build.rb CHANGED
@@ -16,9 +16,17 @@ require 'bolt/view'
16
16
  module Bolt
17
17
  class Build < Base
18
18
  # Performs all the nessecary steps to build a Bolt project
19
+ def initialize()
20
+ if $config.out
21
+ puts $config.out
22
+ else
23
+ $config.out = d("out")
24
+ end
25
+ end
26
+
19
27
  def run
20
- remove_directory("out")
21
- create_directory("out", :error_if_exists => false)
28
+ remove_directory($config.out)
29
+ create_directory($config.out, :error_if_exists => false)
22
30
  copy_resources
23
31
  parse_config
24
32
  load_pages
@@ -26,8 +34,8 @@ module Bolt
26
34
 
27
35
  # Copies the contents of $config.resources to the out directory
28
36
  def copy_resources
29
- FileUtils.cp_r(Dir.glob("#{d($config.resources)}/*"), d($config.out))
30
- puts "Copied #{d($config.resources)} to #{d($config.out)}"
37
+ FileUtils.cp_r(Dir.glob("#{d($config.resources)}/*"), $config.out)
38
+ puts "Copied #{d($config.resources)} to #{$config.out}"
31
39
  end
32
40
 
33
41
  # Parses $config.config and loads all contents into instance variables
data/lib/bolt/page.rb CHANGED
@@ -27,7 +27,7 @@ def page(path)
27
27
  @current_page = path
28
28
  create_path(path)
29
29
 
30
- path = "#{$config.base_dir}#{$config.out}/#{path}.html"
30
+ path = "#{$config.out}/#{path}.html"
31
31
  File.open(path, 'w') {|f| f.write yield}
32
32
  puts "Created #{path}"
33
33
  end
@@ -36,7 +36,7 @@ private
36
36
  def create_path(path)
37
37
  path = path.split('/')
38
38
  if path.count > 1
39
- path = "#{$config.base_dir}#{$config.out}/#{path[0..path.length-2].join('/')}"
39
+ path = "#{$config.out}/#{path[0..path.length-2].join('/')}"
40
40
  if !File.directory?(path)
41
41
  FileUtils.mkdir_p(path)
42
42
  puts "Created #{path}"
data/lib/bolt/view.rb CHANGED
@@ -7,9 +7,9 @@
7
7
  #
8
8
 
9
9
  def u(path)
10
- path + ".html"
10
+ path + ".html"
11
11
  end
12
12
 
13
13
  def anchor(path)
14
- "#" + path
14
+ "#"+path
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benofsky-bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McRedmond