Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Les dépendances pour les applications Ruby sont déclarées dans un fichier Gemfile.
Exemple :
source"https://rubygems.org"gem"rails"
Vous pouvez utiliser n'importe quel package Ruby compatible avec Linux dans l'environnement standard App Engine, y compris les packages qui requièrent des extensions (C) natives.
Lors du déploiement, l'environnement d'exécution Ruby installe automatiquement toutes les dépendances déclarées dans le fichier Gemfile.
Installer un framework Web
Vous devez utiliser un framework Web pour permettre à votre application de répondre aux requêtes Web.
Vous pouvez utiliser n'importe quel framework Web Ruby, y compris les suivants :
Pour utiliser un framework Web spécifique, indiquez une commande de démarrage dans votre fichier app.yaml :
runtime:rubyentrypoint:railsserver
Installation des bibliothèques clientes Cloud
La bibliothèque cliente Cloud pour Ruby permet d'accéder facilement aux services Google Cloud. De ce fait, la quantité de code récurrent que vous devez développer est fortement réduite. La bibliothèque fournit des abstractions d'API de haut niveau, ce qui implique que les API sont plus faciles à comprendre. Vous pouvez donc consacrer plus de temps à développer du code qui vous est réellement utile.
Pour installer la bibliothèque en local :
geminstallgoogle-cloud
La bibliothèque cliente peut également gérer automatiquement l'authentification en local en utilisant Google Cloud CLI :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/12/22 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2024/12/22 (UTC)."],[[["\u003cp\u003eRuby application dependencies are declared in a \u003ccode\u003eGemfile\u003c/code\u003e, and the runtime automatically installs these dependencies during deployment.\u003c/p\u003e\n"],["\u003cp\u003eAny Linux-compatible Ruby package, including those with native extensions, can be used in the App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eA web framework, such as Ruby on Rails, Sinatra, or Rack, is necessary to serve web requests, and the specific framework should be defined with an \u003ccode\u003eentrypoint\u003c/code\u003e in the \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Client Libraries for Ruby simplify interactions with Google Cloud services and reduce the amount of boilerplate code required.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Client Libraries can be installed locally using the \u003ccode\u003egem install google-cloud\u003c/code\u003e command and can handle authentication automatically using the \u003ccode\u003egcloud auth login\u003c/code\u003e command.\u003c/p\u003e\n"]]],[],null,["# Specifying dependencies\n\nDependencies for Ruby applications are declared in a\n[`Gemfile`](https://bundler.io/v2.4/man/gemfile.5.html)\nfile.\n\nFor example: \n\n source \"https://rubygems.org\"\n\n gem \"rails\"\n\nYou can use any Linux-compatible Ruby package in the App Engine standard\nenvironment, including packages that require native (C) extensions.\n\nThe Ruby runtime will [automatically install](/appengine/docs/standard/ruby/runtime#dependencies) all\ndependencies declared in your `Gemfile` file during deployment.\n\nInstalling a web framework\n--------------------------\n\nYou'll need to use a web framework to enable your app to serve web requests.\nYou can use any Ruby web framework including the following:\n\n- [Ruby on Rails](http://rubyonrails.org/)\n- [Sinatra](http://www.sinatrarb.com/)\n- [Rack](http://rack.github.io/)\n\nTo use a particular web framework, specify a startup command in your `app.yaml`\nfile: \n\n runtime: ruby\n entrypoint: rails server\n\nInstalling the Cloud Client Libraries\n-------------------------------------\n\nThe [Cloud Client Libraries for Ruby](/ruby/docs/reference) is a client\nlibrary for accessing Google Cloud services that significantly reduces\nthe boilerplate code you have to write. The library provides high-level API\nabstractions so they're easier to understand and means you spend more time\ncreating code that matters to you.\n\nTo install the library locally: \n\n gem install google-cloud\n\nThe client library can automatically handle authentication for you locally as\nwell by using [Google Cloud CLI](/sdk/docs): \n\n gcloud auth login\n\nFor details on configuring Cloud Client Libraries for Ruby to handle authentication\nautomatically, see [Authenticate to Cloud services using client libraries](/docs/authentication/client-libraries)."]]