【问题标题】:What is the best way to configure my RubyMotion App for Development, Testing, and Production Environments为开发、测试和生产环境配置我的 RubyMotion 应用程序的最佳方式是什么
【发布时间】:2013-02-06 02:21:44
【问题描述】:

我正在使用 RubyMotion 构建一个 iOS 应用。

我正在使用 Facebook 和 Parse。

我已经设置了三个不同的 Facebook 和 Parse 应用程序。

我应该如何设置 RubyMotion 以在每个环境中为每个应用程序使用正确的凭据?使用 yml 文件是否正确?如果是这样,我应该将它们放在哪里以及如何加载它们。

rails 中有 development.rb 之类的东西吗?

【问题讨论】:

    标签: environment-variables development-environment rubymotion


    【解决方案1】:

    我知道,至少可以区分两个版本。

    在您的 Rakefile 中,您可以使用 app.X 指定不同的内容:

      # Distribution - use rake archive:release
      app.release do
        # Release (production) items here
      end
    
      # Development - use rake archive
      app.development do
        # Dev stuff here
      end
    

    在其他地方,为了区分我使用这个:

    def development?
      RUBYMOTION_ENV == "development"
    end
    
    def release?
      !development?
    end
    
    def parse_app_id
      return "PARSE_DEVELOPMENT_APP_ID" if development?
      return "PARSE_RELEASE_APP_ID" if release?
    end
    
    def parse_client_key
      return "PARSE_DEVELOPMENT_CLIENT_KEY" if development?
      return "PARSE_RELEASE_CLIENT_KEY" if release?
    end
    

    我还在我的 git 存储库中保留了一个 Testflight 分支,其中包含 Testflight 包和信息(我从未合并回 master 或 dev),但这超出了我在这里回答的范围。

    【讨论】:

    • 谢谢,您知道规范是在开发环境中运行的,还是在单独的环境中运行的?
    • 我相信那些在开发中运行。你可能想发推特@RubyMotion 来确定。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多