engine-assets 0.4.2 → 0.5.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/.gitignore +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +38 -0
- data/LICENSE +18 -17
- data/RAILS_VERSIONS +5 -0
- data/README.md +55 -0
- data/Rakefile +253 -26
- data/VERSION +1 -1
- data/app/controllers/engine_assets/assets_controller.rb +7 -1
- data/config/routes.rb +12 -1
- data/engine-assets.gemspec +53 -20
- data/features/rails.feature +127 -0
- data/features/step_definitions/rails_steps.rb +112 -0
- data/features/support/env.rb +15 -0
- data/features/support/rails.rb +125 -0
- data/features/support/terminal.rb +83 -0
- data/init.rb +1 -0
- data/lib/engine-assets.rb +8 -2
- data/lib/engine_assets/engine.rb +3 -0
- data/lib/engine_assets/extensions/rails/assets.rb +6 -0
- data/lib/engine_assets/public_locator.rb +20 -5
- data/spec/{controllers → app/controllers/engine_assets}/javascripts_controller_spec.rb +2 -2
- data/spec/{controllers → app/controllers/engine_assets}/stylesheets_controller_spec.rb +2 -2
- data/spec/lib/engine-assets_spec.rb +7 -0
- data/spec/lib/engine_assets/public_locator_spec.rb +28 -4
- data/spec/shared/assets_controller_spec.rb +39 -0
- data/spec/shared/assets_routing_spec.rb +59 -0
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +61 -22
- data/spec/support/Gemfile-2.3.5 +7 -0
- data/spec/support/Gemfile-2.3.5.lock +38 -0
- data/spec/support/Gemfile-2.3.9 +7 -0
- data/spec/support/Gemfile-2.3.9.lock +38 -0
- data/spec/support/Gemfile-3.0.0 +16 -0
- data/spec/support/Gemfile-3.0.0.lock +90 -0
- data/spec/support/rails.rb +32 -0
- data/spec/support/terminal.rb +54 -0
- metadata +123 -25
- data/README.rdoc +0 -18
- data/TODO.md +0 -4
- data/rails/init.rb +0 -7
- data/spec/spec_suite.rb +0 -26
- data/spec/support/shared/assets_controller_spec.rb +0 -34
- data/spec/support/shared/assets_routing_spec.rb +0 -55
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (2.1.2)
|
5
|
+
cucumber (0.8.5)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
diff-lcs (~> 1.1.2)
|
8
|
+
gherkin (~> 2.1.4)
|
9
|
+
json_pure (~> 1.4.3)
|
10
|
+
term-ansicolor (~> 1.0.4)
|
11
|
+
diff-lcs (1.1.2)
|
12
|
+
gemcutter (0.6.1)
|
13
|
+
gherkin (2.1.5)
|
14
|
+
trollop (~> 1.16.2)
|
15
|
+
git (1.2.5)
|
16
|
+
jeweler (1.4.0)
|
17
|
+
gemcutter (>= 0.1.0)
|
18
|
+
git (>= 1.2.5)
|
19
|
+
rubyforge (>= 2.0.0)
|
20
|
+
json_pure (1.4.6)
|
21
|
+
rake (0.8.7)
|
22
|
+
rr (1.0.0)
|
23
|
+
rspec (1.3.0)
|
24
|
+
rubyforge (2.0.4)
|
25
|
+
json_pure (>= 1.1.7)
|
26
|
+
term-ansicolor (1.0.5)
|
27
|
+
trollop (1.16.2)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
cucumber (~> 0.8.5)
|
34
|
+
jeweler (~> 1.4.0)
|
35
|
+
rake (~> 0.8.7)
|
36
|
+
rr (~> 1.0.0)
|
37
|
+
rspec (~> 1.3.0)
|
38
|
+
term-ansicolor (~> 1.0.5)
|
data/LICENSE
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License
|
2
2
|
|
3
|
-
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
Copyright (c) 2009, 2010 Corey Innis
|
10
4
|
|
11
|
-
|
12
|
-
|
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:
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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/RAILS_VERSIONS
ADDED
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
engine-assets
|
2
|
+
==============================================================================
|
3
|
+
|
4
|
+
*Rails Engines with assets*
|
5
|
+
|
6
|
+
engine-assets is a Rails Engine which enables other Rails Engines to provide
|
7
|
+
assets:
|
8
|
+
|
9
|
+
* javascript
|
10
|
+
* css
|
11
|
+
* images (TODO)
|
12
|
+
|
13
|
+
|
14
|
+
Requirements
|
15
|
+
------------------------------------------------------------------------------
|
16
|
+
|
17
|
+
* Rails
|
18
|
+
supported versions:
|
19
|
+
* 2.3.5
|
20
|
+
* 2.3.9
|
21
|
+
* 3.0.0 (requires Ruby 1.8.7)
|
22
|
+
|
23
|
+
Installation
|
24
|
+
------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
|
27
|
+
Usage
|
28
|
+
------------------------------------------------------------------------------
|
29
|
+
|
30
|
+
* Rake Tasks
|
31
|
+
|
32
|
+
Customization
|
33
|
+
------------------------------------------------------------------------------
|
34
|
+
|
35
|
+
|
36
|
+
TODO
|
37
|
+
------------------------------------------------------------------------------
|
38
|
+
|
39
|
+
|
40
|
+
Contributors
|
41
|
+
------------------------------------------------------------------------------
|
42
|
+
|
43
|
+
* Corey Innis <http://github.com/coreyti>
|
44
|
+
Author
|
45
|
+
|
46
|
+
Acknowledgments
|
47
|
+
------------------------------------------------------------------------------
|
48
|
+
|
49
|
+
* thoughtbot <http://thoughtbot.com/>
|
50
|
+
For insight regarding techniques for running Cucumber features against
|
51
|
+
multiple versions of Rails (in hoptoad_notifier).
|
52
|
+
* Michael Bleigh <http://mbleigh.com>
|
53
|
+
For insight regarding techniques for running RSpec specs against multiple
|
54
|
+
versions of Rails (in acts-as-taggable-on).
|
55
|
+
|
data/Rakefile
CHANGED
@@ -1,49 +1,276 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
# Bundler.setup
|
5
|
+
|
2
6
|
require 'rake'
|
3
7
|
|
8
|
+
|
9
|
+
desc 'Default: run all specs and features'
|
10
|
+
task :default => ['spec:rails:all', 'cucumber:rails:all']
|
11
|
+
|
12
|
+
|
13
|
+
# shared
|
14
|
+
# ----------------------------------------------------------------------------
|
15
|
+
RAILS_VERSIONS = { :supported => [], :unsupported => [] }
|
16
|
+
File.readlines('RAILS_VERSIONS').each do |line|
|
17
|
+
line.strip!
|
18
|
+
|
19
|
+
if (m = /\* ([0-9.]+)/.match(line))
|
20
|
+
if line =~ /supported/
|
21
|
+
RAILS_VERSIONS[:supported] << m[1]
|
22
|
+
else
|
23
|
+
RAILS_VERSIONS[:unsupported] << m[1]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
RAILS_VERSIONS[:all] = RAILS_VERSIONS[:supported] +
|
28
|
+
RAILS_VERSIONS[:unsupported]
|
29
|
+
|
30
|
+
GEM_ROOT = File.dirname(__FILE__).freeze
|
31
|
+
LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
|
32
|
+
RSPEC_1_VERSION = '1.3.0'
|
33
|
+
RSPEC_2_VERSION = '2.0.0.beta.22'
|
34
|
+
LOCAL_GEMS = [
|
35
|
+
['builder', nil],
|
36
|
+
['bundler', nil],
|
37
|
+
['rake', nil],
|
38
|
+
['rspec', RSPEC_1_VERSION],
|
39
|
+
['rspec-rails', '1.3.2'],
|
40
|
+
['rspec', RSPEC_2_VERSION],
|
41
|
+
['rspec-rails', RSPEC_2_VERSION],
|
42
|
+
['sqlite3-ruby', nil]
|
43
|
+
] + RAILS_VERSIONS[:supported].collect { |version| ['rails', version] }
|
44
|
+
|
45
|
+
def banner
|
46
|
+
puts '-' * 80
|
47
|
+
puts yield.gsub(/^[ ]+/, '')
|
48
|
+
puts '-' * 80
|
49
|
+
end
|
50
|
+
|
51
|
+
def print_missing(pkg_name, gem_name)
|
52
|
+
banner {
|
53
|
+
<<-DOC
|
54
|
+
#{pkg_name} (or a dependency) not available.
|
55
|
+
Install it with one of:
|
56
|
+
\t* bundle install
|
57
|
+
\t* sudo gem install #{gem_name}
|
58
|
+
DOC
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
namespace :shared do
|
63
|
+
task :vendor_dependencies do
|
64
|
+
old_gem_path = ENV['GEM_PATH']
|
65
|
+
old_gem_home = ENV['GEM_HOME']
|
66
|
+
ENV['GEM_PATH'] = LOCAL_GEM_ROOT
|
67
|
+
ENV['GEM_HOME'] = LOCAL_GEM_ROOT
|
68
|
+
|
69
|
+
LOCAL_GEMS.each do |gem_name, version|
|
70
|
+
gem_file_pattern = [gem_name, version || '*'].compact.join('-')
|
71
|
+
version_option = version ? "-v #{version}" : ''
|
72
|
+
pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
|
73
|
+
existing = Dir.glob(pattern).first
|
74
|
+
|
75
|
+
unless existing
|
76
|
+
command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
|
77
|
+
puts "Vendoring #{gem_file_pattern}..."
|
78
|
+
|
79
|
+
unless system("#{command} 2>&1")
|
80
|
+
puts "Command failed: #{command}"
|
81
|
+
exit(1)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
ENV['GEM_PATH'] = old_gem_path
|
87
|
+
ENV['GEM_HOME'] = old_gem_home
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
# cucumber tasks
|
93
|
+
# ----------------------------------------------------------------------------
|
94
|
+
begin
|
95
|
+
require 'term/ansicolor'
|
96
|
+
require 'cucumber/rake/task'
|
97
|
+
|
98
|
+
# Thanks thoughtbot...
|
99
|
+
def define_cucumber_rails(options = '')
|
100
|
+
namespace :rails do
|
101
|
+
RAILS_VERSIONS[:supported].each do |version|
|
102
|
+
desc "Run features for this gem with Rails #{version}"
|
103
|
+
task version => [:gemspec, 'shared:vendor_dependencies'] do
|
104
|
+
line = ENV['line']
|
105
|
+
|
106
|
+
banner {
|
107
|
+
"Running scenarios against Rails #{version}" + (line ? " (at line #{line})" : '')
|
108
|
+
}
|
109
|
+
ENV['RAILS_VERSION'] = version
|
110
|
+
|
111
|
+
system("cucumber --format #{cucumber_format} #{options} features/rails.feature#{line ? ':' + line : ''}")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
RAILS_VERSIONS[:unsupported].each do |version|
|
116
|
+
desc "Run features for this gem with Rails #{version}"
|
117
|
+
task version => [:gemspec] do
|
118
|
+
banner {
|
119
|
+
"Rails #{version} (unsupported -- see note in RAILS_VERSIONS)"
|
120
|
+
}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "Run features for this gem with all Rails versions"
|
125
|
+
task :all => RAILS_VERSIONS[:all]
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def cucumber_format
|
130
|
+
ENV['CUCUMBER_FORMAT'] || 'progress'
|
131
|
+
end
|
132
|
+
|
133
|
+
namespace :cucumber do
|
134
|
+
define_cucumber_rails
|
135
|
+
|
136
|
+
namespace :wip do
|
137
|
+
define_cucumber_rails('--tags @wip')
|
138
|
+
end
|
139
|
+
end
|
140
|
+
rescue LoadError
|
141
|
+
print_missing('Cucumber', 'cucumber')
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
# jeweler tasks
|
146
|
+
# ----------------------------------------------------------------------------
|
4
147
|
begin
|
5
148
|
require 'jeweler'
|
149
|
+
|
6
150
|
Jeweler::Tasks.new do |gem|
|
7
151
|
gem.name = "engine-assets"
|
8
152
|
gem.summary = "Rails Engines with assets."
|
9
|
-
gem.description = "A Rails Engine, which enables Rails Engines to
|
153
|
+
gem.description = "A Rails Engine, which enables Rails Engines to " +
|
154
|
+
"provide assets (javascript, css and images)"
|
10
155
|
gem.email = "support@coolerator.net"
|
11
156
|
gem.homepage = "http://github.com/coreyti/engine-assets"
|
12
157
|
gem.authors = ["Corey Innis"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.8"
|
14
|
-
gem.files += Dir['app/**/*.rb']
|
15
|
-
gem.files += Dir['lib/**/*.rb']
|
16
|
-
gem.files.uniq! # TODO (CTI): figure out why I'm having to do this manipulation.
|
17
158
|
|
18
|
-
|
159
|
+
gem.add_bundler_dependencies
|
160
|
+
gem.files << 'INSTALL'
|
161
|
+
gem.files << 'LICENSE'
|
162
|
+
gem.files << 'README'
|
163
|
+
gem.files << 'VERSION'
|
164
|
+
gem.files << 'init.rb'
|
165
|
+
gem.files << 'install.rb'
|
166
|
+
gem.files += Dir['app/**/*.rb']
|
167
|
+
gem.files += Dir['config/**/*.rb']
|
168
|
+
gem.files += Dir['lib/**/*.rb']
|
19
169
|
end
|
20
|
-
Jeweler::GemcutterTasks.new
|
21
170
|
rescue LoadError
|
22
|
-
|
171
|
+
print_missing('Jeweler', 'jeweler')
|
23
172
|
end
|
24
173
|
|
25
|
-
require 'spec/rake/spectask'
|
26
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
27
|
-
spec.libs << 'lib' << 'spec'
|
28
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
-
end
|
30
174
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
175
|
+
# rdoc tasks
|
176
|
+
# ----------------------------------------------------------------------------
|
177
|
+
begin
|
178
|
+
require 'rake/rdoctask'
|
179
|
+
|
180
|
+
Rake::RDocTask.new do |rdoc|
|
181
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
182
|
+
|
183
|
+
rdoc.rdoc_dir = 'rdoc'
|
184
|
+
rdoc.title = "example-engine #{version}"
|
185
|
+
rdoc.rdoc_files.include('README*')
|
186
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
187
|
+
end
|
188
|
+
rescue LoadError
|
189
|
+
print_missing('RDoc', 'rdoc')
|
35
190
|
end
|
36
191
|
|
37
|
-
task :spec => :check_dependencies
|
38
192
|
|
39
|
-
|
193
|
+
# rspec tasks
|
194
|
+
# ----------------------------------------------------------------------------
|
195
|
+
def define_spec_rails
|
196
|
+
def spec_rails_2
|
197
|
+
$:.unshift("#{LOCAL_GEM_ROOT}/gems/rspec-#{RSPEC_1_VERSION}/lib")
|
198
|
+
|
199
|
+
require 'spec/rake/spectask'
|
200
|
+
|
201
|
+
Spec::Rake::SpecTask.new(:spec) do |task|
|
202
|
+
task.libs << 'lib' << 'spec'
|
203
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def spec_rails_3
|
208
|
+
$:.unshift("#{LOCAL_GEM_ROOT}/gems/rspec-core-#{RSPEC_2_VERSION}/lib")
|
40
209
|
|
41
|
-
require '
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
210
|
+
require 'rspec/core/rake_task'
|
44
211
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
212
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
213
|
+
task.pattern = "spec/**/*_spec.rb"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
namespace :rails do
|
218
|
+
RAILS_VERSIONS[:supported].each do |version|
|
219
|
+
desc "Run specs for this gem with Rails #{version}"
|
220
|
+
task version => [:gemspec, 'shared:vendor_dependencies'] do
|
221
|
+
banner {
|
222
|
+
"Running specs against Rails #{version}"
|
223
|
+
}
|
224
|
+
|
225
|
+
major = version.split('.')[0]
|
226
|
+
|
227
|
+
# Thanks acts-as-taggable-on
|
228
|
+
gemfile = File.join(GEM_ROOT, 'spec', 'support', "Gemfile-#{version}")
|
229
|
+
ENV['RAILS_VERSION'] = version
|
230
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
231
|
+
ENV['RAILS_VERSION_SPEC'] = 'true'
|
232
|
+
|
233
|
+
send("spec_rails_#{major}")
|
234
|
+
|
235
|
+
Rake::Task['spec'].execute # NOTE: #invoke only runs once
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
RAILS_VERSIONS[:unsupported].each do |version|
|
240
|
+
desc "Run specs for this gem with Rails #{version}"
|
241
|
+
task version => [:gemspec] do
|
242
|
+
banner {
|
243
|
+
"Rails #{version} (unsupported -- see note in RAILS_VERSIONS)"
|
244
|
+
}
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
desc "Run specs for this gem with all Rails versions"
|
249
|
+
task :all do
|
250
|
+
RAILS_VERSIONS[:all].each do |version|
|
251
|
+
system("rake spec:rails:#{version}")
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
49
255
|
end
|
256
|
+
|
257
|
+
namespace :spec do
|
258
|
+
define_spec_rails
|
259
|
+
|
260
|
+
task :check_mode do
|
261
|
+
unless ENV['RAILS_VERSION_SPEC']
|
262
|
+
bullet = "\t* "
|
263
|
+
valid = Rake.application.tasks.select { |t| t.name =~ /spec:rails/ }
|
264
|
+
|
265
|
+
banner {
|
266
|
+
<<-DOC
|
267
|
+
Please use one of the following Rails-versioned spec tasks:
|
268
|
+
#{bullet}#{valid.join("\n" + bullet)}
|
269
|
+
DOC
|
270
|
+
}
|
271
|
+
raise RuntimeError
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
task :spec => 'spec:check_mode'
|