attributarchy 0.0.1
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/MIT-LICENSE +20 -0
- data/README.md +80 -0
- data/Rakefile +28 -0
- data/lib/attributarchy.rb +10 -0
- data/lib/attributarchy/controller_methods.rb +58 -0
- data/lib/attributarchy/helpers.rb +28 -0
- data/lib/attributarchy/version.rb +3 -0
- data/lib/tasks/attributarchy_tasks.rake +4 -0
- data/spec/controller_methods_spec.rb +78 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +22 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/examples_controller.rb +15 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/examples/_continent.html.erb +1 -0
- data/spec/dummy/app/views/examples/_country.html.erb +1 -0
- data/spec/dummy/app/views/examples/index.html.erb +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +31 -0
- data/spec/dummy/config/environments/production.rb +64 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +10 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/log/development.log +28885 -0
- data/spec/dummy/log/test.log +23070 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/fixtures/expectations/one_attributarchy.html +22 -0
- data/spec/fixtures/expectations/two_attributarchies.html +70 -0
- data/spec/fixtures/expectations/two_attributarchies_without_rendering_country.html +52 -0
- data/spec/fixtures/partials/_country.html.erb +15 -0
- data/spec/fixtures/partials/_state.html.erb +15 -0
- data/spec/helpers_spec.rb +219 -0
- data/spec/spec_helper.rb +51 -0
- data/spec/support/helpers.rb +27 -0
- data/spec/support/shared_examples_group_spec.rb +9 -0
- metadata +156 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
require 'fakefs/spec_helpers'
|
7
|
+
require 'rspec-html-matchers'
|
8
|
+
|
9
|
+
require 'coveralls'
|
10
|
+
Coveralls.wear!
|
11
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
13
|
+
# in spec/support/ and its subdirectories.
|
14
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
# ## Mock Framework
|
18
|
+
#
|
19
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
20
|
+
#
|
21
|
+
# config.mock_with :mocha
|
22
|
+
# config.mock_with :flexmock
|
23
|
+
# config.mock_with :rr
|
24
|
+
|
25
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
26
|
+
#config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
27
|
+
|
28
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
29
|
+
# examples within a transaction, remove the following line or assign false
|
30
|
+
# instead of true.
|
31
|
+
#config.use_transactional_fixtures = true
|
32
|
+
|
33
|
+
# If true, the base class of anonymous controllers will be inferred
|
34
|
+
# automatically. This will be the default behavior in future versions of
|
35
|
+
# rspec-rails.
|
36
|
+
config.infer_base_class_for_anonymous_controllers = false
|
37
|
+
|
38
|
+
# Run specs in random order to surface order dependencies. If you find an
|
39
|
+
# order dependency and want to debug it, you can fix the order by providing
|
40
|
+
# the seed, which is printed after each run.
|
41
|
+
# --seed 1234
|
42
|
+
config.order = "random"
|
43
|
+
|
44
|
+
config.include FakeFS::SpecHelpers
|
45
|
+
config.include Helpers
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
class ControllerWithAttributarchy < ActionController::Base
|
50
|
+
include Attributarchy
|
51
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Helpers
|
2
|
+
|
3
|
+
def html_tidy(html)
|
4
|
+
html.
|
5
|
+
gsub(/\A\s+|\s+\z/, '').
|
6
|
+
gsub(/>\s+/, '>').
|
7
|
+
gsub(/\s+</, '<')
|
8
|
+
end
|
9
|
+
|
10
|
+
def fixture_content_of(*path)
|
11
|
+
File.read(File.join(path))
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_fixtures_into(path)
|
15
|
+
FileUtils.mkdir_p(path)
|
16
|
+
FakeFS::FileSystem.clone('spec/fixtures')
|
17
|
+
Dir.glob('spec/fixtures/*/*') do |fixture|
|
18
|
+
FileUtils.cp fixture, File.join(path, File.basename(fixture))
|
19
|
+
end
|
20
|
+
subject.prepend_view_path(path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def rails_view_path
|
24
|
+
File.join(File.expand_path('.'), %w[app views])
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
shared_examples_for 'an attributarchy' do
|
2
|
+
it 'should be wrapped in an attributarchy-classed div' do
|
3
|
+
expect(output).to start_with('<div class="attributarchy">')
|
4
|
+
expect(output).to end_with('</div>')
|
5
|
+
end
|
6
|
+
it 'should be html-safe' do
|
7
|
+
expect(output).to be_html_safe
|
8
|
+
end
|
9
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: attributarchy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Canipe
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.14
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.14
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec-rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.14.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.14.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec-html-matchers
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.4.3
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.3
|
62
|
+
description: An attribute-driven hierarchy builder for Rails views.
|
63
|
+
email:
|
64
|
+
- chris.canipe+attributarchy@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- lib/attributarchy/controller_methods.rb
|
70
|
+
- lib/attributarchy/helpers.rb
|
71
|
+
- lib/attributarchy/version.rb
|
72
|
+
- lib/attributarchy.rb
|
73
|
+
- lib/tasks/attributarchy_tasks.rake
|
74
|
+
- spec/controller_methods_spec.rb
|
75
|
+
- spec/dummy/app/assets/javascripts/application.js
|
76
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
77
|
+
- spec/dummy/app/controllers/application_controller.rb
|
78
|
+
- spec/dummy/app/controllers/examples_controller.rb
|
79
|
+
- spec/dummy/app/helpers/application_helper.rb
|
80
|
+
- spec/dummy/app/views/examples/_continent.html.erb
|
81
|
+
- spec/dummy/app/views/examples/_country.html.erb
|
82
|
+
- spec/dummy/app/views/examples/index.html.erb
|
83
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
84
|
+
- spec/dummy/config/application.rb
|
85
|
+
- spec/dummy/config/boot.rb
|
86
|
+
- spec/dummy/config/environment.rb
|
87
|
+
- spec/dummy/config/environments/development.rb
|
88
|
+
- spec/dummy/config/environments/production.rb
|
89
|
+
- spec/dummy/config/environments/test.rb
|
90
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
91
|
+
- spec/dummy/config/initializers/inflections.rb
|
92
|
+
- spec/dummy/config/initializers/mime_types.rb
|
93
|
+
- spec/dummy/config/initializers/secret_token.rb
|
94
|
+
- spec/dummy/config/initializers/session_store.rb
|
95
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
96
|
+
- spec/dummy/config/locales/en.yml
|
97
|
+
- spec/dummy/config/routes.rb
|
98
|
+
- spec/dummy/config.ru
|
99
|
+
- spec/dummy/log/development.log
|
100
|
+
- spec/dummy/log/test.log
|
101
|
+
- spec/dummy/public/404.html
|
102
|
+
- spec/dummy/public/422.html
|
103
|
+
- spec/dummy/public/500.html
|
104
|
+
- spec/dummy/public/favicon.ico
|
105
|
+
- spec/dummy/Rakefile
|
106
|
+
- spec/dummy/README.rdoc
|
107
|
+
- spec/dummy/script/rails
|
108
|
+
- spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
109
|
+
- spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
110
|
+
- spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
111
|
+
- spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
112
|
+
- spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
113
|
+
- spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
114
|
+
- spec/fixtures/expectations/one_attributarchy.html
|
115
|
+
- spec/fixtures/expectations/two_attributarchies.html
|
116
|
+
- spec/fixtures/expectations/two_attributarchies_without_rendering_country.html
|
117
|
+
- spec/fixtures/partials/_country.html.erb
|
118
|
+
- spec/fixtures/partials/_state.html.erb
|
119
|
+
- spec/helpers_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- spec/support/helpers.rb
|
122
|
+
- spec/support/shared_examples_group_spec.rb
|
123
|
+
- MIT-LICENSE
|
124
|
+
- Rakefile
|
125
|
+
- README.md
|
126
|
+
homepage: https://github.com/epicyclist/attributarchy
|
127
|
+
licenses: []
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
segments:
|
139
|
+
- 0
|
140
|
+
hash: -430366995
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
hash: -430366995
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 1.8.24
|
153
|
+
signing_key:
|
154
|
+
specification_version: 3
|
155
|
+
summary: An attribute-driven hierarchy builder for Rails views.
|
156
|
+
test_files: []
|