ro 1.1.1 → 1.2.0

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.
data/lib/ro/root.rb CHANGED
@@ -26,5 +26,27 @@ module Ro
26
26
  def node_directories(&block)
27
27
  Dir.glob(File.join(root, '*/*/'), &block)
28
28
  end
29
+
30
+ def git
31
+ @git ||= Git.new(self)
32
+ end
33
+
34
+ def patch(*args, &block)
35
+ git.patch(*args, &block)
36
+ end
37
+
38
+ def dotdir
39
+ File.join(self, '.ro')
40
+ end
41
+
42
+ def lockpath
43
+ File.join(dotdir, 'lock')
44
+ end
45
+
46
+ def lock(&block)
47
+ FileUtils.mkdir_p(File.dirname(lockpath))
48
+ @lock ||= Lock.new(lockpath)
49
+ block ? @lock.lock(&block) : @lock
50
+ end
29
51
  end
30
52
  end
data/lib/ro/slug.rb CHANGED
@@ -8,6 +8,7 @@ module Ro
8
8
  string = args.flatten.compact.join(join)
9
9
  string = unidecode(string)
10
10
  words = string.to_s.scan(%r|[/\w]+|)
11
+ words.map!{|word| word.gsub %r|[_-]|, join}
11
12
  words.map!{|word| word.gsub %r|[^/0-9a-zA-Z_-]|, ''}
12
13
  words.delete_if{|word| word.nil? or word.strip.empty?}
13
14
  new(words.join(join).downcase.gsub('/', (join * 2)))
data/lib/ro/template.rb CHANGED
@@ -14,11 +14,18 @@ module Ro
14
14
  case ext.to_s.downcase
15
15
  when 'erb', 'eruby'
16
16
  content = Ro.erb(content, node)
17
+
17
18
  when 'yml'
18
19
  content = YAML.load(content)
20
+
19
21
  else
20
- tilt = Tilt[ext].new{ content }
21
- content = tilt.render(node)
22
+ tilt = Tilt[ext] || Tilt['txt']
23
+
24
+ if tilt.nil?
25
+ content
26
+ else
27
+ content = tilt.new{ content }.render(node)
28
+ end
22
29
  end
23
30
  end
24
31
 
@@ -39,7 +46,12 @@ module Ro
39
46
  if exts.empty?
40
47
  code = content
41
48
  language = ext
42
- content = ::Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'})
49
+ content =
50
+ begin
51
+ ::Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'})
52
+ rescue
53
+ content
54
+ end
43
55
  else
44
56
  case ext.to_s.downcase
45
57
  when 'erb', 'eruby'
data/notes/ara.txt CHANGED
@@ -1,4 +1,123 @@
1
+
2
+
3
+ - nodes have fields
4
+ - fields know from whence them came
5
+
6
+ - how to paginate collections
7
+
8
+ Source.all.page(2).per(10)
9
+
10
+ - find by name/slug
11
+
12
+ Source.find(name)
13
+
14
+ source.save(message)
15
+
16
+ editing...
17
+
18
+
19
+
1
20
  todo:
21
+
22
+ - nodes can be edited
23
+ - assume git
24
+ - know from whence all data came
25
+ - @loaded[path] => key
26
+ -
27
+ maybe just node.save!(message)
28
+
29
+ loop do
30
+
31
+ # commit
32
+ git add --all .
33
+ git commit -m message -- .
34
+
35
+ git reset --hard OR git checkout -f
36
+ retry
37
+
38
+ end
39
+
40
+
41
+
42
+ loop
43
+
44
+ git push
45
+
46
+ git pull
47
+
48
+ # publish
49
+ git checkout --ours -- .
50
+ git add --all .
51
+ git commit -F .git/MERGE_MSG
52
+ git push
53
+
54
+ end
55
+
56
+
57
+ - ./assets
58
+
59
+ - @attributes, @sources, @urls
60
+
61
+
62
+ - ro::model
63
+
64
+ class Post < Ro::Model
65
+ root 'ro'
66
+
67
+ directory 'posts'
68
+
69
+ attributes(
70
+ )
71
+
72
+ files(
73
+ 'bio.md.erb'
74
+ )
75
+
76
+ assets(
77
+ 'logo.jpg'
78
+ )
79
+
80
+ sources(
81
+ 'a.rb'
82
+ )
83
+
84
+ schema {
85
+
86
+ attribute :first_name
87
+ attribute :last_name
88
+
89
+ template 'bio.html.erb'
90
+
91
+ }
92
+
93
+ :attributes => {
94
+ :first_name => nil,
95
+ },
96
+
97
+ 'templates' => {
98
+ 'bio.html.erb'
99
+ },
100
+
101
+ assets
102
+ )
103
+
104
+ def Post.find(*args)
105
+ end
106
+
107
+ def Post.where(*args)
108
+ end
109
+
110
+ def save
111
+ saved = (
112
+ save_attributes &&
113
+ save_files &&
114
+ save_assets &&
115
+ save_sources
116
+ commit
117
+ )
118
+ end
119
+ end
120
+
2
121
  - helper/model extension ?
3
122
 
4
123
  Ro.helper(:posts) do
data/ro.gemspec CHANGED
@@ -3,64 +3,32 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "ro"
6
- spec.version = "1.1.1"
6
+ spec.version = "1.2.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "ro"
9
9
  spec.description = "description: ro kicks the ass"
10
10
  spec.license = "Same As Ruby's"
11
11
 
12
12
  spec.files =
13
- [":",
14
- ":w",
15
- "=p",
16
- "README.md",
13
+ ["README.md",
17
14
  "Rakefile",
18
- "bin",
15
+ "TODO.md",
19
16
  "bin/ro",
20
- "lib",
21
- "lib/co",
22
- "lib/co/db.rb",
23
- "lib/co/node",
24
- "lib/co/node.rb",
25
- "lib/co/node/list.rb",
26
- "lib/co/util.rb",
27
- "lib/lib",
28
- "lib/ro",
29
17
  "lib/ro.rb",
30
18
  "lib/ro/blankslate.rb",
31
19
  "lib/ro/cache.rb",
32
- "lib/ro/db",
33
- "lib/ro/db/collection",
34
- "lib/ro/initializers",
20
+ "lib/ro/git.rb",
35
21
  "lib/ro/initializers/env.rb",
36
22
  "lib/ro/initializers/tilt.rb",
37
- "lib/ro/node",
23
+ "lib/ro/lock.rb",
24
+ "lib/ro/model.rb",
38
25
  "lib/ro/node.rb",
39
26
  "lib/ro/node/list.rb",
40
27
  "lib/ro/root.rb",
41
28
  "lib/ro/slug.rb",
42
29
  "lib/ro/template.rb",
43
- "notes",
44
30
  "notes/ara.txt",
45
- "ro",
46
- "ro.gemspec",
47
- "ro/people",
48
- "ro/people/ara",
49
- "ro/people/ara/assets",
50
- "ro/people/ara/assets/ara-glacier.jpg",
51
- "ro/people/ara/assets/source",
52
- "ro/people/ara/assets/source/a.rb",
53
- "ro/people/ara/attributes.yml",
54
- "ro/people/ara/bio.md.erb",
55
- "ro/people/noah",
56
- "ro/people/noah/attributes.yml",
57
- "ro/posts",
58
- "ro/posts/hello-world",
59
- "ro/posts/hello-world/attributes.yml",
60
- "ro/posts/hello-world/body.md",
61
- "ro/posts/second-awesome-post",
62
- "ro/posts/second-awesome-post/attributes.yml",
63
- "ro/posts/second-awesome-post/body.md"]
31
+ "ro.gemspec"]
64
32
 
65
33
  spec.executables = ["ro"]
66
34
 
@@ -73,7 +41,7 @@ Gem::Specification::new do |spec|
73
41
 
74
42
  spec.add_dependency(*["fattr", " >= 2.2.1"])
75
43
 
76
- spec.add_dependency(*["tilt", " >= 1.4.1"])
44
+ spec.add_dependency(*["tilt", " >= 1.3.1"])
77
45
 
78
46
  spec.add_dependency(*["pygments.rb", " >= 0.5.0"])
79
47
 
@@ -81,6 +49,12 @@ Gem::Specification::new do |spec|
81
49
 
82
50
  spec.add_dependency(*["stringex", " >= 2.1.0"])
83
51
 
52
+ spec.add_dependency(*["systemu", " >= 2.5.2"])
53
+
54
+ spec.add_dependency(*["nokogiri", " >= 1.6.1"])
55
+
56
+ spec.add_dependency(*["main", " >= 5.2.0"])
57
+
84
58
 
85
59
  spec.extensions.push(*[])
86
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-29 00:00:00.000000000 Z
11
+ date: 2014-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: map
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.1
47
+ version: 1.3.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.4.1
54
+ version: 1.3.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pygments.rb
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,48 @@ dependencies:
94
94
  - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.1.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: systemu
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: 2.5.2
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 2.5.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: nokogiri
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: main
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 5.2.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: 5.2.0
97
139
  description: ! 'description: ro kicks the ass'
98
140
  email: ara.t.howard@gmail.com
99
141
  executables:
@@ -101,20 +143,18 @@ executables:
101
143
  extensions: []
102
144
  extra_rdoc_files: []
103
145
  files:
104
- - ! ':'
105
- - ':w'
106
146
  - README.md
107
147
  - Rakefile
148
+ - TODO.md
108
149
  - bin/ro
109
- - lib/co/db.rb
110
- - lib/co/node.rb
111
- - lib/co/node/list.rb
112
- - lib/co/util.rb
113
150
  - lib/ro.rb
114
151
  - lib/ro/blankslate.rb
115
152
  - lib/ro/cache.rb
153
+ - lib/ro/git.rb
116
154
  - lib/ro/initializers/env.rb
117
155
  - lib/ro/initializers/tilt.rb
156
+ - lib/ro/lock.rb
157
+ - lib/ro/model.rb
118
158
  - lib/ro/node.rb
119
159
  - lib/ro/node/list.rb
120
160
  - lib/ro/root.rb
@@ -122,15 +162,6 @@ files:
122
162
  - lib/ro/template.rb
123
163
  - notes/ara.txt
124
164
  - ro.gemspec
125
- - ro/people/ara/assets/ara-glacier.jpg
126
- - ro/people/ara/assets/source/a.rb
127
- - ro/people/ara/attributes.yml
128
- - ro/people/ara/bio.md.erb
129
- - ro/people/noah/attributes.yml
130
- - ro/posts/hello-world/attributes.yml
131
- - ro/posts/hello-world/body.md
132
- - ro/posts/second-awesome-post/attributes.yml
133
- - ro/posts/second-awesome-post/body.md
134
165
  homepage: https://github.com/ahoward/ro
135
166
  licenses:
136
167
  - Same As Ruby's
data/: DELETED
@@ -1,9 +0,0 @@
1
- module Ro
2
- class Template
3
- fattr :path
4
-
5
- def initialize(path)
6
- @path = Ro.realpath(path)
7
- end
8
- end
9
- end
data/:w DELETED
@@ -1,29 +0,0 @@
1
- module Ro
2
- class Db
3
- fattr :root
4
-
5
- def initialize(*args, &block)
6
- options = Map.options_for!(args)
7
-
8
- @root = String(args.shift || options[:root] || Ro.root)
9
- end
10
-
11
- def collections
12
- end
13
-
14
- def glob
15
- end
16
-
17
- def nodes
18
- 42
19
- end
20
-
21
- class Collection
22
- fattr :basename
23
-
24
- def initialize(basename)
25
- @basename = basename.to_s
26
- end
27
- end
28
- end
29
- end