小编Cho*_*c13的帖子

AngularJS持续部署工具

我一直在尝试使用Codeship和Heroku来持续部署我目前正在编写的AngularJS应用程序.该应用程序是使用Yeoman创建的,并使用bower和grunt.最初我认为这似乎是一个非常好的设置,因为Codeship可以免费使用,我很快就可以配置它来构建我的AngularJS项目,并且它提供了在构建之后添加部署步骤的能力.甚至有许多PaaS提供商可供选择(Heroku,S3,Google App Engine等).然而,我似乎已经变得有点卡住让Heroku上的应用程序运行.

问题始于所有文档都建议我/dist从我的路径中删除路径,.gitignore以便将此目录发布到Heroku post build.这主要来自谈论从本地机器发布到Heroku的文档,但我认为这无论如何都是Codeship所做的.我不想这样做,因为我不相信我应该检查构建输出到源代码控制.该/dist文件夹已添加到.gitignore有充分理由.此外,这种方式在某种程度上打败了CI服务器,因为我可能只是从我的机器上推出最新版本.

在进行了一些挖掘之后,我发现我可以在我的packages.json文件中添加一个postinstall步骤,例如bower install && grunt build,它将重新运行Heroku上的构建,从而重新填充所有的bower依赖项(他们希望我签入源代码的其他内容)控制!)和dist目录.

在试一试后,很明显我需要添加bowergrunt作为依赖项packages.json,这意味着移动devDependencies它们应该属于它们的位置!

所以我现在似乎陷入困境.我想要做的就是发布我的构建artefacts(/dist)依赖项(/bower_components)和server.js将运行该站点的文件.有谁知道如何使用Heroku和Codeship实现这一目标?或者,任何人都可以使用不同的工具取得成功.我正在寻找免费的东西,我愿意接受它不会生产稳定(不会扩展到多个服务器等),但现在这很好,因为我想做的就是不断部署应用程序内部测试,并能够与我的团队的非技术成员分享输出,以便我们可以讨论我们要优先考虑的功能等.

任何建议将不胜感激.

谢谢

heroku node.js continuous-deployment angularjs codeship

7
推荐指数
1
解决办法
1788
查看次数

使用GoogleService-Info.plist为iOS应用配置Google分析时出错

我按照Google开发人员指南,使用Cocoa Pod将Google分析添加到iOS应用中.我添加了GoogleService-Info.plist并将初始化代码放入didFinishLaunchingWithOptions.该应用程序构建正常,但然后在尝试初始化GA时崩溃.特别是这些代码行:

NSError *configureError;
[[GGLContext sharedInstance] configureWithError:&configureError];
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);
Run Code Online (Sandbox Code Playgroud)

断言语句失败,控制台中的输出为:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Error configuring Google services: 
Error Domain=com.google.greenhouse Code=-200 "Unable to configure GGL."
{NSLocalizedFailureReason=Unable to parse supplied GoogleService-Info.plist. See log for details., 
NSLocalizedRecoverySuggestion=Check formatting and location of GoogleService-Info.plist., 
NSLocalizedDescription=Unable to configure GGL.}'
Run Code Online (Sandbox Code Playgroud)

我可以看到这是由于该GoogleService-Info.plist文件,经过一些调查,我发现即使我删除GoogleService-Info.plist我得到错误,这使我相信我没有正确地将文件添加到项目中.

这是我在添加文件时检查的屏幕截图:

在此输入图像描述

所以我确信,它被添加到所有目标和该文件是在项目的根目录下,一起xcodeprojxcworkspace文件,按照在谷歌开发者指南中的说明.

我还要提一下,这是一个SpriteBuilder项目,但我认为这与此无关.这也是我添加的第一个Cocoa Pod,但随着项目的构建,它可以找到所需的所有Google标题.

xcode google-analytics objective-c ios spritebuilder

5
推荐指数
1
解决办法
6247
查看次数

在升级angular-bootstrap时缺少字体/ glyphicons-halflings-regular.*

我正在使用Yeoman和cg-angular生成器来构建一个角度应用程序.这最初工作正常,但我最近升级angular-bootstrap,从0.100.11获得关于模态大小的一个新功能的保持.执行此操作后,我注意到Chrome上的开发人员控制台中出现以下错误.

GET http://localhost:9001/fonts/glyphicons-halflings-regular.woff  angular-ui-router.js:3702 
GET http://localhost:9001/fonts/glyphicons-halflings-regular.ttf   :9001/fonts/glyphicons-halflings-regular.ttf:1
Run Code Online (Sandbox Code Playgroud)

我使用的版本3.1.1bootstrap.

如果我升级bootstrap到最新的那个3.3.4.然后我得到一些不同的错误:

GET http://fonts/glyphicons-halflings-regular.woff2 net::ERR_NAME_NOT_RESOLVED angular-animate.js:442
GET http://fonts/glyphicons-halflings-regular.woff  net::ERR_NAME_NOT_RESOLVED fonts/glyphicons-halflings-regular.woff:1
GET http://fonts/glyphicons-halflings-regular.ttf   net::ERR_NAME_NOT_RESOLVED fonts/glyphicons-halflings-regular.ttf:1
Run Code Online (Sandbox Code Playgroud)

我应该说我在本地运行时看到这些错误 grunt serve

此外,如果我升级boostrap,但保持angular-bootstrap0.10那时我没有这些问题.

我也有以下我的Gruntfile.js:

copy: {
        main: {
            files: [
                {src: ['bower_components/font-awesome/fonts/**'], dest: 'dist/', filter: 'isFile', expand: true},
                {src: ['bower_components/bootstrap/fonts/**'], dest: 'dist/', filter: 'isFile', expand: true}
            ]
        }
    }
Run Code Online (Sandbox Code Playgroud)

虽然,就像我说的那样,我在本地运行时看到这些丢失的字形,所以这个笨拙的任务不应该进入游戏.

我已经仔细研究了angular-bootstrap代码,令人困惑的是,代码中似乎没有直接引用glyphicon字体,因此升级此模块可能会导致这些错误有点奇怪.

升级时有没有其他人对glyphicons有任何问题angular-bootstrap

angularjs glyphicons angular-bootstrap

3
推荐指数
1
解决办法
6454
查看次数

如何有效地使用向量?

我在我的代码中使用向量和向量size_type.

#include <iostream>
#include <vector>

using namespace std;
using std::vector;

typedef vector<int>::size_type size_type;

int main()
{
    size_type n; 
    cin>>n;
    vector<int> u(n,0);
    for(size_type i = 0; i != n; ++i) {
      cin >> u[i];
    }
    cout << *u.end();

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误是当我输入n = 5时.向量请求5个元素,然后输出0或一些垃圾值.如何打印最后一个元素?

c++ vector

2
推荐指数
2
解决办法
147
查看次数