docker-runner 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9ba1c187306ebe03331ed95d0b46aa17d46054d
4
- data.tar.gz: 4c0011e49704208b423735b85eaeedbe6451bdf5
3
+ metadata.gz: 3c7ab3124e1537797438f905e51456f760704041
4
+ data.tar.gz: 40b1d47cb3cd6679f1620a559bb4c0ff2a9c70c2
5
5
  SHA512:
6
- metadata.gz: c815fb8d8d3190bc764d80410387c779532520982018f0f70b97fc5dc1c9c30e419d57f53b7c07450a8479da9145c9e1b40d8e80b8ee489bcb02be9100d5d3dd
7
- data.tar.gz: 551667a63fb0aea99c70fc55f95846cb2c49a93164b802b4d6cbc384fb0cac662181c506bfa5c8742c6330db325bbb7ca2315cbcbdc5a3b0da45eeb720f91e7c
6
+ metadata.gz: 5aa9cfc86ba310e82c0b31bc4e2e67b52b57c5ff6e3a550e22f4d076ebeb6f2513c73fc22068d76dbf039bb44fc5c9d7c29b7701c5def473fe95370aa21af52d
7
+ data.tar.gz: d38970934855f43dcbdc5378e1b7d3b8713953709a85a2bfcb89b8fc92970a43c4bed6e694761d7cc2beb150c222e92cea93db254049d73dc224836976bfef2b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Docker::Runner
2
2
 
3
- A Rails Like Docker Runner Cli
3
+ A Docker Runner Cli
4
4
 
5
5
  ## Installation
6
6
 
@@ -21,6 +21,7 @@ A Rails Like Docker Runner Cli
21
21
  - docker-runner login 登录镜像远程仓库
22
22
  - docker-runner logout 退出镜像远程仓库
23
23
  - docker-runner console 开启镜像控制台
24
+ - docker-runner clean Docker环境清理
24
25
  - docker-runner update 更新镜像模板
25
26
  - docker-runner version 查看当前版本
26
27
 
@@ -93,7 +93,7 @@ reset_global_env() {
93
93
 
94
94
  require_global_env() {
95
95
  if [ -r "$HOME/.docker-runner" ]; then
96
- return 1
96
+ return 0
97
97
  else
98
98
  echo "**请先执行docker-runner setup, 进行环境初始化"
99
99
  exit 11
@@ -101,8 +101,8 @@ require_global_env() {
101
101
  }
102
102
 
103
103
  require_project_env() {
104
- if require_global_env && [ -r ".docker-runner" ]; then
105
- return 1
104
+ if require_global_env && [ -r "$PWD/.docker-runner" ]; then
105
+ return 0
106
106
  else
107
107
  echo "**当前目录不是镜像项目, 请切换至镜像项目"
108
108
  exit 12
@@ -267,22 +267,34 @@ error(){
267
267
  }
268
268
 
269
269
  valid_readme() {
270
- if [ `grep -c "$VALID_STR" $README_PATH` -gt 0 ]; then
270
+ if [ ! -r $README_PATH ]; then
271
+ read -p "README.md不存在, 是否生成? (Y/n)" is_reset_readme
272
+
273
+ if [ "$is_reset_readme" = 'n' ]; then
274
+ error "README.md不存在, 停止构建镜像"
275
+ return 1
276
+ else
277
+ reset_readme
278
+ return 0
279
+ fi
280
+
281
+ elif [ `grep -c "$VALID_STR" $README_PATH` -gt 0 ]; then
271
282
  error $BUILD_ERR && \
272
283
  open $README_PATH &&
284
+ return 1
285
+ else
273
286
  return 0
274
287
  fi
275
- return 1
276
288
  }
277
289
 
278
290
  valid_variables() {
279
- local result=1
291
+ local result=0
280
292
  if [ ! -n "$username" ] ;then
281
- error '请在.docker-runner文件中配置username' && result=0
293
+ error '请在.docker-runner文件中配置username' && result=1
282
294
  fi
283
295
 
284
296
  if [ ! -n "$image" ];then
285
- error '请在.docker-runner文件中配置image' && result=0
297
+ error '请在.docker-runner文件中配置image' && result=1
286
298
  fi
287
299
 
288
300
  return $result
@@ -378,13 +390,13 @@ do_config() {
378
390
  }
379
391
 
380
392
  do_build() {
381
- valid_readme ||\
382
- valid_variables || build_image
393
+ valid_readme &&\
394
+ valid_variables && build_image
383
395
  }
384
396
 
385
397
  do_push() {
386
- valid_readme ||\
387
- valid_variables || push_image
398
+ valid_readme &&\
399
+ valid_variables && push_image
388
400
  }
389
401
 
390
402
  do_login() {
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  module Runner
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "王长明"