thematic 0.0.13 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/thematic/tasks/thematic.rake +30 -8
- 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: 881df28e54c9efd0b321c2ec96f1345e2d85817c
|
4
|
+
data.tar.gz: 4a77e521cc4f14813e3f22c56cdbec4c20e465dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ea3cd9b15bb48deeca66760620b6aa945be97f0dd88d40f8f3fa25c5c0280f8c73b92c48ee52f0192abf8ff4d1bac1c75b45323e696ad50c49fbed9d8a2e6f1
|
7
|
+
data.tar.gz: 4d99796e44d079463a3b42f3efd6bdd5e2456a12c2cbfa0d71c978fd14095de66d9ae13683cd79d13ac356051f583b7d05170dbf986bb7a0b0555942e2de10f5
|
data/README.md
CHANGED
@@ -18,6 +18,13 @@ Navigate to the root folder of your application, and run the following command:
|
|
18
18
|
|
19
19
|
The root folder of your theme should be the one that contains the folders 'css' and 'js', as is standard in most WrapBoostrap themes.
|
20
20
|
|
21
|
+
You can also automatically grab an entire HTML template from the theme as well, and copy it into your app/views/layouts/application.html.erb. (WARNING: THIS WILL OVERWRITE ANY CUSTOM CODE YOU HAVE THERE. So this is something you would do early on in your project.) To do so, run this command:
|
22
|
+
|
23
|
+
rake thematic:template[../relative/path/to/your/theme/template/index.html]
|
24
|
+
|
25
|
+
The installation only copies JavaScript from the JS folder, but if there are additional plugins inside another plugins folder, you can also install each plugin individually with:
|
26
|
+
|
27
|
+
rake thematic:plugin[../relative/path/to/your/plugin/folder]
|
21
28
|
|
22
29
|
## Contributing
|
23
30
|
|
@@ -3,7 +3,7 @@ require 'fileutils'
|
|
3
3
|
namespace :thematic do
|
4
4
|
desc "descriptions of the task"
|
5
5
|
task :install, [:filepath] do |task, args|
|
6
|
-
# args[:filepath] represent the path of the theme
|
6
|
+
# args[:filepath] represent the path of the theme, which is inputed by the user
|
7
7
|
|
8
8
|
# CSS #################################
|
9
9
|
puts "Installing CSS..."
|
@@ -74,7 +74,6 @@ namespace :thematic do
|
|
74
74
|
tempfile.close
|
75
75
|
|
76
76
|
# IMAGES #################################
|
77
|
-
|
78
77
|
puts "Copying images..."
|
79
78
|
|
80
79
|
FileUtils.remove_dir "app/assets/images/#{theme_subfolder}" if File.exist?("app/assets/images/#{theme_subfolder}")
|
@@ -89,7 +88,6 @@ namespace :thematic do
|
|
89
88
|
end
|
90
89
|
|
91
90
|
# FONTS #################################
|
92
|
-
|
93
91
|
puts "Copying fonts..."
|
94
92
|
|
95
93
|
FileUtils.mkdir "app/assets/fonts" unless File.exist?("app/assets/fonts")
|
@@ -122,7 +120,6 @@ namespace :thematic do
|
|
122
120
|
FileUtils.mv("file.tmp", file_to_edit)
|
123
121
|
f.close
|
124
122
|
tempfile.close
|
125
|
-
|
126
123
|
end
|
127
124
|
|
128
125
|
# REWRITING URLS REFERENCED IN CSS ##########
|
@@ -136,7 +133,6 @@ namespace :thematic do
|
|
136
133
|
|
137
134
|
f.each do |line|
|
138
135
|
if line =~/background.*url/
|
139
|
-
# image_filename = /\(.*\)/.match(line)[0].delete('(').delete(')').split("/").last.delete('"')
|
140
136
|
image_filename = /".*"/.match(line)[0].split("img/").last.delete('"')
|
141
137
|
new_snippet = "(\"<%= asset_path('#{theme_subfolder}/#{image_filename}') %>\")"
|
142
138
|
modified_line = line.gsub(/\(.*\)/, new_snippet)
|
@@ -148,10 +144,8 @@ namespace :thematic do
|
|
148
144
|
FileUtils.mv("file.tmp", file_to_edit)
|
149
145
|
f.close
|
150
146
|
tempfile.close
|
151
|
-
|
152
|
-
puts "Theme installed!"
|
153
|
-
|
154
147
|
end
|
148
|
+
puts "Theme installed!"
|
155
149
|
end
|
156
150
|
|
157
151
|
task :plugin, [:filepath] do |task, args|
|
@@ -183,4 +177,32 @@ namespace :thematic do
|
|
183
177
|
tempfile.close
|
184
178
|
end
|
185
179
|
|
180
|
+
task :template, [:filepath] do |task, args|
|
181
|
+
theme_subfolder = "theme"
|
182
|
+
|
183
|
+
# user is expected to input which html template to copy from
|
184
|
+
sourcefile = File.open(args[:filepath], 'r')
|
185
|
+
|
186
|
+
file_to_edit = "app/views/layouts/application.html.erb"
|
187
|
+
f = File.new(file_to_edit)
|
188
|
+
|
189
|
+
tempfile = File.open("file.tmp", 'w')
|
190
|
+
f.each do |line|
|
191
|
+
break if line =~/<body/ #we will remove existing body and replace it from theme
|
192
|
+
tempfile << line
|
193
|
+
end
|
194
|
+
|
195
|
+
reached_body = false
|
196
|
+
sourcefile.each do |line|
|
197
|
+
reached_body = true if line =~/<body/
|
198
|
+
next unless reached_body
|
199
|
+
tempfile << line.gsub("img/", "assets/#{theme_subfolder}/")
|
200
|
+
end
|
201
|
+
|
202
|
+
FileUtils.mv("file.tmp", file_to_edit)
|
203
|
+
f.close
|
204
|
+
tempfile.close
|
205
|
+
sourcefile.close
|
206
|
+
end
|
207
|
+
|
186
208
|
end
|
data/lib/thematic/version.rb
CHANGED