modular 0.2.1 → 0.2.2
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/.gitignore +1 -0
- data/Gemfile +1 -0
- data/lib/modular.rb +3 -14
- data/lib/modular/action_controller_extension.rb +16 -7
- data/lib/modular/components.rb +7 -4
- data/lib/modular/components/base.rb +75 -5
- data/lib/modular/components/container.rb +37 -11
- data/lib/modular/configuration.rb +8 -0
- data/lib/modular/creation.rb +20 -13
- data/lib/{generators → modular/generators}/component/USAGE +0 -0
- data/lib/modular/generators/component/component_generator.rb +18 -0
- data/lib/{generators → modular/generators}/component/templates/component.rb.erb +0 -0
- data/lib/{generators → modular/generators}/component/templates/template.erb +0 -0
- data/lib/modular/mst_rendering.rb +10 -0
- data/lib/modular/railtie.rb +4 -0
- data/lib/modular/rendering.rb +1 -42
- data/lib/modular/version.rb +1 -1
- data/spec/components/{base.rb → base_spec.rb} +12 -6
- data/spec/components/container_spec.rb +27 -0
- data/spec/components/{hello_world.rb → hello_world_spec.rb} +0 -0
- data/spec/components/{helpers_example.rb → helpers_example_spec.rb} +0 -0
- data/spec/components/spec/internal/log/test.log +0 -0
- data/spec/controllers/callback_layout_controller_spec.rb +4 -0
- data/spec/controllers/rendering_spec.rb +33 -0
- data/spec/internal/app/components/mustache_container.rb +5 -0
- data/spec/internal/app/components/mustached.rb +5 -0
- data/spec/internal/app/controllers/callback_layout_controller.rb +5 -5
- data/spec/internal/app/controllers/example_controller.rb +9 -1
- data/spec/internal/app/views/components/mustache_container.mst +3 -0
- data/spec/internal/app/views/components/mustached.mst +1 -0
- data/spec/internal/app/views/example/mustache.html.erb +1 -0
- data/spec/internal/app/views/example/mustache_nested.html.erb +1 -0
- data/spec/internal/config/initializers/modular.rb +11 -6
- data/spec/modular/configuration_spec.rb +6 -6
- data/spec/modular/creation_spec.rb +36 -5
- data/spec/modular/validation_spec.rb +115 -0
- data/templates/components/container.html.erb +7 -0
- data/templates/layout.erb +1 -3
- metadata +23 -47
- data/lib/generators/component/component_generator.rb +0 -16
- data/lib/modular/helpers.rb +0 -74
- data/modular-app/Gemfile +0 -20
- data/modular-app/Rakefile +0 -7
- data/modular-app/config.ru +0 -4
- data/modular-app/config/application.rb +0 -42
- data/modular-app/config/boot.rb +0 -6
- data/modular-app/config/database.yml +0 -22
- data/modular-app/config/environment.rb +0 -5
- data/modular-app/config/environments/development.rb +0 -26
- data/modular-app/config/environments/production.rb +0 -49
- data/modular-app/config/environments/test.rb +0 -35
- data/modular-app/config/initializers/backtrace_silencers.rb +0 -7
- data/modular-app/config/initializers/inflections.rb +0 -10
- data/modular-app/config/initializers/mime_types.rb +0 -5
- data/modular-app/config/initializers/secret_token.rb +0 -7
- data/modular-app/config/initializers/session_store.rb +0 -8
- data/modular-app/config/locales/en.yml +0 -5
- data/modular-app/config/routes.rb +0 -7
- data/modular-app/db/migrate/20110721090602_create_simple_models.rb +0 -12
- data/modular-app/db/schema.rb +0 -20
- data/modular-app/db/seeds.rb +0 -7
- data/modular-app/script/rails +0 -6
- data/modular-app/spec/spec_helper.rb +0 -27
- data/spec/components/container.rb +0 -34
- data/spec/components/validated.rb +0 -15
- data/spec/controllers/example_controller_spec.rb +0 -12
- data/spec/controllers/indirect_render_controller_spec.rb +0 -13
- data/spec/internal/app/components/heavy_task.rb +0 -8
- data/spec/internal/app/controllers/indirect_render_controller.rb +0 -7
- data/spec/internal/app/views/components/container.html.erb +0 -7
- data/spec/internal/app/views/components/heavy_task.html.erb +0 -1
- data/spec/internal/tmp/modular/cached_for_time.html.erb +0 -14
- data/spec/internal/tmp/modular/cached_forever.html.erb +0 -12
- data/spec/internal/tmp/modular/heavy.html.erb +0 -19
- data/spec/internal/tmp/modular/nested.html.erb +0 -28
- data/spec/views/indirect_render/index.html.erb_spec.rb +0 -4
@@ -1,27 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
|
6
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
-
# in spec/support/ and its subdirectories.
|
8
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
# == Mock Framework
|
12
|
-
#
|
13
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
-
#
|
15
|
-
# config.mock_with :mocha
|
16
|
-
# config.mock_with :flexmock
|
17
|
-
# config.mock_with :rr
|
18
|
-
config.mock_with :rspec
|
19
|
-
|
20
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
-
|
23
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
-
# examples within a transaction, remove the following line or assign false
|
25
|
-
# instead of true.
|
26
|
-
config.use_transactional_fixtures = true
|
27
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Modular::Components::Container, ' vertical container class ' do
|
4
|
-
before :each do
|
5
|
-
@cmp = described_class.new
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should have container" do
|
9
|
-
@cmp.components.should be_a_kind_of Array
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should unserialize children" do
|
13
|
-
@cmp.components.push Modular.create(:FakeNewsFeed, { :news_count => 50, :title => 'Best news feed' }).to_json
|
14
|
-
json = @cmp.to_json
|
15
|
-
container = Modular.from_json(json)
|
16
|
-
container.components[0].should be_a_kind_of FakeNewsFeed
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should have add_container and add_child methods" do
|
20
|
-
@cmp.add :container, :title => 'Test container title' do
|
21
|
-
add :FakeNewsFeed, :title => 'Worst news feed'
|
22
|
-
|
23
|
-
add :Vertical, :title => 'Vertical container'
|
24
|
-
end
|
25
|
-
|
26
|
-
@cmp.components[0].title.should == 'Test container title'
|
27
|
-
|
28
|
-
feed = @cmp.components[0].components[0]
|
29
|
-
feed.should be_a_kind_of FakeNewsFeed
|
30
|
-
feed.title.should == 'Worst news feed'
|
31
|
-
|
32
|
-
@cmp.components[0].components[1].should be_a_kind_of Vertical
|
33
|
-
end
|
34
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Modular::Components::Validated, ' as non-generatable component ' do
|
4
|
-
it "should throw error if generated" do
|
5
|
-
lambda {
|
6
|
-
Modular.create(:Container).add_container :title => 'Test container title' do |cont2|
|
7
|
-
add_child(:Validated)
|
8
|
-
end
|
9
|
-
}.should raise_error
|
10
|
-
|
11
|
-
lambda {
|
12
|
-
Modular.create(:Validated)
|
13
|
-
}.should raise_error
|
14
|
-
end
|
15
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<h3>Template for HeavyTask</h3>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<% @layout_id = 'cached_for_time'.to_sym %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<h3>Template for CachedForTime</h3>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<%
|
10
|
-
layout = 'application'
|
11
|
-
#Old one is @_content_for
|
12
|
-
@view_flow.content[:layout] = self.output_buffer
|
13
|
-
self.output_buffer = render(:file => "layouts/#{layout}")
|
14
|
-
%>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<% @layout_id = 'heavy'.to_sym %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<table>
|
6
|
-
<tr><td>
|
7
|
-
<h1>Template - Best news feed</h1>
|
8
|
-
<h3>Template for HeavyTask</h3>
|
9
|
-
|
10
|
-
</td></tr>
|
11
|
-
</table>
|
12
|
-
|
13
|
-
|
14
|
-
<%
|
15
|
-
layout = 'application'
|
16
|
-
#Old one is @_content_for
|
17
|
-
@view_flow.content[:layout] = self.output_buffer
|
18
|
-
self.output_buffer = render(:file => "layouts/#{layout}")
|
19
|
-
%>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<% @layout_id = 'nested'.to_sym %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<table>
|
6
|
-
<tr><td>
|
7
|
-
<h1>Template - Best news feed</h1>
|
8
|
-
<table>
|
9
|
-
<tr><td>
|
10
|
-
<div>
|
11
|
-
<h3>FooBar component!</h3>
|
12
|
-
<p>Nested component</p>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
</td></tr>
|
16
|
-
</table>
|
17
|
-
|
18
|
-
<%=yield%>
|
19
|
-
</td></tr>
|
20
|
-
</table>
|
21
|
-
|
22
|
-
|
23
|
-
<%
|
24
|
-
layout = 'application'
|
25
|
-
#Old one is @_content_for
|
26
|
-
@view_flow.content[:layout] = self.output_buffer
|
27
|
-
self.output_buffer = render(:file => "layouts/#{layout}")
|
28
|
-
%>
|