Class: Publish::PublishReplication
- Inherits:
-
Hobix::BasePublish
- Object
- Hobix::BasePlugin
- Hobix::BasePublish
- Publish::PublishReplication
- Defined in:
- lib/hobix/publish/replicate.rb
Instance Attribute Summary collapse
-
#production ⇒ Object
readonly
Returns the value of attribute production.
-
#replicator ⇒ Object
readonly
Returns the value of attribute replicator.
-
#weblog ⇒ Object
readonly
Returns the value of attribute weblog.
Instance Method Summary collapse
-
#initialize(blog, hash_opt) ⇒ PublishReplication
constructor
A new instance of PublishReplication.
- #publish(page_name) ⇒ Object
- #watch ⇒ Object
Methods inherited from Hobix::BasePlugin
Constructor Details
#initialize(blog, hash_opt) ⇒ PublishReplication
Returns a new instance of PublishReplication.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/hobix/publish/replicate.rb', line 48 def initialize( blog, hash_opt ) @weblog = blog hash_opt['items'] = nil hash_opt['source'] = weblog.output_path if ENV['HOBIX_ENV'] == "production" @production = true # # Change link if a production one is given # blog.link = hash_opt['production_link'] || blog.link else @production = false end if hash_opt['target'] =~ /^ftp:\/\/([^:]+):([^@]+)@([^\/]+)(\/.*)$/ tgt = Target.new($4,$3,$1,$2) @replicator = ReplicateFtp::new(hash_opt, tgt) else # # File replication # tgt = Target.new(hash_opt['target']) @replicator = ReplicateFS.new(hash_opt, tgt) end end |
Instance Attribute Details
#production ⇒ Object (readonly)
Returns the value of attribute production.
46 47 48 |
# File 'lib/hobix/publish/replicate.rb', line 46 def production @production end |
#replicator ⇒ Object (readonly)
Returns the value of attribute replicator.
46 47 48 |
# File 'lib/hobix/publish/replicate.rb', line 46 def replicator @replicator end |
#weblog ⇒ Object (readonly)
Returns the value of attribute weblog.
46 47 48 |
# File 'lib/hobix/publish/replicate.rb', line 46 def weblog @weblog end |
Instance Method Details
#publish(page_name) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/hobix/publish/replicate.rb', line 81 def publish( page_name ) return unless production replicator.items = weblog.updated_pages.map { |o| o.link } replicator.copy do |nb,f,src,tgt| puts "## Replicating #{src}" end end |
#watch ⇒ Object
77 78 79 |
# File 'lib/hobix/publish/replicate.rb', line 77 def watch ['index'] end |