sitefs 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/TODO.md +8 -0
- data/bin/sitefs +96 -0
- data/inline-site/_layout.html.erb +30 -0
- data/inline-site/_layout.md.html.erb +3 -0
- data/inline-site/advanced-md.page.md +18 -0
- data/inline-site/dir/_layout.md.html.erb +3 -0
- data/inline-site/dir/sub1/_layout.html.erb +7 -0
- data/inline-site/dir/sub1/sub2/deep-page.page.md +8 -0
- data/inline-site/ears.png +0 -0
- data/inline-site/gallery/IMG_4371.jpg +0 -0
- data/inline-site/gallery/Screen Shot 2016-04-21 at 5.57.53 PM.png +0 -0
- data/inline-site/gallery/Screen Shot 2016-04-25 at 2.06.46 PM.png +0 -0
- data/inline-site/gallery/Screen Shot 2016-04-27 at 9.31.28 PM.png +0 -0
- data/inline-site/gallery/_gallery.html.erb +1 -0
- data/inline-site/gallery/_permalink.html.erb +1 -0
- data/inline-site/gallery/photos.page.rb +23 -0
- data/inline-site/index.html +41 -0
- data/inline-site/index.page.html.erb +1 -0
- data/inline-site/single-markdown.page.md +12 -0
- data/inline-site/styles/_helper.scss +1 -0
- data/inline-site/styles/app.css +1 -0
- data/inline-site/styles/app.scss +5 -0
- data/inline-site/tagged/_tag_layout.html.erb +7 -0
- data/inline-site/tagged/public.tag-page.rb +8 -0
- data/lib/sitefs/attribute_set.rb +93 -0
- data/lib/sitefs/command_config.rb +79 -0
- data/lib/sitefs/dsl_context.rb +49 -0
- data/lib/sitefs/file_action.rb +155 -0
- data/lib/sitefs/file_action_set.rb +51 -0
- data/lib/sitefs/file_registry.rb +61 -0
- data/lib/sitefs/handler.rb +46 -0
- data/lib/sitefs/handlers/markdown.rb +102 -0
- data/lib/sitefs/handlers/noop.rb +15 -0
- data/lib/sitefs/handlers/ruby_gen.rb +33 -0
- data/lib/sitefs/handlers/scss.rb +63 -0
- data/lib/sitefs/handlers/single_erb.rb +49 -0
- data/lib/sitefs/handlers/tag_page.rb +11 -0
- data/lib/sitefs/handlers.rb +6 -0
- data/lib/sitefs/html_pipelines.rb +95 -0
- data/lib/sitefs/layout_type.rb +16 -0
- data/lib/sitefs/manifest.rb +98 -0
- data/lib/sitefs/manifest_file.rb +64 -0
- data/lib/sitefs/page.rb +44 -0
- data/lib/sitefs/page_render.rb +6 -0
- data/lib/sitefs/path_helper.rb +31 -0
- data/lib/sitefs/render_context.rb +31 -0
- data/lib/sitefs/render_result.rb +16 -0
- data/lib/sitefs/renderer.rb +65 -0
- data/lib/sitefs/renderer_pipeline.rb +94 -0
- data/lib/sitefs/servlet.rb +31 -0
- data/lib/sitefs/tag_page_dsl_context.rb +13 -0
- data/lib/sitefs/version.rb +3 -0
- data/lib/sitefs/walker.rb +94 -0
- data/lib/sitefs/watcher.rb +85 -0
- data/lib/sitefs.rb +19 -0
- data/sitefs.gemspec +47 -0
- data/test-walker.rb +20 -0
- metadata +335 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 06b3cf880ef02dd45263eaf7f7ace07efaa2be55
|
4
|
+
data.tar.gz: 397d02a008a4fa7e7c12ad34059fe1f07dbf3ca5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 726d6ba89ba3caf6a5a3090f5243fb5191eb1f0f063372e9459560b51d3dfed73b077268ebf9081edee4bcdac9ee12d6baec934e0ae373517f0a6ec950b5fab2
|
7
|
+
data.tar.gz: 10a934c07373e4e063f72fcb6a482e034e1e79715d10f4bed794e5574bf0ed3ec2cb689bf7cd1f056d4ec53e47981de4788fdbe04a386777ac43611a72d35542
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sitefs (1.0.0.beta1)
|
5
|
+
autoloaded (~> 2)
|
6
|
+
aws-sdk (~> 2)
|
7
|
+
diffy (~> 3)
|
8
|
+
github-markdown (~> 0.6)
|
9
|
+
html-pipeline (~> 2.5)
|
10
|
+
html-pipeline-rouge_filter (~> 1.0)
|
11
|
+
listen (~> 3.1)
|
12
|
+
mime-types (~> 3)
|
13
|
+
ratom (~> 0.9)
|
14
|
+
rinku (~> 2.0)
|
15
|
+
sass (~> 3.4)
|
16
|
+
slop (~> 4)
|
17
|
+
stamp (~> 0.6)
|
18
|
+
|
19
|
+
GEM
|
20
|
+
remote: https://rubygems.org/
|
21
|
+
specs:
|
22
|
+
activesupport (5.0.1)
|
23
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
+
i18n (~> 0.7)
|
25
|
+
minitest (~> 5.1)
|
26
|
+
tzinfo (~> 1.1)
|
27
|
+
autoloaded (2.1.1)
|
28
|
+
aws-sdk (2.7.6)
|
29
|
+
aws-sdk-resources (= 2.7.6)
|
30
|
+
aws-sdk-core (2.7.6)
|
31
|
+
aws-sigv4 (~> 1.0)
|
32
|
+
jmespath (~> 1.0)
|
33
|
+
aws-sdk-resources (2.7.6)
|
34
|
+
aws-sdk-core (= 2.7.6)
|
35
|
+
aws-sigv4 (1.0.0)
|
36
|
+
concurrent-ruby (1.0.4)
|
37
|
+
diff-lcs (1.3)
|
38
|
+
diffy (3.1.0)
|
39
|
+
ffi (1.9.17)
|
40
|
+
github-markdown (0.6.9)
|
41
|
+
html-pipeline (2.5.0)
|
42
|
+
activesupport (>= 2)
|
43
|
+
nokogiri (>= 1.4)
|
44
|
+
html-pipeline-rouge_filter (1.0.4)
|
45
|
+
activesupport
|
46
|
+
html-pipeline (>= 1.11)
|
47
|
+
rouge (~> 1.8)
|
48
|
+
i18n (0.8.0)
|
49
|
+
jmespath (1.3.1)
|
50
|
+
libxml-ruby (2.9.0)
|
51
|
+
listen (3.1.5)
|
52
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
53
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
54
|
+
ruby_dep (~> 1.2)
|
55
|
+
mime-types (3.1)
|
56
|
+
mime-types-data (~> 3.2015)
|
57
|
+
mime-types-data (3.2016.0521)
|
58
|
+
mini_portile2 (2.1.0)
|
59
|
+
minitest (5.10.1)
|
60
|
+
nokogiri (1.7.0.1)
|
61
|
+
mini_portile2 (~> 2.1.0)
|
62
|
+
rake (12.0.0)
|
63
|
+
ratom (0.9.0)
|
64
|
+
libxml-ruby (~> 2.6)
|
65
|
+
rb-fsevent (0.9.8)
|
66
|
+
rb-inotify (0.9.8)
|
67
|
+
ffi (>= 0.5.0)
|
68
|
+
rinku (2.0.2)
|
69
|
+
rouge (1.11.1)
|
70
|
+
rspec (3.5.0)
|
71
|
+
rspec-core (~> 3.5.0)
|
72
|
+
rspec-expectations (~> 3.5.0)
|
73
|
+
rspec-mocks (~> 3.5.0)
|
74
|
+
rspec-core (3.5.4)
|
75
|
+
rspec-support (~> 3.5.0)
|
76
|
+
rspec-expectations (3.5.0)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.5.0)
|
79
|
+
rspec-mocks (3.5.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.5.0)
|
82
|
+
rspec-support (3.5.0)
|
83
|
+
ruby_dep (1.5.0)
|
84
|
+
sass (3.4.23)
|
85
|
+
slop (4.4.1)
|
86
|
+
stamp (0.6.0)
|
87
|
+
thread_safe (0.3.5)
|
88
|
+
tzinfo (1.2.2)
|
89
|
+
thread_safe (~> 0.1)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
bundler (~> 1.13)
|
96
|
+
rake (~> 12)
|
97
|
+
rspec (~> 3.0)
|
98
|
+
sitefs!
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.14.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Tal Atlas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Sitefs
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sitefs`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'sitefs'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sitefs
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sitefs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Todo List
|
2
|
+
|
3
|
+
- [x] Make options for aws (always index.html) or github (foo.html) hosting
|
4
|
+
- [x] Built in sync tool
|
5
|
+
- [x] Embed information in generated files to indicate that they're generated.
|
6
|
+
- [ ] Add logger to config
|
7
|
+
- [ ] Flatten render context so it's not proxy on proxy on proxy
|
8
|
+
- [ ] Make init command that writes base folder structure
|
data/bin/sitefs
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'yaml'
|
5
|
+
require 'sitefs'
|
6
|
+
require 'slop'
|
7
|
+
|
8
|
+
include Sitefs
|
9
|
+
|
10
|
+
opts = Slop.parse do |o|
|
11
|
+
o.banner = "usage: bin/sitefs build|watch|upload [options]"
|
12
|
+
o.integer '-p', '--port', 'custom port', default: 8050
|
13
|
+
|
14
|
+
o.bool '-q', '--quiet', 'suppress output (quiet mode)'
|
15
|
+
o.string '--config', 'location of config file (default .sitefs-config.yml)'
|
16
|
+
o.bool '--clean-manifest', 'remove the manifest file, forces all files to re-upload and removes ability to clean currently generated files'
|
17
|
+
o.bool '-h', '--help', 'shows this message'
|
18
|
+
o.bool '-f', '--force', 'forces generation or upload even if identical'
|
19
|
+
|
20
|
+
o.on '--version', 'print the version' do
|
21
|
+
puts VERSION
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
if opts[:config]
|
28
|
+
unless File.exist?(opts[:config])
|
29
|
+
abort "No config file found at #{opts[:config]}"
|
30
|
+
end
|
31
|
+
|
32
|
+
config = CommandConfig.from_file(opts[:config])
|
33
|
+
elsif File.exist?('.sitefs-config.yml')
|
34
|
+
config = CommandConfig.from_file('.sitefs-config.yml')
|
35
|
+
else
|
36
|
+
# If no defined config or default config then use default values defined by class
|
37
|
+
config = CommandConfig.new({})
|
38
|
+
end
|
39
|
+
|
40
|
+
unless config
|
41
|
+
abort "Invalid config file found at #{opts[:config]}"
|
42
|
+
end
|
43
|
+
|
44
|
+
if opts.help?
|
45
|
+
puts opts
|
46
|
+
exit
|
47
|
+
end
|
48
|
+
|
49
|
+
if opts.clean_manifest?
|
50
|
+
config.manifest.clean!
|
51
|
+
puts 'Cleaning manifest'
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
|
55
|
+
config.port = opts[:port]
|
56
|
+
config.quiet = opts.quiet?
|
57
|
+
config.force = opts.force?
|
58
|
+
|
59
|
+
possible_actions = %w{clean watch build upload}
|
60
|
+
|
61
|
+
args = opts.args.dup
|
62
|
+
|
63
|
+
if possible_actions.include?(args.first)
|
64
|
+
action = args.shift
|
65
|
+
else
|
66
|
+
action = 'watch'
|
67
|
+
end
|
68
|
+
|
69
|
+
root_path = args.shift || config.root_path
|
70
|
+
|
71
|
+
unless root_path
|
72
|
+
STDERR.puts 'no path specified in config or params'
|
73
|
+
STDERR.puts opts
|
74
|
+
abort
|
75
|
+
end
|
76
|
+
|
77
|
+
unless args.empty?
|
78
|
+
STDERR.puts 'too many arguments passed'
|
79
|
+
STDERR.puts opts
|
80
|
+
abort
|
81
|
+
end
|
82
|
+
|
83
|
+
config.root_path = root_path
|
84
|
+
|
85
|
+
walker = Walker.new config
|
86
|
+
|
87
|
+
case action
|
88
|
+
when 'build'
|
89
|
+
walker.run :write
|
90
|
+
when 'watch'
|
91
|
+
walker.watcher.start
|
92
|
+
when 'upload'
|
93
|
+
walker.run :upload
|
94
|
+
when 'clean'
|
95
|
+
config.manifest.delete_generated
|
96
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<% if current_page && current_page.title %>
|
5
|
+
<title><%= current_page.title %> | Test Site</title>
|
6
|
+
<% else %>
|
7
|
+
<title>Test Site</title>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="/styles/app.css">
|
11
|
+
|
12
|
+
<%= yield :head %>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div class="sidebar">
|
16
|
+
<ul class="tag-list">
|
17
|
+
<% public_tags.each do |tag| %>
|
18
|
+
<li class="tag">
|
19
|
+
<%= tag %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div id="main">
|
26
|
+
<%= yield %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
</body>
|
30
|
+
</html>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the gallary
|
@@ -0,0 +1 @@
|
|
1
|
+
<img src="<%= current_page.attributes.src %>" />
|
@@ -0,0 +1,23 @@
|
|
1
|
+
images = files_like '*.{png}'
|
2
|
+
|
3
|
+
images.each do |image_path|
|
4
|
+
base = File.basename(image_path, File.extname(image_path))
|
5
|
+
|
6
|
+
page = new_page
|
7
|
+
page.tags << '_image'
|
8
|
+
page.href = base
|
9
|
+
page.title = "My image | #{base}"
|
10
|
+
|
11
|
+
page.attributes.src = path_for_href(image_path)
|
12
|
+
|
13
|
+
render page, with: '_permalink.html.erb'
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
gallary = new_page
|
18
|
+
gallary.tags << 'image-gallary'
|
19
|
+
gallary.title = "My gallary"
|
20
|
+
gallary.href = 'index'
|
21
|
+
gallary.attributes.images = images
|
22
|
+
|
23
|
+
render gallary, with: '_gallery.html.erb'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<title>Test Site</title>
|
6
|
+
|
7
|
+
|
8
|
+
<link rel="stylesheet" href="/styles/app.css">
|
9
|
+
|
10
|
+
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="sidebar">
|
14
|
+
<ul class="tag-list">
|
15
|
+
|
16
|
+
<li class="tag">
|
17
|
+
test 12
|
18
|
+
</li>
|
19
|
+
|
20
|
+
<li class="tag">
|
21
|
+
oneword
|
22
|
+
</li>
|
23
|
+
|
24
|
+
<li class="tag">
|
25
|
+
test-page
|
26
|
+
</li>
|
27
|
+
|
28
|
+
<li class="tag">
|
29
|
+
image-gallary
|
30
|
+
</li>
|
31
|
+
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main">
|
36
|
+
Index Page!
|
37
|
+
|
38
|
+
</div>
|
39
|
+
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
Index Page!
|
@@ -0,0 +1 @@
|
|
1
|
+
$color: purple;
|
@@ -0,0 +1 @@
|
|
1
|
+
body{color:purple}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class Sitefs::AttributeSet
|
2
|
+
include Enumerable
|
3
|
+
|
4
|
+
KEY_ALIASES = {
|
5
|
+
'published_at' => 'published',
|
6
|
+
}
|
7
|
+
|
8
|
+
KEY_PARSERS = {
|
9
|
+
'published' => -> (value) do
|
10
|
+
if value.respond_to? :to_time
|
11
|
+
value.to_time
|
12
|
+
elsif value.is_a? Time
|
13
|
+
value
|
14
|
+
else
|
15
|
+
Time.new(value)
|
16
|
+
end
|
17
|
+
end,
|
18
|
+
'tags' => -> (value) do
|
19
|
+
if value.is_a?(String)
|
20
|
+
value.split(',')
|
21
|
+
else
|
22
|
+
value.to_a
|
23
|
+
end.map(&:strip)
|
24
|
+
end,
|
25
|
+
}
|
26
|
+
|
27
|
+
def initialize setup = {}
|
28
|
+
@attributes = {}
|
29
|
+
|
30
|
+
setup.each do |key, val|
|
31
|
+
self[key] = val
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def normalize_key key
|
36
|
+
k = key.to_s
|
37
|
+
KEY_ALIASES[k] || k
|
38
|
+
end
|
39
|
+
|
40
|
+
def [] key
|
41
|
+
@attributes[normalize_key(key)]
|
42
|
+
end
|
43
|
+
|
44
|
+
def []= key, value
|
45
|
+
key = normalize_key(key)
|
46
|
+
|
47
|
+
if parser = KEY_PARSERS[key]
|
48
|
+
@attributes[key] = parser.call(value)
|
49
|
+
else
|
50
|
+
@attributes[key] = value
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def each
|
55
|
+
@attributes.each do |key, attr|
|
56
|
+
yield key, attr.value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def method_missing(meth, *args, &blk)
|
61
|
+
method_name = meth.to_s
|
62
|
+
|
63
|
+
if @attributes[method_name] && args.empty?
|
64
|
+
self[method_name]
|
65
|
+
elsif method_name[-1] == '=' && args.length == 1
|
66
|
+
self[method_name[0...-1]] = args[0]
|
67
|
+
else
|
68
|
+
super
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class << self
|
73
|
+
|
74
|
+
def from_yaml lines
|
75
|
+
if lines.is_a? Array
|
76
|
+
lines = lines.join
|
77
|
+
end
|
78
|
+
|
79
|
+
data = YAML.load(lines)
|
80
|
+
|
81
|
+
unless data
|
82
|
+
STDERR.puts "Error loading yaml attributes from: #{lines.inspect}"
|
83
|
+
data = {} # so it doesnt error further down
|
84
|
+
end
|
85
|
+
|
86
|
+
new(data)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|