adva-static 0.0.8 → 0.0.9

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.
@@ -18,13 +18,15 @@ module Adva
18
18
  }
19
19
 
20
20
  def initialize(app, options = {})
21
+ options.reject! { |key, value| value.blank? }
21
22
  @options = options.reverse_merge!(DEFAULT_OPTIONS)
22
23
 
23
24
  @app = app
24
25
  @store = Store.new(target)
25
26
  @queue = Queue.new
26
27
 
27
- queue.push(options[:queue] || Path.new('/'))
28
+ roots = config[:roots] || %w(/)
29
+ queue.push(*roots.map { |path| Path.new(path) })
28
30
 
29
31
  FileUtils.rm_r(Dir[target.join('*')])
30
32
  end
@@ -46,9 +48,7 @@ module Adva
46
48
  end
47
49
 
48
50
  def copy_assets
49
- %w(images javascripts stylesheets).each do |dir|
50
- FileUtils.cp_r(source.join(dir), target.join(dir)) if source.join(dir).exist?
51
- end
51
+ Dir[source.join('*')].each { |file| FileUtils.cp_r(file, target.join(file.gsub("#{source}/", ''))) }
52
52
  end
53
53
 
54
54
  def process(path)
@@ -99,6 +99,12 @@ module Adva
99
99
  store.write(config, File.read(File.expand_path('../export/templates/config.ru', __FILE__)))
100
100
  end
101
101
  end
102
+
103
+ def config
104
+ YAML.load_file(options[:config] || Rails.root.join('config/static.yml')).symbolize_keys
105
+ rescue
106
+ {}
107
+ end
102
108
  end
103
109
  end
104
110
  end
@@ -36,6 +36,7 @@ module Adva
36
36
  namespace 'adva:static:export'
37
37
  desc 'Export a static version of a site'
38
38
  class_option :target, :required => false
39
+ class_option :config, :required => false
39
40
 
40
41
  def export
41
42
  require 'config/environment'
@@ -48,6 +49,7 @@ module Adva
48
49
  desc 'Import and export a static version of a site'
49
50
  class_option :source, :required => false
50
51
  class_option :target, :required => false
52
+ class_option :config, :required => false
51
53
 
52
54
  def export
53
55
  require 'config/environment'
@@ -1,3 +1,3 @@
1
1
  module AdvaStatic
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-static
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-13 00:00:00 +01:00
18
+ date: 2011-02-28 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements: []
145
145
 
146
146
  rubyforge_project: "[none]"
147
- rubygems_version: 1.5.0
147
+ rubygems_version: 1.4.2
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: Static engine for adva-cms2