module AliadaWebappRails class Assets def self.webapp_js_file @js_filename ||= parse_js_asset_route end def self.webapp_css_file @css_filename ||= parse_css_asset_route end class << self private def parse_js_asset_route js_file = gem_files.select { |file| webapp_js_file?(file) }.first js_file.gsub(/^public/, "") end def parse_css_asset_route css_file = gem_files.select { |file| webapp_css_file?(file) }.first css_file.gsub(/^public/, "") end def gem_files Gem::Specification.find_by_name("aliada_webapp_rails").files end def webapp_js_file?(file) case Rails.env when 'production' file[/public\/aliada_webapp_rails\/assets\/production\/app\..*\.js$/] else file[/public\/aliada_webapp_rails\/assets\/staging\/app\..*\.js$/] end end def webapp_css_file?(file) case Rails.env when 'production' file[/public\/aliada_webapp_rails\/assets\/production\/app\..*\.css$/] else file[/public\/aliada_webapp_rails\/assets\/staging\/app\..*\.css$/] end end end end end