Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
6a37fce5
Commit
6a37fce5
authored
Dec 22, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix merge with master
parent
74e58842
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
29 deletions
+26
-29
pipeline/packager.py
+7
-2
tests/settings.py
+3
-3
tests/tests/compressor.py
+7
-7
tests/tests/packager.py
+5
-15
tests/tests/storage.py
+4
-2
No files found.
pipeline/packager.py
View file @
6a37fce5
import
os
import
urlparse
from
django.core.files.base
import
ContentFile
...
...
@@ -56,6 +57,10 @@ class Package(object):
def
manifest
(
self
):
return
self
.
config
.
get
(
'manifest'
,
True
)
@property
def
absolute_paths
(
self
):
return
self
.
config
.
get
(
'absolute_asset_paths'
,
True
)
class
Packager
(
object
):
def
__init__
(
self
,
verbose
=
False
,
css_packages
=
None
,
js_packages
=
None
):
...
...
@@ -88,8 +93,8 @@ class Packager(object):
relative_url
)
def
pack_stylesheets
(
self
,
package
,
**
kwargs
):
variant
=
package
.
get
(
'variant'
,
None
)
absolute_asset_paths
=
package
.
get
(
'absolute_asset_paths'
,
True
)
variant
=
package
.
variant
absolute_asset_paths
=
package
.
absolute_paths
return
self
.
pack
(
package
,
self
.
compressor
.
compress_css
,
css_compressed
,
variant
=
variant
,
absolute_asset_paths
=
absolute_asset_paths
,
**
kwargs
)
...
...
tests/settings.py
View file @
6a37fce5
...
...
@@ -13,7 +13,7 @@ SITE_ID = 1
INSTALLED_APPS
=
[
'django.contrib.contenttypes'
,
'django.contrib.sites'
,
'
django.contrib.
staticfiles'
,
'staticfiles'
,
'django.contrib.auth'
,
'django.contrib.admin'
,
'pipeline'
,
...
...
@@ -31,8 +31,8 @@ STATICFILES_DIRS = (
local_path
(
'assets/'
),
)
STATICFILES_FINDERS
=
(
'
pipeline.finders.Pipeline
Finder'
,
'
django.contrib.staticfiles.finders.FileSystem
Finder'
'
staticfiles.finders.FileSystem
Finder'
,
'
staticfiles.finders.AppDirectories
Finder'
)
PIPELINE_ROOT
=
local_path
(
'assets/'
)
...
...
tests/tests/compressor.py
View file @
6a37fce5
...
...
@@ -87,10 +87,10 @@ class CompressorTest(TestCase):
def
test_construct_asset_path
(
self
):
asset_path
=
self
.
compressor
.
construct_asset_path
(
"../../images/sprite.png"
,
"css/plugins/gallery.css"
)
self
.
assertEquals
(
asset_path
,
"
http://localhost/static/
images/sprite.png"
)
self
.
assertEquals
(
asset_path
,
"images/sprite.png"
)
asset_path
=
self
.
compressor
.
construct_asset_path
(
"/images/sprite.png"
,
"css/plugins/gallery.css"
)
self
.
assertEquals
(
asset_path
,
"
http://localhost/static/
images/sprite.png"
)
self
.
assertEquals
(
asset_path
,
"images/sprite.png"
)
def
test_construct_asset_path_relative
(
self
):
asset_path
=
self
.
compressor
.
construct_asset_path
(
"../../images/sprite.png"
,
...
...
@@ -109,17 +109,17 @@ class CompressorTest(TestCase):
])
self
.
assertMultiLineEqual
(
"""@font-face {
font-family: 'Pipeline';
src: url(
http://localhost/static/
fonts/pipeline.eot);
src: url(
http://localhost/static/
fonts/pipeline.eot?#iefix) format('embedded-opentype');
src: local('☺'), url(
http://localhost/static/fonts/pipeline.woff) format('woff'), url(http://localhost/static/fonts/pipeline.ttf) format('truetype'), url(http://localhost/static/
fonts/pipeline.svg#IyfZbseF) format('svg');
src: url(fonts/pipeline.eot);
src: url(fonts/pipeline.eot?#iefix) format('embedded-opentype');
src: local('☺'), url(
fonts/pipeline.woff) format('woff'), url(fonts/pipeline.ttf) format('truetype'), url(
fonts/pipeline.svg#IyfZbseF) format('svg');
font-weight: normal;
font-style: normal;
}
.relative-url {
background-image: url(
http://localhost/static/
images/sprite-buttons.png);
background-image: url(images/sprite-buttons.png);
}
.absolute-url {
background-image: url(
http://localhost/static/
images/sprite-buttons.png);
background-image: url(images/sprite-buttons.png);
}
.absolute-full-url {
background-image: url(http://localhost/images/sprite-buttons.png);
...
...
tests/tests/packager.py
View file @
6a37fce5
...
...
@@ -14,7 +14,7 @@ class PackagerTest(TestCase):
'source_filenames'
:
(
'js/application.js'
,
),
'output_filename'
:
'application.
r?.
js'
'output_filename'
:
'application.js'
}
})
try
:
...
...
@@ -34,26 +34,17 @@ class PackagerTest(TestCase):
'source_filenames'
:
(
'templates/photo/list.jst'
,
),
'output_filename'
:
'templates.r?.js'
,
}
})
self
.
assertEqual
(
packages
,
{
'templates'
:
{
'templates'
:
[
'templates/photo/list.jst'
],
'manifest'
:
True
,
'paths'
:
[],
'context'
:
{},
'output'
:
'templates.r?.js'
'output_filename'
:
'templates.js'
,
}
})
self
.
assertEqual
(
packages
[
'templates'
]
.
templates
,
[
'templates/photo/list.jst'
])
def
test_individual_url
(
self
):
"""Check that individual URL is correctly generated"""
packager
=
Packager
()
filename
=
os
.
path
.
join
(
settings
.
PIPELINE_ROOT
,
u'js/application.js'
)
individual_url
=
packager
.
individual_url
(
filename
)
self
.
assertEqual
(
individual_url
,
"http://localhost/static/js/application.js"
)
self
.
assertEqual
(
individual_url
,
"/static/js/application.js"
)
def
test_periods_safe_individual_url
(
self
):
"""Check that the periods in file names do not get replaced by individual_url when
...
...
@@ -63,5 +54,4 @@ class PackagerTest(TestCase):
packager
=
Packager
()
filename
=
os
.
path
.
join
(
settings
.
PIPELINE_ROOT
,
u'js/application.js'
)
individual_url
=
packager
.
individual_url
(
filename
)
self
.
assertEqual
(
individual_url
,
"http://localhost/static/js/application.js"
)
self
.
assertEqual
(
individual_url
,
"/static/js/application.js"
)
tests/tests/storage.py
View file @
6a37fce5
...
...
@@ -12,7 +12,7 @@ class StorageTest(TestCase):
'css/first.css'
,
),
'manifest'
:
False
,
'output_filename'
:
'testing.
r?.
css'
,
'output_filename'
:
'testing.css'
,
}
}
self
.
storage
=
PipelineStorage
()
...
...
@@ -28,7 +28,9 @@ class StorageTest(TestCase):
])
self
.
assertEqual
(
processed_files
,
[
'css/first.css'
,
'images/arrow.png'
'images/arrow.png'
,
'testing.css'
,
'scripts.css'
])
def
tearDown
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment