基于微服务项目,产生的的多项目仓库管理脚本。可直接保存 shell 脚本后酌情修改后试用
脚本放置在外层目录,将操作 Api 后缀目录下 git 仓库
#!/bin/bash
# 不要放在中文路径下
# 接口
git clone http://xxxxx.com/XXX.XXXApi.git
read pause
#!/bin/bash
function getdir(){
for element in `ls $1 | grep /$`
do
dir_or_file=$1"\\"$element
echo $dir_or_file
cd $dir_or_file
git checkout $2
git pull
cd ..
done
}
root_dir="./"
branch=dev
getdir $root_dir $branch
#!/bin/bash
function getdir(){
for element in `ls -F $1 | grep /$`
do
dir_or_file=$1"\\"$element
echo $dir_or_file
if [ $element = "docs" ]
then
echo $dir_or_file skip
else
cd $dir_or_file
git pull
cd ..
fi
done
}
root_dir="./"
getdir $root_dir
#!/bin/bash
function getdir(){
for element in `ls $1 | grep /$`
do
dir_or_file=$1"\\"$element
echo $dir_or_file
cd $dir_or_file
git status
cd ..
done
}
root_dir="./"
getdir $root_dir
read pause
项目: 匹配的文本*Api:Api 后缀的目录XXX: 需要更新的指定包,匹配包名xxxxx.com:nuget 源#!/bin/bash
#set -x
echo '自动升级nuget包-Need Setting shell to GBK Encoding'
function upgradePack(){
tempFile=./temp.txt
tempPackFile=./tempPack.txt
echo 当前目录:$1
cd $1
cd src
pwd
#read pause
dotnet restore
dotnet list package --source xxxxxxx.com --include-prerelease --outdated>$tempFile
tempProjectMatch="项目"
projectName=''
cat $tempFile | while read line
do
#if [[ "$line" == *XXX* ]];then
if [[ $line =~ $tempProjectMatch ]];then
echo $line | grep -Eo "XXX.((\w)+(\.?))+">$tempPackFile
projectName=$(cat $tempPackFile)
echo 检测项目:$projectName
else
if [[ "$line" == *XXX* ]];then
echo $line | grep -Eo "XXX.((\w)+(\.?))+">$tempPackFile
packageName=$(cat $tempPackFile)
echo 升级包:$packageName
dotnet add $projectName/$projectName.csproj package $packageName
fi
fi
#fi
done
rm $tempFile
rm $tempPackFile
}
function getdir(){
branchName=$2
for element in `ls $1 | grep /*Api`
do
dir_or_file=$1/$element
cd $dir_or_file
if([ "$branchName" != "" ]);then
git checkout $branchName
git pull
fi
upgradePack $dir_or_file
done
}
branch=dev
root_dir=$(cd `dirname $0`;pwd)
#echo 脚本目录:$root_dir
getdir $root_dir $branch
read pause
#!/bin/bash
#set -x
echo '重命名分支-Need Setting shell to GBK Encoding'
function pushTag(){
echo 拉取dev分支
git checkout dev
echo 创建tag
time_span=v`date +%Y%m%d`
git tag -l $time_span
git tag -a -f -m relrease $time_span
echo 推送tag
git push --set-upstream origin $time_span -f
echo 推送完毕
}
function getdir(){
# 文件夹名匹配
for element in `ls $1 | grep -E 'XXXApi|YYYYApi'`
do
dir_or_file=$1/$element
cd $dir_or_file
pushTag $dir_or_file
done
}
root_dir=$(cd `dirname $0`;pwd)
#echo 脚本目录:$root_dir
getdir $root_dir
read pause
#!/bin/bash
#set -x
echo '自动提交-Need Setting shell to GBK Encoding'
function pushCode(){
echo 当前目录:$1
git add *
git commit -m 更新包
git pull
git push
}
function getdir(){
branchName=$2
for element in `ls $1 | grep /*Api`
do
dir_or_file=$1/$element
cd $dir_or_file
pushCode $dir_or_file
done
}
branch=dev
root_dir=$(cd `dirname $0`;pwd)
#echo 脚本目录:$root_dir
getdir $root_dir $branch
read pause
#!/bin/bash
#set -x
echo '重命名分支-Need Setting shell to GBK Encoding'
function pushTag(){
echo 当前目录:$1 $branch
echo 拉取dev分支
git checkout dev
echo 创建tag
time_span=v`date +%Y%m%d`
git tag -l $time_span
git tag -a -f -m relrease $time_span
echo 推送tag
git push --set-upstream origin $time_span -f
echo 推送完毕
}
function pushCode(){
echo 当前目录:$1 $branch
echo 切换到dev,开始合并
git checkout dev
git pull
echo 删除release分支
git branch -d release
echo 新建release分支
git checkout -b release
echo 推送新的release分支
git push --set-upstream origin release -f
}
function getdir(){
for element in `ls $1 | grep /*Api`
do
dir_or_file=$1/$element
cd $dir_or_file
pushTag $dir_or_file
pushCode $dir_or_file
echo 睡眠30秒
sleep 30s
done
}
root_dir=$(cd `dirname $0`;pwd)
#echo 脚本目录:$root_dir
getdir $root_dir
read pause
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
如何在buildr项目中使用Ruby?我在很多不同的项目中使用过Ruby、JRuby、Java和Clojure。我目前正在使用我的标准Ruby开发一个模拟应用程序,我想尝试使用Clojure后端(我确实喜欢功能代码)以及JRubygui和测试套件。我还可以看到在未来的不同项目中使用Scala作为后端。我想我要为我的项目尝试一下buildr(http://buildr.apache.org/),但我注意到buildr似乎没有设置为在项目中使用JRuby代码本身!这看起来有点傻,因为该工具旨在统一通用的JVM语言并且是在ruby中构建的。除了将输出的jar包含在一个独特的、仅限ruby
我有一个在Linux服务器上运行的ruby脚本。它不使用rails或任何东西。它基本上是一个命令行ruby脚本,可以像这样传递参数:./ruby_script.rbarg1arg2如何将参数抽象到配置文件(例如yaml文件或其他文件)中?您能否举例说明如何做到这一点?提前谢谢你。 最佳答案 首先,您可以运行一个写入YAML配置文件的独立脚本:require"yaml"File.write("path_to_yaml_file",[arg1,arg2].to_yaml)然后,在您的应用中阅读它:require"yaml"arg
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="
最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru
在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo