thematic 0.1.1 → 0.1.2

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: bd4b70c607509150311f1b0895056fdacabf638d
4
- data.tar.gz: d0de4d9b20799fa80b7d2cb8a70ad9b9733076af
3
+ metadata.gz: 595b4c78d370b9a5fa31f4245648d0d34af4f031
4
+ data.tar.gz: 92d105e2b217c90e4fb78267d4e8d724f18931ce
5
5
  SHA512:
6
- metadata.gz: 5d281a896c826a80ee5e3416348ccb9403b6c71f10a5285f0be4ed7fa7f173e2b24c030d6d8e76befbb22cfa3b0a260c2234017874b52632e27e105ee0682d96
7
- data.tar.gz: 8977ff80323b05eee48fb642905588b1fa2f0611388deffa23e8e41ce909b5e04ca602826abc8a9648cbcefebd21c380737cdeb0b772b49f42e28e5869aea58f
6
+ metadata.gz: 12875e4efc45866d767d72d4326fd64ef9398680f2e1bb73ebb11ab5518a283945b1dc63a662154989c98ed67c744d96f22635d338ab59663c6e8bb2e08c362e
7
+ data.tar.gz: d520b6534558fcf1751135ec5e79bf566871c7287a19071f82be1021e243d132927b38ab4b7f4b5817522ec792930b477ce41b4bd172667f0524936e009ab74a
@@ -12,6 +12,12 @@ namespace :thematic do
12
12
  copy_from_path = args[:filepath]
13
13
  theme_subfolder = "theme"
14
14
 
15
+ if File.exist?("#{args[:filepath]}/img")
16
+ images_folder = "img"
17
+ elsif File.exist?("#{args[:filepath]}/images")
18
+ images_folder = "images"
19
+ end
20
+
15
21
  FileUtils.remove_dir "vendor/assets/stylesheets/#{theme_subfolder}" if File.exist?("vendor/assets/stylesheets/#{theme_subfolder}")
16
22
  FileUtils.mkdir "vendor/assets/stylesheets/#{theme_subfolder}"
17
23
 
@@ -79,7 +85,7 @@ namespace :thematic do
79
85
  FileUtils.remove_dir "app/assets/images/#{theme_subfolder}" if File.exist?("app/assets/images/#{theme_subfolder}")
80
86
  FileUtils.mkdir "app/assets/images/#{theme_subfolder}"
81
87
 
82
- copy_from_path = "#{args[:filepath]}/img"
88
+ copy_from_path = "#{args[:filepath]}/#{images_folder}"
83
89
 
84
90
  # We copy all files AND FOLDERS as they exist in the theme folder structure
85
91
  Dir.open(copy_from_path).each do |filename|
@@ -137,7 +143,7 @@ namespace :thematic do
137
143
 
138
144
  f.each do |line|
139
145
  if line =~/background.*url/
140
- image_filename = /".*"/.match(line)[0].split("img/").last.delete('"')
146
+ image_filename = /("|').*("|')/.match(line)[0].split("#{images_folder}/").last.delete('"').delete("'")
141
147
  new_snippet = "(\"<%= asset_path('#{theme_subfolder}/#{image_filename}') %>\")"
142
148
  modified_line = line.gsub(/\(.*\)/, new_snippet)
143
149
  tempfile << modified_line
@@ -200,7 +206,7 @@ namespace :thematic do
200
206
  sourcefile.each do |line|
201
207
  reached_body = true if line =~/<body/
202
208
  next unless reached_body
203
- tempfile << line.gsub("img/", "assets/#{theme_subfolder}/")
209
+ tempfile << line.gsub("#{images_folder}/", "assets/#{theme_subfolder}/")
204
210
  end
205
211
 
206
212
  FileUtils.mv("file.tmp", file_to_edit)
@@ -1,3 +1,3 @@
1
1
  module Thematic
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thematic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Wengrow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler