Module: Ro

Extended by:
Methods
Defined in:
lib/ro.rb,
lib/ro/_lib.rb,
lib/ro/html.rb,
lib/ro/node.rb,
lib/ro/path.rb,
lib/ro/root.rb,
lib/ro/slug.rb,
lib/ro/text.rb,
lib/ro/asset.rb,
lib/ro/error.rb,
lib/ro/klass.rb,
lib/ro/model.rb,
lib/ro/config.rb,
lib/ro/script.rb,
lib/ro/methods.rb,
lib/ro/migrator.rb,
lib/ro/template.rb,
lib/ro/collection.rb,
lib/ro/pagination.rb,
lib/ro/script/server.rb,
lib/ro/script/builder.rb,
lib/ro/script/console.rb,
lib/ro/script/migrate.rb,
lib/ro/collection/list.rb,
lib/ro/template/rouge_formatter.rb

Defined Under Namespace

Modules: Klass, Methods, Pagination, Text Classes: Asset, Collection, Config, Error, HTML, Migrator, Model, Node, Path, Root, Script, Slug, Template

Constant Summary collapse

VERSION =
'5.2.0'

Constants included from Methods

Methods::DEFAULT_IMAGE_EXTENSIONS, Methods::DEFAULT_IMAGE_PATTERNS, Methods::EXPAND_ASSET_URL_STRATEGIES

Instance Attribute Summary

Attributes included from Methods

#logger

Class Method Summary collapse

Methods included from Methods

accurate_expand_asset_urls, cast, casts, debug!, emsg, error!, expand_asset_url_strategies, expand_asset_urls, expand_asset_values, expand_asset_values!, image_info, image_pattern, image_patterns, is_image?, log, log!, mapify, normalize_url, pod, query_string_for, render, render_src, sloppy_expand_asset_urls, template, url_for, uuid

Class Method Details

.collectionsObject



18
19
20
# File 'lib/ro.rb', line 18

def collections
  root.collections
end

.configObject



57
58
59
# File 'lib/ro.rb', line 57

def config
  @config ||= Config.new
end

.defaultsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ro.rb', line 43

def defaults
  Map.for({
    :root      => './public/ro',
    :build     => './public/api/ro',
    :url       => "/ro",
    :img_url   => "/ro",
    :page_size => 42,
    :log       => nil,
    :debug     => nil,
    :port      => 4242,
    :md_theme  => 'github',
  })
end

.dependenciesObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ro/_lib.rb', line 35

def dependencies
  {
    'map' =>
      ['map', '~> 6.6', '>= 6.6.0'],

    'kramdown' =>
      ['kramdown', '~> 2.4', ' >= 2.4.0'],

    'kramdown-parser-gfm' =>
      ['kramdown-parser-gfm', '~> 1.1', ' >= 1.1.0'],

    'rouge' =>
      ['rouge', '~> 4.1', ' >= 4.1.1'],

    'front_matter_parser' =>
      ['front_matter_parser', '~> 1.0'],

    'rinku' =>
      ['rinku', '~> 2.0'],

    #'ak47' =>
      #['ak47', '~> 0.2'],

    #'webrick' =>
      #['webrick', '~> 1.9.1'],

    'image_size' =>
      ['image_size', '~> 3.4'],

    'nokogiri' =>
      ['nokogiri', '~> 1'],
  }
end

.descriptionObject



19
20
21
22
23
24
25
26
27
# File 'lib/ro/_lib.rb', line 19

def description
  "    the worlds tiniest, bestest, most minmialist headless cms - powered by github\n\n    ro is a minimalist toolkit for managing heterogeneous collections of rich web\n    content on github, and providing both programatic and api access to it with zero\n    heavy lifting\n  ____\nend\n"

.envObject

config | v



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ro.rb', line 29

def env
  Map.for({
    :root      => ENV['RO_ROOT'],
    :build     => ENV['RO_BUILD'],
    :url       => ENV['RO_URL'],
    :img_url   => ENV['RO_IMG_URL'],
    :page_size => ENV['RO_PAGE_SIZE'],
    :log       => ENV['RO_LOG'],
    :debug     => ENV['RO_DEBUG'],
    :port      => ENV['RO_PORT'],
    :md_theme  => ENV['RO_MD_THEME'],
  })
end

.initialize!Object

ro init | v



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/ro.rb', line 64

def initialize!
  Ro.load %w[
    html.rb
    error.rb
    klass.rb
    slug.rb
    path.rb
    text.rb
    template.rb
    methods.rb
    config.rb
    root.rb
    collection.rb
    collection/list.rb
    node.rb
    asset.rb
    migrator.rb
  ]

  if defined?(ActiveModel)
    Ro.load %w[
      model.rb
    ]
  end

  Ro.log! if Ro.config.log
  Ro.debug! if Ro.config.debug
end

.libdir(*args, &block) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/ro/_lib.rb', line 69

def libdir(*args, &block)
  @libdir ||= File.dirname(File.expand_path(__FILE__))
  args.empty? ? @libdir : File.join(@libdir, *args)
ensure
  if block
    begin
      $LOAD_PATH.unshift(@libdir)
      block.call
    ensure
      $LOAD_PATH.shift
    end
  end
end

.libsObject



29
30
31
32
33
# File 'lib/ro/_lib.rb', line 29

def libs
  %w[
    fileutils pathname yaml json logger erb cgi uri time date thread securerandom
  ]
end

.load(*libs) ⇒ Object



83
84
85
86
# File 'lib/ro/_lib.rb', line 83

def load(*libs)
  libs = libs.join(' ').scan(/[^\s+]+/)
  libdir { libs.each { |lib| Kernel.load(lib) } }
end

.load_dependencies!Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/ro/_lib.rb', line 88

def load_dependencies!
  libs.each do |lib|
    require lib
  end

  begin
    require 'rubygems'
  rescue LoadError
    nil
  end

  has_rubygems = defined?(gem)

  dependencies.each do |lib, dependency|
    gem(*dependency) if has_rubygems
    require(lib)
  end
end

.nodesObject



22
23
24
# File 'lib/ro.rb', line 22

def nodes
  root.nodes
end

.repoObject



9
10
11
# File 'lib/ro/_lib.rb', line 9

def repo
  'https://github.com/ahoward/ro'
end

.rootObject

top-level | v



10
11
12
# File 'lib/ro.rb', line 10

def root
  Ro.config.root
end

.root=(root) ⇒ Object



14
15
16
# File 'lib/ro.rb', line 14

def root=(root)
  Ro.config.root = root
end

.script(*args, &block) ⇒ Object



2
3
4
# File 'lib/ro/script.rb', line 2

def self.script(*args, &block)
  Script.run!(*args, &block)
end

.summaryObject



13
14
15
16
17
# File 'lib/ro/_lib.rb', line 13

def summary
  "    all your content in github, as god intended\n  ____\nend\n"

.versionObject



5
6
7
# File 'lib/ro/_lib.rb', line 5

def version
  VERSION
end