当我要标记提交时,我需要知道自上次标记提交以来发生了什么变化.例如:
a87a6sdf87a6d4 Some new feature
a87a6sdf87a6d3 Some bug fix
a87a6sdf87a6d2 Some comments added
a87a6sdf87a6d1 Some merge <- v1.4.0
Run Code Online (Sandbox Code Playgroud)
在这个例子中,我想知道3个最新的提交,或者能够打印如上所述的日志,这表明它们都提交了它们的标签(如果有的话).当我看到添加了一个新功能时,我会将其标记为v1.5.0.
你怎么处理这个?这是我应该如何使用标签?我应该在标签消息中写什么?我总是把它留空:git tag -a v1.2.3 -m ''
我想下载一个.zip与github上托管的库的源,但我不想要主人,因为每次下载我都可以下载不同的版本.
这个特殊的库没有标签,所以我不能使用它.
那么如何为特定的提交sha下载source.zip呢?
我需要注入两个对象ImageService.其中一个是Repository/ImageRepository我的例子:
$image_repository = $container->get('doctrine.odm.mongodb')
->getRepository('MycompanyMainBundle:Image');
Run Code Online (Sandbox Code Playgroud)
那么如何在我的services.yml中声明呢?这是服务:
namespace Mycompany\MainBundle\Service\Image;
use Doctrine\ODM\MongoDB\DocumentRepository;
class ImageManager {
private $manipulator;
private $repository;
public function __construct(ImageManipulatorInterface $manipulator, DocumentRepository $repository) {
$this->manipulator = $manipulator;
$this->repository = $repository;
}
public function findAll() {
return $this->repository->findAll();
}
public function createThumbnail(ImageInterface $image) {
return $this->manipulator->resize($image->source(), 300, 200);
}
}
Run Code Online (Sandbox Code Playgroud) 我的所有网站代码都/srv在我的容器中.
我的Dockerfile使用git下载代码,并使其成为映像的一部分,以便更轻松地部署到生产环境.
但是,如何在开发中编辑代码?我认为使用卷是解决方案,例如:-v /docker/mycontainer/srv:/srv.但它会覆盖容器中的目录.如果这是我第一次运行它,它会清空它,因为主机中没有任何东西.所以无论我在Dockerfile中做了什么都会丢失.
里面/srv/myapp还有我希望在我的应用程序的不同版本之间共享的目录和文件,例如:/srv/myapp/user-uploads.这是专业Web开发中的常见做法.
那么我能做些什么来做这些事呢?:
有没有办法进行反向音量安装?我的意思是让容器覆盖主机,而不是相反.
我想一个解决方案可能是在运行容器的守护进程之前将/ srv复制到/srv.deployment-copy.然后当我运行守护进程时检查/srv.deployment-copy是否存在并将所有内容复制回/ srv.这样我可以使用/ srv作为卷,并且仍然可以使用Dockerfile将代码部署到它.我已经在所有docker命令中使用别名,因此自动执行此操作不会有问题.你怎么看?
我已经能够安装没有这样的composer.json文件的存储库:
{
"type": "package",
"package": {
"name": "yahoo/yui-compressor",
"version": "2.0.4",
"dist": {
"url": "http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.7.zip",
"type": "zip"
}
}
},
Run Code Online (Sandbox Code Playgroud)
我从文档中选择了"type":"zip"部分,但我找不到很多其他类型.例如,我需要安装jQuery,但我不知道要放入什么类型("js"不起作用).
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.7.2",
"dist": {
"url": "http://code.jquery.com/jquery-1.7.2.js",
"type": "js"
}
}
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
编辑:我正在添加完整的解决方案来帮助@CMCDragonkai:
"require": {
"vendorname/somefile": "1.2.3",
},
"repositories": [
{
"type": "package",
"package": {
"name": "vendorname/somefile",
"version": "1.2.3",
"dist": {
"url": "http://example.com/somefile.txt",
"type": "file"
}
}
}
]
Run Code Online (Sandbox Code Playgroud) 我正在尝试重新启动服务器,然后等待,使用此:
- name: Restart server
shell: reboot
- name: Wait for server to restart
wait_for:
port=22
delay=1
timeout=300
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
TASK: [iptables | Wait for server to restart] *********************************
fatal: [example.com] => failed to transfer file to /root/.ansible/tmp/ansible-tmp-1401138291.69-222045017562709/wait_for:
sftp> put /tmp/tmpApPR8k /root/.ansible/tmp/ansible-tmp-1401138291.69-222045017562709/wait_for
Connected to example.com.
Connection closed
Run Code Online (Sandbox Code Playgroud) 我不明白php的PSR-2惯例的这一部分:
线长的软限制必须是120个字符; 自动样式检查器必须警告但不得在软限制上出错.
线条不应超过80个字符; 超过的行应该被分成多个后续行,每行不超过80个字符.
我认为"软限制"意味着"试图坚持这个限制,但额外的几个字符不是问题".但后来我读了第二行,现在我没理解.
我什么时候应该使用InvalidArgumentException和UnexpectedValueException?他们看起来和我一样.
请注意,一个扩展了LogicException,另一个扩展了RuntimeException,因此差异不应该是如此微妙的IMO.
我正在尝试使用Ansible重新启动Jenkins服务:
- name: Restart Jenkins to make the plugin data available
service: name=jenkins state=restarted
- name: Wait for Jenkins to restart
wait_for:
host=localhost
port=8080
delay=20
timeout=300
- name: Install Jenkins plugins
command:
java -jar {{ jenkins_cli_jar }} -s {{ jenkins_dashboard_url }} install-plugin {{ item }}
creates=/var/lib/jenkins/plugins/{{ item }}.jpi
with_items: jenkins_plugins
Run Code Online (Sandbox Code Playgroud)
但是在第一次运行时,第三个任务会抛出大量的Java错误,包括:Suppressed: java.io.IOException: Server returned HTTP response code: 503 for URL这让我觉得Web服务器(完全由Jenkins处理)还没准备好.有时当我使用我的浏览器访问Jenkins仪表板时,它表示Jenkins尚未就绪,并且它会重新加载,而且确实如此,它工作正常.但我不确定访问该页面是启动服务器的原因,还是什么.
所以我想我需要多次卷曲直到http代码为200?还有其他方法吗?
无论哪种方式,我该怎么做?
你通常如何重启詹金斯?
如何在PHPStorm中删除这些水平线?

我必须搜索整个"设置"窗口,但我似乎无法找到它.甚至可以删除它们吗?
php ×5
ansible ×2
deployment ×2
git ×2
symfony ×2
coding-style ×1
composer-php ×1
conventions ×1
docker ×1
exception ×1
github ×1
ide ×1
jenkins ×1
linux ×1
phpstorm ×1
spl ×1
ssh ×1