flatrack 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/flatrack.gemspec +6 -6
- data/lib/flatrack.rb +1 -0
- data/lib/flatrack/version.rb +1 -1
- data/lib/rake/asset_tasks.rb +9 -6
- data/spec/lib/rake/asset_tasks_spec.rb +47 -29
- data/spec/spec_helper.rb +1 -1
- data/spec/support/site_helper.rb +2 -2
- metadata +27 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18f2a64112e63e97157245c00c1ea592bf0afbdb
|
4
|
+
data.tar.gz: eca104199ffa912f5b4dbc87f8423027c0512a8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0d551d21329e7c2a1848e02c538a606dc558d32a0fcafbe40282c00a5ff26bab931cd44ba922220b07a8f634df322a0d21b951936e41d1ec24300616426f6e8
|
7
|
+
data.tar.gz: ead79f7435dd9b79962112da8d38866d13505163ea109b3bd37d012d3b80b9705ecc8e2c544aaa75481f8a9201e023f1dc0d7a6119e7b5eaa6e7db5aa1af788c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
gemspec
|
2
|
+
gemspec
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
[![Version](http://allthebadges.io/jwaldrip/flatrack/badge_fury.png)](http://allthebadges.io/jwaldrip/flatrack/badge_fury)
|
5
5
|
[![Dependencies](http://allthebadges.io/jwaldrip/flatrack/gemnasium.png)](http://allthebadges.io/jwaldrip/flatrack/gemnasium)
|
6
|
-
[![Build Status](http://allthebadges.io/jwaldrip/flatrack/travis.png
|
7
|
-
[![Coverage](http://allthebadges.io/jwaldrip/flatrack/coveralls.png)](http://allthebadges.io/jwaldrip/flatrack/coveralls)
|
6
|
+
[![Build Status](http://allthebadges.io/jwaldrip/flatrack/travis.png)](http://allthebadges.io/jwaldrip/flatrack/travis)
|
7
|
+
[![Coverage](http://allthebadges.io/jwaldrip/flatrack/coveralls.png?1)](http://allthebadges.io/jwaldrip/flatrack/coveralls)
|
8
8
|
[![Code Climate](http://allthebadges.io/jwaldrip/flatrack/code_climate.png)](http://allthebadges.io/jwaldrip/flatrack/code_climate)
|
9
9
|
|
10
10
|
## About
|
data/flatrack.gemspec
CHANGED
@@ -30,20 +30,20 @@ based routing.
|
|
30
30
|
|
31
31
|
# Dependencies
|
32
32
|
spec.add_runtime_dependency 'rack', '~> 1.4'
|
33
|
-
spec.add_runtime_dependency 'activesupport', '
|
33
|
+
spec.add_runtime_dependency 'activesupport', ['> 3.2', '< 4.2']
|
34
34
|
spec.add_runtime_dependency 'sass', '~> 3.2'
|
35
35
|
spec.add_runtime_dependency 'sprockets-sass', '~> 1.0'
|
36
36
|
spec.add_runtime_dependency 'thor', '~> 0.18'
|
37
37
|
spec.add_runtime_dependency 'coffee-script', '~> 2.2'
|
38
|
-
spec.add_runtime_dependency 'rake', '
|
38
|
+
spec.add_runtime_dependency 'rake', ['> 0.8.7', '< 10.2']
|
39
39
|
|
40
40
|
# Dev Dependencies
|
41
41
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
42
|
-
spec.add_development_dependency 'rspec', '~>
|
42
|
+
spec.add_development_dependency 'rspec', '~> 2.14'
|
43
43
|
spec.add_development_dependency 'guard', '~> 2.5'
|
44
44
|
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
45
45
|
spec.add_development_dependency 'guard-bundler', '~> 2.0'
|
46
|
-
spec.add_development_dependency 'pry', '~> 0.9
|
47
|
-
spec.add_development_dependency 'coveralls', '~> 0.7
|
48
|
-
spec.add_development_dependency 'simplecov', '~> 0.8
|
46
|
+
spec.add_development_dependency 'pry', '~> 0.9'
|
47
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
48
|
+
spec.add_development_dependency 'simplecov', '~> 0.8'
|
49
49
|
end
|
data/lib/flatrack.rb
CHANGED
data/lib/flatrack/version.rb
CHANGED
data/lib/rake/asset_tasks.rb
CHANGED
@@ -10,11 +10,13 @@ module Rake
|
|
10
10
|
#
|
11
11
|
class AssetTasks < Rake::TaskLib
|
12
12
|
attr_accessor :output
|
13
|
-
|
13
|
+
attr_reader :environment
|
14
14
|
attr_reader :index
|
15
15
|
attr_reader :manifest
|
16
16
|
attr_reader :keep
|
17
17
|
|
18
|
+
delegate :paths, to: :environment
|
19
|
+
|
18
20
|
# Number of old assets to keep.
|
19
21
|
|
20
22
|
# Logger to use during rake tasks. Defaults to using stderr.
|
@@ -46,15 +48,16 @@ module Rake
|
|
46
48
|
@logger = Logger.new($stderr)
|
47
49
|
@logger.level = Logger::INFO
|
48
50
|
@output = './public/assets'
|
49
|
-
yield self
|
50
|
-
@index
|
51
|
-
@manifest
|
52
|
-
@keep
|
51
|
+
yield self if block_given?
|
52
|
+
@index = environment.index
|
53
|
+
@manifest = Sprockets::Manifest.new(index, output)
|
54
|
+
@keep = 2
|
53
55
|
define
|
54
56
|
end
|
55
57
|
|
56
58
|
def assets
|
57
|
-
Dir['
|
59
|
+
files = paths.reduce([]) { |a, p| a + Dir[File.join p, '**', '*'] }
|
60
|
+
files.map do |file|
|
58
61
|
file_basename = File.basename file
|
59
62
|
parts = file_basename.split('.').size
|
60
63
|
file = file.split('.').tap(&:pop).join('.') if parts > 2
|
@@ -1,55 +1,73 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'flatrack'
|
2
3
|
require 'rake/asset_tasks'
|
3
|
-
require 'coffee-script'
|
4
4
|
|
5
5
|
describe Rake::AssetTasks do
|
6
6
|
include FileUtils
|
7
|
+
include SiteHelper
|
7
8
|
|
8
9
|
before(:all) do
|
9
|
-
@
|
10
|
-
|
10
|
+
@sha = site(clean: false) do
|
11
|
+
@rake = Rake::Application.new
|
12
|
+
Rake.application = @rake
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
@dir = File.join(Dir::tmpdir, 'sprockets/manifest')
|
14
|
+
@env = Flatrack.assets
|
15
|
+
@dir = File.join(Dir::tmpdir, 'sprockets/manifest')
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
t.output = @dir
|
23
|
-
t.log_level = :fatal
|
17
|
+
Rake::AssetTasks.new do |t|
|
18
|
+
t.output = @dir
|
19
|
+
t.log_level = :fatal
|
20
|
+
end
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
27
24
|
after(:all) do
|
28
25
|
Rake.application = nil
|
26
|
+
cleanup(@sha)
|
29
27
|
rm_rf(@dir)
|
30
28
|
expect(Dir["#{@dir}/*"]).to be_empty
|
31
29
|
end
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
describe '#log_level=' do
|
32
|
+
it 'should set the proper log level' do
|
33
|
+
@sha = site(clean: false) do
|
34
|
+
allow_any_instance_of(Rake::AssetTasks).to receive(:define)
|
35
|
+
tasks = Rake::AssetTasks.new do |t|
|
36
|
+
t.output = @dir
|
37
|
+
t.log_level = 1
|
38
|
+
end
|
39
|
+
expect(tasks.log_level).to eq 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
36
43
|
|
37
|
-
|
44
|
+
describe 'tasks' do
|
38
45
|
|
39
|
-
|
40
|
-
|
41
|
-
|
46
|
+
it "should precompile" do
|
47
|
+
digest_path = @env['main.js'].digest_path
|
48
|
+
expect(File.exist? "#{@dir}/#{digest_path}").to be false
|
42
49
|
|
43
|
-
|
44
|
-
digest_path = @env['application.js'].digest_path
|
50
|
+
@rake['assets:precompile'].invoke
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
expect(Dir["#{@dir}/manifest-*.json"]).to be_present
|
53
|
+
expect(File.exist? "#{@dir}/#{digest_path}").to be true
|
54
|
+
end
|
48
55
|
|
49
|
-
|
50
|
-
|
51
|
-
|
56
|
+
it "should clobber" do
|
57
|
+
digest_path = @env['main.js'].digest_path
|
58
|
+
|
59
|
+
@rake['assets:precompile'].invoke
|
60
|
+
expect(File.exist? "#{@dir}/#{digest_path}").to be true
|
61
|
+
|
62
|
+
@rake['assets:clobber'].invoke
|
63
|
+
expect(File.exist? "#{@dir}/#{digest_path}").to be false
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should clean" do
|
67
|
+
expect {
|
68
|
+
@rake['assets:clean'].invoke
|
69
|
+
}.to_not raise_error
|
70
|
+
end
|
52
71
|
|
53
|
-
xit "should clean" do
|
54
72
|
end
|
55
73
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/site_helper.rb
CHANGED
@@ -5,7 +5,7 @@ module SiteHelper
|
|
5
5
|
DIR = File.join Flatrack.gem_root, '../tmp/flatrack-sites'
|
6
6
|
mkdir_p DIR
|
7
7
|
|
8
|
-
def site
|
8
|
+
def site(clean: true)
|
9
9
|
sha = SecureRandom.hex
|
10
10
|
in_temp_sites do
|
11
11
|
Flatrack::CLI.start(
|
@@ -15,7 +15,7 @@ module SiteHelper
|
|
15
15
|
yield
|
16
16
|
end
|
17
17
|
end
|
18
|
-
cleanup sha
|
18
|
+
clean ? cleanup(sha) : sha
|
19
19
|
rescue => error
|
20
20
|
cleanup sha
|
21
21
|
raise error
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Waldrip
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '4.2'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">"
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '3.2'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '4.2'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: sass
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +104,22 @@ dependencies:
|
|
98
104
|
name: rake
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- - "
|
107
|
+
- - ">"
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
109
|
+
version: 0.8.7
|
110
|
+
- - "<"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '10.2'
|
104
113
|
type: :runtime
|
105
114
|
prerelease: false
|
106
115
|
version_requirements: !ruby/object:Gem::Requirement
|
107
116
|
requirements:
|
108
|
-
- - "
|
117
|
+
- - ">"
|
109
118
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
119
|
+
version: 0.8.7
|
120
|
+
- - "<"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '10.2'
|
111
123
|
- !ruby/object:Gem::Dependency
|
112
124
|
name: bundler
|
113
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +140,14 @@ dependencies:
|
|
128
140
|
requirements:
|
129
141
|
- - "~>"
|
130
142
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
143
|
+
version: '2.14'
|
132
144
|
type: :development
|
133
145
|
prerelease: false
|
134
146
|
version_requirements: !ruby/object:Gem::Requirement
|
135
147
|
requirements:
|
136
148
|
- - "~>"
|
137
149
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
150
|
+
version: '2.14'
|
139
151
|
- !ruby/object:Gem::Dependency
|
140
152
|
name: guard
|
141
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,42 +196,42 @@ dependencies:
|
|
184
196
|
requirements:
|
185
197
|
- - "~>"
|
186
198
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.9
|
199
|
+
version: '0.9'
|
188
200
|
type: :development
|
189
201
|
prerelease: false
|
190
202
|
version_requirements: !ruby/object:Gem::Requirement
|
191
203
|
requirements:
|
192
204
|
- - "~>"
|
193
205
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.9
|
206
|
+
version: '0.9'
|
195
207
|
- !ruby/object:Gem::Dependency
|
196
208
|
name: coveralls
|
197
209
|
requirement: !ruby/object:Gem::Requirement
|
198
210
|
requirements:
|
199
211
|
- - "~>"
|
200
212
|
- !ruby/object:Gem::Version
|
201
|
-
version: 0.7
|
213
|
+
version: '0.7'
|
202
214
|
type: :development
|
203
215
|
prerelease: false
|
204
216
|
version_requirements: !ruby/object:Gem::Requirement
|
205
217
|
requirements:
|
206
218
|
- - "~>"
|
207
219
|
- !ruby/object:Gem::Version
|
208
|
-
version: 0.7
|
220
|
+
version: '0.7'
|
209
221
|
- !ruby/object:Gem::Dependency
|
210
222
|
name: simplecov
|
211
223
|
requirement: !ruby/object:Gem::Requirement
|
212
224
|
requirements:
|
213
225
|
- - "~>"
|
214
226
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.8
|
227
|
+
version: '0.8'
|
216
228
|
type: :development
|
217
229
|
prerelease: false
|
218
230
|
version_requirements: !ruby/object:Gem::Requirement
|
219
231
|
requirements:
|
220
232
|
- - "~>"
|
221
233
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.8
|
234
|
+
version: '0.8'
|
223
235
|
description: |+
|
224
236
|
A rack based static site builder with templates, layouts and project structure
|
225
237
|
based routing.
|