This repository was archived by the owner on Jul 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathVendorfile
163 lines (142 loc) · 5.13 KB
/
Vendorfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# This file declares external JS and CSS dependencies for this project
# See https://github.com/grosser/vendorer
JQUERY_VER = "1.7.1"
JQUERY_UI_VER = "1.8.18"
# Given a path to a jQuery UI CSS theme file, find all the images referenced
# by the CSS and fetch them as vendor dependencies.
#
def fetch_jquery_theme_images(theme_css)
IO.readlines(theme_css).each do |line|
if (m = line.match /url\((images\/[^\)]+)\)/)
file m[1], "http://code.jquery.com/ui/#{JQUERY_UI_VER}/themes/redmond/#{m[1]}"
end
end
end
# External JavaScript libraries to be included with fiftyfive-wicket-js
#
folder "fiftyfive-wicket-js/src/main/resources/fiftyfive/wicket/js/lib" do
# 55 Minutes JavaScript utils (master)
#
folder "fiftyfive-utils", "git://github.com/55minutes/fiftyfive-util-js.git"
# Standard jQuery/UI dist
#
file "jquery.js", "http://code.jquery.com/jquery-#{JQUERY_VER}.js"
file "jquery-ui.js", "http://code.jquery.com/ui/#{JQUERY_UI_VER}/jquery-ui.js"
# jQuery UI Redmond theme CSS and images
folder "jquery-ui/themes/redmond" do
file "jquery-ui.redmond.css", "http://code.jquery.com/ui/#{JQUERY_UI_VER}/themes/redmond/jquery-ui.css" do |css|
fetch_jquery_theme_images(css)
end
end
end
# Helper method deletes all files in the specified directory except those
# explicitly provided. If the file to retain is a directory, move the contents
# of the directory up to the root level.
#
def retain_files(root_path, files)
Dir.chdir(root_path) do
Dir["*", ".gitignore"].each { |f| run "rm -rf '#{f}'" unless files.include? f }
files.each do |f|
if File.directory? f
`mv "#{f}/"* .`
`rm -r "#{f}"`
end
end
end
end
# Boilerplate from css3-foundation project to be included in fiftyfive-wicket-archetype.
# The css3 project doesn't quite fit the structure we have in Wicket, so we need to
# rearrange and in some cases edit the files.
#
folder "fiftyfive-wicket-archetype/src/main/resources/archetype-resources/src/main/resources" do
# Clone the styles/ portion of css3-foundation under resources/styles/
#
folder "styles", "git://github.com/55minutes/css3-foundation" do |path|
retain_files(path, %w(styles))
# Delete _documentation.scss; add _server-error.scss
File.delete File.join(path, "_documentation.scss")
rewrite File.join(path, "application.scss") do |scss|
scss.sub(/@import "documentation";/, '@import "server-error";')
end
# Add Wicket-specific server-error styles
File.open File.join(path, "_server-error.scss"), "w" do |f|
f.write <<-SCSS.gsub(/^ /, '')
/*-----[ server errors ]--------------------------------------------------------
| Styles for the server error pages. See _feature-1.scss for more details on
| how feature-specific styles should be organized.
*/
.server-error
{
#page
{
padding: $body-text-line-height $column-width;
p:last-of-type,
dl:last-of-type,
ol:last-of-type,
ul:last-of-type
{
margin-bottom: 0;
}
}
}
@media (min-width: 480px)
{
.server-error #page
{
max-width: 60rem;
}
}
@media (min-width: 768px)
{
.server-error #page
{
margin: 5rem auto;
border: 0.2rem solid $silver;
@include border-radius(1.5rem);
}
}
SCSS
end
# Modify selectors for validation to match Wicket markup
#
rewrite File.join(path, "shared", "_forms.scss") do |scss|
scss.sub!(/^(\s*\.error)\s*$/, '\1, .feedbackPanelERROR')
scss.sub!(/^(\s*ul\.error-explanation)\s*$/, '\1, ul.feedbackPanel')
end
rewrite File.join(path, "shared", "_foundation.scss") do |scss|
scss.sub!(/^(\s*\.alerts)\s*$/, '\1, \1 .feedbackPanel')
scss.sub!(/^(\s*\.message)\s*$/, '\1, li')
scss.sub!(/^(\s*&\.success)\s*$/, '\1, &.feedbackPanelSUCCESS')
scss.sub!(/^(\s*&\.warning)\s*$/, '\1, &.feedbackPanelINFO, &.feedbackPanelWARNING')
scss.sub!(/^(\s*&\.error)\s*$/, '\1, &.feedbackPanelERROR, &.feedbackPanelFATAL')
end
# Add Wicket-specific header styles
File.open File.join(path, "shared", "_header.scss"), "a" do |f|
f.write <<-SCSS.gsub(/^ /, '')
.row > header
{
margin-top: 2 * $body-text-line-height;
margin-bottom: $body-text-line-height - 0.1rem;
border-bottom: 0.1rem solid $light-stroke;
padding-bottom: $body-text-line-height / 2;
nav.auth-status
{
float: right;
}
}
.row > footer
{
color: $secondary-text-color;
font-style: italic;
}
SCSS
end
end
# Clone the images/ portion of css3-foundation under resources/images/
#
folder "images", "git://github.com/55minutes/css3-foundation" do |path|
retain_files(path, %w(images favicon.ico favicon.png))
# Remove the compiled icon, since compass will recreate it at build time
`rm #{path}/icon-*.png`
end
end