Module: Cloudpress
- Defined in:
- lib/cloudpress.rb,
lib/cloudpress/engine.rb,
lib/cloudpress/version.rb,
app/models/cloudpress/post.rb,
lib/cloudpress/dropbox/file.rb,
lib/cloudpress/renderers/tag.rb,
app/models/cloudpress/archive.rb,
lib/cloudpress/dropbox/client.rb,
lib/cloudpress/renderers/post.rb,
lib/cloudpress/renderers/tags.rb,
lib/cloudpress/dropbox/cleaner.rb,
lib/cloudpress/renderers/flash.rb,
lib/cloudpress/renderers/posts.rb,
lib/cloudpress/dropbox/connector.rb,
lib/cloudpress/dropbox/directory.rb,
lib/cloudpress/renderers/archive.rb,
lib/cloudpress/renderers/archives.rb,
app/jobs/cloudpress/update_posts_job.rb,
app/helpers/cloudpress/renderer_helper.rb,
app/controllers/cloudpress/tags_controller.rb,
app/controllers/cloudpress/posts_controller.rb,
app/controllers/cloudpress/archives_controller.rb,
app/controllers/cloudpress/application_controller.rb,
app/controllers/cloudpress/drafts/posts_controller.rb,
lib/generators/cloudpress/initializer/initializer_generator.rb
Defined Under Namespace
Modules: Drafts, Dropbox, RendererHelper, Renderers
Classes: ApplicationController, Archive, ArchivesController, Engine, InitializerGenerator, Post, PostsController, TagsController, UpdatePostsJob
Constant Summary
collapse
- VERSION =
"0.1.6"
Class Method Summary
collapse
Class Method Details
.base_path ⇒ Object
52
53
54
|
# File 'lib/cloudpress.rb', line 52
def base_path
"/#{config.base_path}"
end
|
.config ⇒ Object
33
34
35
|
# File 'lib/cloudpress.rb', line 33
def config
@config ? @config : configure
end
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/cloudpress.rb', line 37
def configure &block
@config = ActiveSupport::OrderedOptions.new
@config.app_key = nil
@config.app_secret = nil
@config.app_token = nil
@config.base_path = 'cloudpress'
@config.live_path = 'live'
@config.draft_path = 'draft'
@config.draft_user = nil
@config.draft_password = nil
@config.markdown_renderer = Redcarpet::Markdown.new(Formatters::HTMLWithPygments, fenced_code_blocks: true)
yield(@config) if block_given?
@config
end
|
.draft_auth_credentials ⇒ Object
93
94
95
96
97
98
|
# File 'lib/cloudpress.rb', line 93
def draft_auth_credentials
@draft_auth_credentials ||= {
name: config.draft_user,
password: config.draft_password
}
end
|
.draft_path ⇒ Object
64
65
66
|
# File 'lib/cloudpress.rb', line 64
def draft_path
[base_path, config.draft_path].join('/')
end
|
.import! ⇒ Object
74
75
76
|
# File 'lib/cloudpress.rb', line 74
def import!
file_index.values.each {|x| x.import!}
end
|
.live_path ⇒ Object
60
61
62
|
# File 'lib/cloudpress.rb', line 60
def live_path
[base_path, config.live_path].join('/')
end
|
.local_paths ⇒ Object
116
117
118
|
# File 'lib/cloudpress.rb', line 116
def local_paths
Cloudpress::Post.pluck(:file_path)
end
|
.protect_drafts? ⇒ Boolean
89
90
91
|
# File 'lib/cloudpress.rb', line 89
def protect_drafts?
draft_auth_credentials.keys.compact.any?
end
|
.reload! ⇒ Object
56
57
58
|
# File 'lib/cloudpress.rb', line 56
def reload!
@file_index = nil
end
|
.remote_paths ⇒ Object
112
113
114
|
# File 'lib/cloudpress.rb', line 112
def remote_paths
file_index.values.map {|x| x.paths }.flatten
end
|
.unauthorized? ⇒ Boolean
108
109
110
|
# File 'lib/cloudpress.rb', line 108
def unauthorized?
config.app_token.blank?
end
|
104
105
106
|
# File 'lib/cloudpress.rb', line 104
def unconfigured?
config.app_key.blank? || config.app_secret.blank?
end
|
.update! ⇒ Object
68
69
70
71
72
|
# File 'lib/cloudpress.rb', line 68
def update!
reload!
import!
purge!
end
|