virgo 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/virgo/install/install_generator.rb +20 -0
- data/lib/generators/virgo/migrations/migrations_generator.rb +19 -0
- data/lib/generators/virgo/schedule/schedule_generator.rb +15 -0
- data/lib/generators/virgo/views/views_generator.rb +22 -0
- data/lib/tasks/virgo_tasks.rake +7 -0
- data/lib/virgo.rb +4 -0
- data/lib/virgo/development_mail_interceptor.rb +6 -0
- data/lib/virgo/email_validator.rb +6 -0
- data/lib/virgo/engine.rb +64 -0
- data/lib/virgo/reduce_validator.rb +6 -0
- data/lib/virgo/upload_helpers.rb +89 -0
- data/lib/virgo/version.rb +3 -0
- data/lib/virgo/view_help.rb +3 -0
- data/vendor/gems/shortcode/Appraisals +15 -0
- data/vendor/gems/shortcode/CHANGELOG.md +162 -0
- data/vendor/gems/shortcode/Gemfile +6 -0
- data/vendor/gems/shortcode/Gemfile.lock +168 -0
- data/vendor/gems/shortcode/LICENSE.txt +22 -0
- data/vendor/gems/shortcode/README.md +268 -0
- data/vendor/gems/shortcode/Rakefile +3 -0
- data/vendor/gems/shortcode/gemfiles/rails_3.2.gemfile +8 -0
- data/vendor/gems/shortcode/gemfiles/rails_4.0.gemfile +8 -0
- data/vendor/gems/shortcode/gemfiles/rails_4.1.gemfile +8 -0
- data/vendor/gems/shortcode/gemfiles/rails_4.2.gemfile +8 -0
- data/vendor/gems/shortcode/lib/shortcode.rb +53 -0
- data/vendor/gems/shortcode/lib/shortcode/configuration.rb +36 -0
- data/vendor/gems/shortcode/lib/shortcode/exceptions.rb +9 -0
- data/vendor/gems/shortcode/lib/shortcode/parser.rb +43 -0
- data/vendor/gems/shortcode/lib/shortcode/presenter.rb +49 -0
- data/vendor/gems/shortcode/lib/shortcode/processor.rb +17 -0
- data/vendor/gems/shortcode/lib/shortcode/railtie.rb +3 -0
- data/vendor/gems/shortcode/lib/shortcode/tag.rb +54 -0
- data/vendor/gems/shortcode/lib/shortcode/template_binding.rb +33 -0
- data/vendor/gems/shortcode/lib/shortcode/transformer.rb +17 -0
- data/vendor/gems/shortcode/lib/shortcode/version.rb +3 -0
- data/vendor/gems/shortcode/shortcode.gemspec +30 -0
- data/vendor/gems/shortcode/spec/parser_spec.rb +267 -0
- data/vendor/gems/shortcode/spec/performance_spec.rb +41 -0
- data/vendor/gems/shortcode/spec/presenter_spec.rb +126 -0
- data/vendor/gems/shortcode/spec/rails_helpers_spec.rb +72 -0
- data/vendor/gems/shortcode/spec/shortcode_spec.rb +57 -0
- data/vendor/gems/shortcode/spec/spec_helper.rb +32 -0
- data/vendor/gems/shortcode/spec/support/fixtures.rb +9 -0
- data/vendor/gems/shortcode/spec/support/fixtures/block_with_whitespace.txt +2 -0
- data/vendor/gems/shortcode/spec/support/fixtures/block_with_whitespace_output.html +2 -0
- data/vendor/gems/shortcode/spec/support/fixtures/complex_snippet.txt +13 -0
- data/vendor/gems/shortcode/spec/support/fixtures/complex_snippet_output.html +33 -0
- data/vendor/gems/shortcode/spec/support/fixtures/custom_helper.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/custom_helper_output.html +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/full_quote.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/full_quote_output.html +7 -0
- data/vendor/gems/shortcode/spec/support/fixtures/item.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/item_presenter_attributes_output.html +4 -0
- data/vendor/gems/shortcode/spec/support/fixtures/item_presenter_output.html +4 -0
- data/vendor/gems/shortcode/spec/support/fixtures/long_text.txt +39 -0
- data/vendor/gems/shortcode/spec/support/fixtures/quote_with_extras.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/quote_with_extras_output.html +7 -0
- data/vendor/gems/shortcode/spec/support/fixtures/rails_helper.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/rails_helper_output_erb.html +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/rails_helper_output_haml.html +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/rails_helper_output_slim.html +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_list.txt +5 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_list_output.html +15 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_quote.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_quote_output.html +3 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_quote_presenter_attributes_output.html +6 -0
- data/vendor/gems/shortcode/spec/support/fixtures/simple_quote_presenter_output.html +6 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_event.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_event_output.html +15 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_info.txt +1 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_info_output.html +14 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_person.txt +4 -0
- data/vendor/gems/shortcode/spec/support/fixtures/timeline_person_output.html +23 -0
- data/vendor/gems/shortcode/spec/support/fixtures/without_quotes.txt +1 -0
- data/vendor/gems/shortcode/spec/support/presenters/missing_attributes_presenter.rb +12 -0
- data/vendor/gems/shortcode/spec/support/presenters/missing_content_presenter.rb +12 -0
- data/vendor/gems/shortcode/spec/support/presenters/missing_for_presenter.rb +12 -0
- data/vendor/gems/shortcode/spec/support/presenters/missing_initialize_presenter.rb +12 -0
- data/vendor/gems/shortcode/spec/support/presenters/multiple_presenter.rb +19 -0
- data/vendor/gems/shortcode/spec/support/presenters/my_presenter.rb +19 -0
- data/vendor/gems/shortcode/spec/support/presenters/other_presenter.rb +19 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/collapsible_list.html.erb +3 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/custom_helper.html.erb +1 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/item.html.erb +4 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/quote.html.erb +13 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/rails_helper.html.erb +1 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/timeline_event.html.erb +17 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/timeline_info.html.erb +15 -0
- data/vendor/gems/shortcode/spec/support/templates/erb/timeline_person.html.erb +23 -0
- data/vendor/gems/shortcode/spec/support/templates/haml/quote.html.haml +8 -0
- data/vendor/gems/shortcode/spec/support/templates/haml/rails_helper.html.haml +1 -0
- data/vendor/gems/shortcode/spec/support/templates/slim/quote.html.slim +8 -0
- data/vendor/gems/shortcode/spec/support/templates/slim/rails_helper.html.slim +1 -0
- data/vendor/gems/shortcode/spec/tag_spec.rb +67 -0
- data/vendor/gems/shortcode/spec/template_parsers_spec.rb +46 -0
- data/vendor/gems/shortcode/spec/transformer_spec.rb +122 -0
- metadata +97 -1
@@ -0,0 +1 @@
|
|
1
|
+
Blah blah [quote author="Jamie Dyer"]A quote[/quote] <br> blah blah
|
@@ -0,0 +1 @@
|
|
1
|
+
[rails_helper]blah[/rails_helper]
|
@@ -0,0 +1 @@
|
|
1
|
+
<b>blah</b>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>blah</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<i>blah</i>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class='collapsible'>
|
2
|
+
<section>
|
3
|
+
<h5>Example title 1</h5>
|
4
|
+
<div>Example content 1</div>
|
5
|
+
</section>
|
6
|
+
<section>
|
7
|
+
<h5>Example title 2</h5>
|
8
|
+
<div>Example content 2</div>
|
9
|
+
</section>
|
10
|
+
<section>
|
11
|
+
<h5>Example title 3</h5>
|
12
|
+
<div>Example content 3</div>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
[quote]hello[/quote]
|
@@ -0,0 +1 @@
|
|
1
|
+
[timeline_event date="March 2013" title="a title" link="http://blah.com"]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class='timeline'>
|
2
|
+
<table>
|
3
|
+
<tbody>
|
4
|
+
<tr>
|
5
|
+
<th scope='row'>
|
6
|
+
March 2013
|
7
|
+
</th>
|
8
|
+
<td class='event'>
|
9
|
+
<span class='description'>a title</span>
|
10
|
+
<a class='read_more' href='http://blah.com'>Read More</a>
|
11
|
+
</td>
|
12
|
+
</tr>
|
13
|
+
</tbody>
|
14
|
+
</table>
|
15
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
[timeline_info date="Feb 2013" title="Something amazing"]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class='timeline'>
|
2
|
+
<table>
|
3
|
+
<tbody>
|
4
|
+
<tr>
|
5
|
+
<th scope='row'>
|
6
|
+
Jan 2012
|
7
|
+
</th>
|
8
|
+
<td class='team_news'>
|
9
|
+
<img src='/images/person.jpg'>
|
10
|
+
<h4>A real title</h4>
|
11
|
+
<span class='name'>Sam Smith</span>
|
12
|
+
<span class='position'>Presedent</span>
|
13
|
+
<a class='read_more' href='http://blah.com'>View Profile</a>
|
14
|
+
<div class='description'>
|
15
|
+
<p>A bit of body copy
|
16
|
+
with a newline
|
17
|
+
</p>
|
18
|
+
</div>
|
19
|
+
</td>
|
20
|
+
</tr>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
[quote author="Jamie Dyer" title=King_of_England]A quote[/quote]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class MultiplePresenter
|
2
|
+
|
3
|
+
def self.for
|
4
|
+
[:quote, :item]
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(attributes, content, additional_attributes)
|
8
|
+
@content = content
|
9
|
+
@additional_attributes = additional_attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
@content
|
14
|
+
end
|
15
|
+
|
16
|
+
def attributes
|
17
|
+
@additional_attributes || { title: "my custom title" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class MyPresenter
|
2
|
+
|
3
|
+
def self.for
|
4
|
+
:quote
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(attributes, content, additional_attributes)
|
8
|
+
@content = content
|
9
|
+
@additional_attributes = additional_attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
@content
|
14
|
+
end
|
15
|
+
|
16
|
+
def attributes
|
17
|
+
@additional_attributes || { title: "my custom title" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class OtherPresenter
|
2
|
+
|
3
|
+
def self.for
|
4
|
+
:other
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(attributes, content, additional_attributes)
|
8
|
+
@content = content
|
9
|
+
@additional_attributes = additional_attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
@content
|
14
|
+
end
|
15
|
+
|
16
|
+
def attributes
|
17
|
+
@additional_attributes || { title: "my custom title" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= wrap_in_p(@content) %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<blockquote>
|
2
|
+
<p class='quotation'><%= @content %></p>
|
3
|
+
<% if @attributes[:author] || @attributes[:title] %>
|
4
|
+
<p class='citation'>
|
5
|
+
<% if @attributes[:author] %>
|
6
|
+
<span class='author'><%= @attributes[:author] %></span>
|
7
|
+
<% end %>
|
8
|
+
<% if @attributes[:title] %>
|
9
|
+
<span class='position'><%= @attributes[:title] %></span>
|
10
|
+
<% end %>
|
11
|
+
</p>
|
12
|
+
<% end %>
|
13
|
+
</blockquote>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= content_tag(:b, @content) %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class='timeline'>
|
2
|
+
<table>
|
3
|
+
<tbody>
|
4
|
+
<tr>
|
5
|
+
<th scope='row'>
|
6
|
+
<%= @attributes[:date] %>
|
7
|
+
</th>
|
8
|
+
<td class='event'>
|
9
|
+
<span class='description'><%= @attributes[:title] %></span>
|
10
|
+
<% if @attributes[:link] %>
|
11
|
+
<a class='read_more' href='<%= @attributes[:link] %>'>Read More</a>
|
12
|
+
<% end %>
|
13
|
+
</td>
|
14
|
+
</tr>
|
15
|
+
</tbody>
|
16
|
+
</table>
|
17
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class='timeline'>
|
2
|
+
<table>
|
3
|
+
<tbody>
|
4
|
+
<tr>
|
5
|
+
<th scope='row'>
|
6
|
+
<%= @attributes[:date] %>
|
7
|
+
</th>
|
8
|
+
<td class='team_news'>
|
9
|
+
<img src='<%= @attributes[:image] %>'>
|
10
|
+
<h4><%= @attributes[:title] %></h4>
|
11
|
+
<span class='name'><%= @attributes[:name] %></span>
|
12
|
+
<span class='position'><%= @attributes[:position] %></span>
|
13
|
+
<% if @attributes[:link] %>
|
14
|
+
<a class='read_more' href='<%= @attributes[:link] %>'>View Profile</a>
|
15
|
+
<% end %>
|
16
|
+
<div class='description'>
|
17
|
+
<p><%= @content %></p>
|
18
|
+
</div>
|
19
|
+
</td>
|
20
|
+
</tr>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
= content_tag(:p, @content)
|
@@ -0,0 +1 @@
|
|
1
|
+
= content_tag :i, @content
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Shortcode::Tag do
|
4
|
+
|
5
|
+
context "when the template file is missing" do
|
6
|
+
|
7
|
+
let(:tag) { Shortcode::Tag.new('doesnt_exist') }
|
8
|
+
|
9
|
+
it "raises a TemplateNotFound error when the file doesn't exists" do
|
10
|
+
expect { tag.render }.to raise_error(Shortcode::TemplateNotFound)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when an unsupported template parser is specified" do
|
16
|
+
|
17
|
+
let(:tag) { Shortcode::Tag.new('quote') }
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
Shortcode.setup do |config|
|
21
|
+
config.template_parser = :something_crazy
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises a TemplateNotFound error when the file doesn't exists" do
|
26
|
+
expect { tag.render }.to raise_error(Shortcode::TemplateParserNotSupported)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "templates from strings" do
|
32
|
+
|
33
|
+
let(:tag) { Shortcode::Tag.new('from_string', [{ key: 'string', value: 'batman' }]) }
|
34
|
+
|
35
|
+
before(:each) do
|
36
|
+
Shortcode.setup do |config|
|
37
|
+
config.templates = {
|
38
|
+
from_string: '<p><%= @attributes[:string] %></p>'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "renders a template from a string" do
|
44
|
+
expect(tag.render).to eq('<p>batman</p>')
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when the template is missing from the config" do
|
50
|
+
|
51
|
+
let(:tag) { Shortcode::Tag.new('missing', [{ key: 'string', value: 'batman' }]) }
|
52
|
+
|
53
|
+
before(:each) do
|
54
|
+
Shortcode.setup do |config|
|
55
|
+
config.templates = {
|
56
|
+
from_string: '<p><%= @attributes[:string] %></p>'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "raises an error" do
|
62
|
+
expect { tag.render }.to raise_error(Shortcode::TemplateNotFound)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|