-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed how remote/local files are compared, thus allowing updating fil…
…es that have spaces or non-ascii characters.
- Loading branch information
Showing
1 changed file
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,14 @@ class FileManager | |
|
||
BOILERPLATE_URL = '[email protected]:Edicy/design-boilerplate.git' | ||
|
||
ASSET_FOLDER_MAP = { | ||
'image' => 'images', | ||
'stylesheet' => 'stylesheets', | ||
'javascript' => 'javascripts', | ||
'font' => 'assets', | ||
'unknown' => 'assets' | ||
} | ||
|
||
def initialize(client, opts = {}) | ||
@client = client | ||
@silent = opts.fetch(:silent, false) | ||
|
@@ -447,16 +455,8 @@ def create_asset(asset = nil) | |
&& asset.respond_to?(:asset_type) \ | ||
&& (asset.respond_to?(:public_url) || asset.respond_to?(:data)) | ||
|
||
folder_names = { | ||
'image' => 'images', | ||
'stylesheet' => 'stylesheets', | ||
'javascript' => 'javascripts', | ||
'font' => 'assets', | ||
'unknown' => 'assets' | ||
} | ||
|
||
if valid | ||
folder = folder_names.fetch(asset.asset_type, 'assets') | ||
folder = ASSET_FOLDER_MAP.fetch(asset.asset_type, 'assets') | ||
|
||
Dir.mkdir(folder) unless Dir.exist?(folder) | ||
Dir.chdir(folder) | ||
|
@@ -665,7 +665,8 @@ def layout_id_map(layouts = nil) | |
def layout_asset_id_map(assets=nil) | ||
assets ||= get_layout_assets | ||
assets.inject(Hash.new) do |memo, a| | ||
memo[a.public_url.gsub("http://#{@client.host}/", '')] = a.id | ||
filename = "#{ASSET_FOLDER_MAP.fetch(a.asset_type, 'assets')}/#{a.filename}" | ||
memo[filename] = a.id | ||
memo | ||
end | ||
end | ||
|