dklet 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dd62d9e1e833237c0ad745846ebca53657d8d050930b299ad59cc15cee316c2
4
- data.tar.gz: 41322b580ebeb1dfcd381a325be7b3ccb29ab2315b6e9434db7cffec1ea69926
3
+ metadata.gz: cbc1976787fa72c2f0f1807718ba0fec1e8f2183a8c08b899d0a5751d132ebc4
4
+ data.tar.gz: 016a805f3bc3786eb515ee60feec68c26bd3440566b4641c0a8396d4c3e863e0
5
5
  SHA512:
6
- metadata.gz: 2b317d7d44c67c7d8bae36858d86b681f84ebdc5a67c09f7dd2d3f24bf7569648620a432c9cd2916aa80ab7f56a339c14e72423899f59d2f05ec59bb9f75361b
7
- data.tar.gz: fe49b4cb5e65ede0270e4a978fdecf1ca88258a77516767af54bba9cbd6ede77d1597b585144307b60390a8e09a311476b2cb0545eb8507a11bc7312c74203b3
6
+ metadata.gz: 77c3f37998fea48b4d1783da526f6ffbd1e1d54bc54e1940c3196add1b855b29944091e2259823c32bf282778428141c9a71aa08f2ce4c8e81a3126c31c3a560
7
+ data.tar.gz: d7661aa2cb86358a197cc06b45cd0ba8165d53310889f921a06f7321ac1a6ed787b3b06941156d3f049afa47e127cbe45d887b54e3070457d862d40b60d9be44
data/Rakefile CHANGED
@@ -4,3 +4,22 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ desc 'test dklet gem'
9
+ task :test do
10
+ app_path = 'tmp/hidklet'
11
+ result = system <<~Desc
12
+ mkdir -p #{File.dirname(app_path)}
13
+ rm -f #{app_path}
14
+ mkdklet #{app_path}
15
+ #{app_path} help
16
+ #{app_path} # main task
17
+ #{app_path} clean --image
18
+ Desc
19
+
20
+ if result
21
+ puts 'everything ok'
22
+ else
23
+ puts 'something wrong'
24
+ end
25
+ end
data/dklet.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = %q{practical DSL for daily container life}
12
12
  spec.description = spec.summary
13
- spec.homepage = "https://github.com/dailyops/kc/dklet"
13
+ spec.homepage = "https://github.com/dailyops/dklet"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
data/dklet.rc ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env bash
2
+ if [ -z $BOOTER_DKLET_RC ]; then
3
+ : # do nothing
4
+ else
5
+ if [ -z $FORCE_RC ]; then
6
+ echo Warning: has sourced $BOOTER_DKLET_RC!
7
+ return 1
8
+ fi
9
+ fi
10
+ BOOTER_DKLET_RC=$(evar=${BASH_SOURCE[0]} ruby -e "puts File.realpath(ENV['evar'])")
11
+ BOOTER_DKLET_HOME=$(dirname $BOOTER_DKLET_RC)
12
+ #[ -d "$BOOTER_DKLET_HOME/bin" ] && PATH=$PATH:$BOOTER_DKLET_HOME/bin
13
+ # default use exe
14
+ export PATH=$PATH:$BOOTER_DKLET_HOME/exe
15
+
16
+ function dklet(){
17
+ tp=${1:-cd}
18
+ case "$tp" in
19
+ home|root)
20
+ echo $BOOTER_DKLET_HOME
21
+ ;;
22
+ cd)
23
+ cd "$BOOTER_DKLET_HOME"
24
+ ;;
25
+ rc|vi)
26
+ vi "$BOOTER_DKLET_RC"
27
+ $FUNCNAME reload
28
+ ;;
29
+ show)
30
+ cat "$BOOTER_DKLET_RC"
31
+ ;;
32
+ reload|source)
33
+ FORCE_RC=1 source "$BOOTER_DKLET_RC"
34
+ echo ==has sourced "$BOOTER_DKLET_RC"
35
+ ;;
36
+ help|h)
37
+ type $FUNCNAME
38
+ ;;
39
+ ## app related
40
+ gem)
41
+ gem query dklet -l
42
+ ;;
43
+ gemrelease)
44
+ $FUNCNAME cd && rake release
45
+ ;;
46
+ gemup)
47
+ $FUNCNAME cd && rake install:local --trace
48
+ ;;
49
+ gemdown)
50
+ gem uninstall dklet --all -x
51
+ ;;
52
+ status|st)
53
+ type -a rundklet
54
+ ;;
55
+ test)
56
+ $FUNCNAME cd && rake test
57
+ ;;
58
+ *)
59
+ $FUNCNAME help
60
+ ;;
61
+ esac
62
+ }
data/exe/mkdklet CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require 'dklet'
3
2
 
4
3
  rbfile = ARGV[0]
5
4
  abort "rbfile required!" if rbfile.nil?
@@ -10,6 +9,10 @@ abort "rbfile #{rpath.to_s} existed!" if rpath.exist?
10
9
  rpath.parent.mkpath
11
10
  extra = ARGV[1..-1].join(' ')
12
11
 
12
+ lib_path = File.join(__dir__, '../lib')
13
+ $:.unshift lib_path unless $:.include?(lib_path)
14
+
15
+ require 'dklet'
13
16
  handler = File.basename(__FILE__)
14
17
  tmpl = Dklet.lib_path.join('template/dklet.erb').read
15
18
 
data/exe/rundklet CHANGED
@@ -16,6 +16,9 @@ if idx
16
16
  ENV['APP_RELEASE'] ||= argv[idx+1]
17
17
  end
18
18
 
19
+ lib_path = File.join(__dir__, '../lib')
20
+ $:.unshift lib_path unless $:.include?(lib_path)
21
+
19
22
  require "dklet"
20
23
  extend Dklet::DSL
21
24
  load file
data/lib/dklet/dsl.rb CHANGED
@@ -61,21 +61,17 @@ module Dklet::DSL
61
61
  end
62
62
 
63
63
  def default_image_labels
64
- app_labels = image_label_hash.map{|k, v| [k,v].join('=') }.join(' ')
65
- "maintainer=dailyops built_from=docklet #{app_labels}"
64
+ "maintainer=dailyops built_from=dklet"
66
65
  end
67
66
 
68
- def image_label_hash
67
+ def release_label_hash
69
68
  {
69
+ dklet_env: env,
70
70
  dklet_app: appname,
71
- dklet_env: env
71
+ dklet_release: app_release
72
72
  }
73
73
  end
74
74
 
75
- def release_label_hash
76
- image_label_hash.merge(dklet_release: app_release)
77
- end
78
-
79
75
  # maybe from external image
80
76
  def dkrun_cmd(labeled: true, opts: nil, named: false)
81
77
  cmd = "docker run"
data/lib/dklet/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dklet
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dklet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruijian Cao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ files:
87
87
  - bin/console
88
88
  - bin/setup
89
89
  - dklet.gemspec
90
+ - dklet.rc
90
91
  - exe/mkdklet
91
92
  - exe/rundklet
92
93
  - lib/dklet.rb
@@ -96,7 +97,7 @@ files:
96
97
  - lib/dklet/util.rb
97
98
  - lib/dklet/version.rb
98
99
  - lib/template/dklet.erb
99
- homepage: https://github.com/dailyops/kc/dklet
100
+ homepage: https://github.com/dailyops/dklet
100
101
  licenses:
101
102
  - MIT
102
103
  metadata: {}