thematic 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thematic/tasks/thematic.rake +15 -6
- data/lib/thematic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64eaadb8a78f5cfb10df559dfc26e6e376652fdf
|
4
|
+
data.tar.gz: b09dfd02ced1247fc3c806ab3e6f1bb43b2b2a16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d307561fb7ba2bf69919e0b57c9ad08924fa0a08de05c478d2a4b6174806db95d5eeb93412daa7462074fd55bb94c3401784e6ea2e1311db8ad7f9bb927a062b
|
7
|
+
data.tar.gz: c2f331fd623bb1eb35e20d245b82aa3180d9f6ad7c24f4a4add82790f93655077c0c962a5c8f0a26a6f78d0e2cff53d4e6032aaf991c25bb8cdae31e726df602
|
@@ -5,8 +5,7 @@ namespace :thematic do
|
|
5
5
|
task :install, [:filepath] do |task, args|
|
6
6
|
# args[:filepath] represent the path of the theme
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# CSS #################################
|
10
9
|
puts "Installing CSS..."
|
11
10
|
|
12
11
|
# We will search the entire theme and all subfolders for all css files
|
@@ -41,6 +40,7 @@ namespace :thematic do
|
|
41
40
|
f.close
|
42
41
|
tempfile.close
|
43
42
|
|
43
|
+
# JS #################################
|
44
44
|
puts "Installing JS..."
|
45
45
|
|
46
46
|
# We will only search the js folder for js files; plugins can be added via the plugin task below
|
@@ -73,18 +73,23 @@ namespace :thematic do
|
|
73
73
|
f.close
|
74
74
|
tempfile.close
|
75
75
|
|
76
|
+
# IMAGES #################################
|
77
|
+
|
76
78
|
puts "Copying images..."
|
77
79
|
|
78
80
|
FileUtils.remove_dir "app/assets/images/#{theme_subfolder}" if File.exist?("app/assets/images/#{theme_subfolder}")
|
79
81
|
FileUtils.mkdir "app/assets/images/#{theme_subfolder}"
|
80
82
|
|
81
83
|
copy_from_path = "#{args[:filepath]}/img"
|
82
|
-
files_to_copy = Dir[ File.join(copy_from_path, '**', '*') ]
|
83
84
|
|
84
|
-
|
85
|
-
|
85
|
+
# We copy all files AND FOLDERS as they exist in the theme folder structure
|
86
|
+
Dir.open(copy_from_path).each do |filename|
|
87
|
+
next if filename[0] == "."
|
88
|
+
cp_r("#{copy_from_path}/#{filename}", "app/assets/images/#{theme_subfolder}/")
|
86
89
|
end
|
87
90
|
|
91
|
+
# FONTS #################################
|
92
|
+
|
88
93
|
puts "Copying fonts..."
|
89
94
|
|
90
95
|
FileUtils.mkdir "app/assets/fonts" unless File.exist?("app/assets/fonts")
|
@@ -120,6 +125,7 @@ namespace :thematic do
|
|
120
125
|
|
121
126
|
end
|
122
127
|
|
128
|
+
# REWRITING URLS REFERENCED IN CSS ##########
|
123
129
|
if File.exist?("vendor/assets/stylesheets/#{theme_subfolder}/style.css")
|
124
130
|
puts "Configuring images referenced in CSS..."
|
125
131
|
FileUtils.mv("vendor/assets/stylesheets/#{theme_subfolder}/style.css", "vendor/assets/stylesheets/#{theme_subfolder}/style.css.erb")
|
@@ -130,7 +136,8 @@ namespace :thematic do
|
|
130
136
|
|
131
137
|
f.each do |line|
|
132
138
|
if line =~/background.*url/
|
133
|
-
image_filename = /\(.*\)/.match(line)[0].delete('(').delete(')').split("/").last.delete('"')
|
139
|
+
# image_filename = /\(.*\)/.match(line)[0].delete('(').delete(')').split("/").last.delete('"')
|
140
|
+
image_filename = /".*"/.match(line)[0].split("img/").last.delete('"')
|
134
141
|
new_snippet = "(\"<%= asset_path('#{theme_subfolder}/#{image_filename}') %>\")"
|
135
142
|
modified_line = line.gsub(/\(.*\)/, new_snippet)
|
136
143
|
tempfile << modified_line
|
@@ -142,6 +149,8 @@ namespace :thematic do
|
|
142
149
|
f.close
|
143
150
|
tempfile.close
|
144
151
|
|
152
|
+
puts "Theme installed!"
|
153
|
+
|
145
154
|
end
|
146
155
|
end
|
147
156
|
|
data/lib/thematic/version.rb
CHANGED