move towards mobile deployable app
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
#rm_rf Rails.root.join('public', 'assets')
|
||||
#`rake assets:precompile`
|
||||
android_root = '/Users/bterkuile/Documents/workspace/Qwaiter/assets'
|
||||
root_url = "file:///Users/bterkuile/Documents/workspace/Qwaiter/assets"
|
||||
mkdir_p File.join(android_root, 'user')
|
||||
rm_rf File.join(android_root, 'assets')
|
||||
cp_r Rails.root.join('public', 'assets'), File.join(android_root, 'assets')
|
||||
for css in Dir.glob(File.join(android_root, "**", "*.css"))
|
||||
contents = File.read(css)
|
||||
contents.gsub!(/url\("/, %|url("#{root_url}|)
|
||||
contents.gsub!(/url\(\//, %|url(#{root_url}/|)
|
||||
File.open(css, 'w'){|f| f.puts contents}
|
||||
end
|
||||
|
||||
|
||||
uc = UserController.new
|
||||
class << uc
|
||||
@@ -19,6 +35,9 @@ for action in uc.action_methods
|
||||
if File.exist?(Rails.root.join('app', 'views', 'user', "#{action}.html.slim"))
|
||||
puts "action #{action} found"
|
||||
result = uc.render_to_string(action: action.dup)
|
||||
#result.sub! /<head>/, '<head><base href="file:///Users/bterkuile/Documents/workspace/Qwaiter/assets/" target="_self" />'
|
||||
result.gsub! /(href|src)="([^#])/, %|\\1="#{root_url}\2|
|
||||
File.open(File.join(android_root, 'user', "#{action}.html"), 'w'){|f| f.puts result}
|
||||
end
|
||||
end
|
||||
view = view = ActionView::Base.new(uc.view_paths)
|
||||
@@ -35,4 +54,3 @@ class << view
|
||||
end
|
||||
end
|
||||
# view.render()
|
||||
binding.pry
|
||||
|
||||
Reference in New Issue
Block a user