thematic 0.0.12 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c14cbfc0c94da8836302cdbe2587aff8db3985a0
4
- data.tar.gz: 985c223be60f44878d26d4f3d85d7a509c73fcef
3
+ metadata.gz: 64eaadb8a78f5cfb10df559dfc26e6e376652fdf
4
+ data.tar.gz: b09dfd02ced1247fc3c806ab3e6f1bb43b2b2a16
5
5
  SHA512:
6
- metadata.gz: 2f2d55f4d49be4a3bd03519ec6149e2193a652e8c86b4d24bc9959e64a14e647f0fb0c1985509e8e55862f9fd5be9d231d1e117693b412fec066d7aa8762484c
7
- data.tar.gz: c5b69e53e25427fa458c3b07691188c9f6baf8147b00dd425a1762e7397e8d85cfd4a9f0be3617a480991f4124cefb5e35973bd6dc79c711a98a62d3884cfb93
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
- puts "Inspecting theme..."
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
- files_to_copy.each do |filepath|
85
- copy(filepath, "app/assets/images/#{theme_subfolder}/") unless File.directory?(filepath)
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
 
@@ -1,3 +1,3 @@
1
1
  module Thematic
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thematic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Wengrow