Pregunta

My code is here

 if File.extname(params[:build][:app_url].original_filename).include? ('ipa')
                builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
                    xml.plist(:version => '1.0') do
                        xml.dict do
                            xml.key "items"
                            xml.array do
                                xml.dict do
                                    xml.key "assets"
                                    xml.array do
                                        xml.dict do
                                            xml.key "kind"
                                            xml.string "software-package"
                                            xml.key "url"
                                            xml.string "#{build.app_url.url}"
                                        end
                                    end
                                    xml.key "metadata"
                                    xml.dict do
                                        xml.key "bundle-identifier"
                                        xml.string "1.0"
                                        xml.key "kind"
                                        xml.string "software"
                                        xml.key "title"
                                        xml.string "#{build.app_url_file_name.split('.').first}"
                                    end
                                end
                            end
                        end
                    end
                end
                dir = "#{Rails.root}/public/ipa"
                File.open("#{dir}/#{build.id}.plist", "w+") do |f|
                  f.write(builder.to_xml)
                end
                build.plist_url = "/ipa/#{build.id}.plist"
                build.save
            end

This code is working fine but when i deploy on heroku it's not working. when i m hitting mydomain/ipa/build_id.plist it gives us file not found.

¿Fue útil?

Solución

Heroku's documentation specifically states:

The following types of behaviors are not supported:

  • Caching pages in the public directory
  • Saving uploaded assets to local disk (e.g. with attachment_fu or paperclip)
  • Writing full-text indexes with Ferret
  • Writing to a filesystem database like SQLite or GDBM
  • Accessing a git repo for an app like git-wiki

Is pre-generating the .plist file(s) using a Raketask an option for you? Then you could check them into version control in your public directory.

Otros consejos

The filesystem on heroku is ephemeral: changes do not persist and are not replicated across dynos.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top