qb 0.1.42 → 0.1.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qb/version.rb +1 -1
- data/library/qb_facts.py +16 -0
- data/node_modules/.bin/semver +1 -0
- data/node_modules/semver/LICENSE +15 -0
- data/node_modules/semver/README.md +350 -0
- data/node_modules/semver/bin/semver +133 -0
- data/node_modules/semver/package.json +22 -0
- data/node_modules/semver/range.bnf +16 -0
- data/node_modules/semver/semver.js +1203 -0
- data/package.json +11 -0
- data/plugins/filter_plugins/version.py +63 -0
- data/qb.gemspec +53 -2
- data/roles/qb.release_yarn/defaults/main.yml +4 -0
- data/{dev/scratch/empty → roles/qb.release_yarn}/meta/main.yml +1 -1
- data/{dev/scratch/stdio → roles/qb.release_yarn}/meta/qb.yml +17 -12
- data/roles/qb.release_yarn/tasks/main.yml +74 -0
- metadata +15 -49
- data/.gitignore +0 -176
- data/.gitmodules +0 -18
- data/.qb-options.yml +0 -8
- data/.rspec +0 -2
- data/.travis.yml +0 -4
- data/Gemfile +0 -6
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/print-error +0 -24
- data/bin/qb +0 -16
- data/bin/rake +0 -3
- data/bin/setup +0 -9
- data/bin/ungem +0 -19
- data/dev/ansible.cfg +0 -5
- data/dev/hosts +0 -2
- data/dev/requirements.yml +0 -12
- data/dev/scratch/README.md +0 -5
- data/dev/scratch/ansible_module/defaults/main.yml +0 -2
- data/dev/scratch/ansible_module/library/test +0 -22
- data/dev/scratch/ansible_module/meta/main.yml +0 -8
- data/dev/scratch/ansible_module/meta/qb.yml +0 -44
- data/dev/scratch/ansible_module/tasks/main.yml +0 -9
- data/dev/scratch/case.rb +0 -38
- data/dev/scratch/empty/defaults/main.yml +0 -2
- data/dev/scratch/empty/meta/qb.yml +0 -44
- data/dev/scratch/empty/tasks/main.yml +0 -2
- data/dev/scratch/options/Gemfile +0 -3
- data/dev/scratch/options/Gemfile.lock +0 -13
- data/dev/scratch/options/aliases/README.md +0 -3
- data/dev/scratch/options/aliases/optparse.rb +0 -32
- data/dev/scratch/options/types/README.md +0 -1
- data/dev/scratch/options/types/opts.yml +0 -13
- data/dev/scratch/options/types/slop.rb +0 -104
- data/dev/scratch/stateSpec.js +0 -50
- data/dev/scratch/stdio/defaults/main.yml +0 -4
- data/dev/scratch/stdio/library/test +0 -34
- data/dev/scratch/stdio/meta/main.yml +0 -8
- data/dev/scratch/stdio/tasks/main.yml +0 -5
- data/dev/scratch/stream/defaults/main.yml +0 -2
- data/dev/scratch/stream/meta/main.yml +0 -7
- data/dev/scratch/stream/meta/qb.yml +0 -44
- data/dev/scratch/stream/tasks/main.yml +0 -4
- data/dev/setup.yml +0 -61
- data/temp.yml +0 -19
data/.gitmodules
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
[submodule "roles/nrser.blockinfile"]
|
2
|
-
path = roles/nrser.blockinfile
|
3
|
-
url = git@github.com:nrser/ansible-role-blockinfile
|
4
|
-
[submodule "roles/nrser.rbenv_gem"]
|
5
|
-
path = roles/nrser.rbenv_gem
|
6
|
-
url = git@github.com:nrser/ansible-nrser.rbenv_gem.git
|
7
|
-
[submodule "roles/qb.gitignore/files/gitignore"]
|
8
|
-
path = roles/qb.gitignore/files/gitignore
|
9
|
-
url = git@github.com:nrser/gitignore.git
|
10
|
-
[submodule "roles/nrser.rb"]
|
11
|
-
path = roles/nrser.rb
|
12
|
-
url = git@github.com:nrser/ansible-nrser.rb.git
|
13
|
-
[submodule "roles/nrser.state_mate"]
|
14
|
-
path = roles/nrser.state_mate
|
15
|
-
url = git@github.com:nrser/ansible-nrser.state_mate.git
|
16
|
-
[submodule "dev/gems/state_mate"]
|
17
|
-
path = dev/gems/state_mate
|
18
|
-
url = git@github.com:nrser/state_mate
|
data/.qb-options.yml
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "qb"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/print-error
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# parses and prints a fatal error out of ansible-playbook output
|
4
|
-
#
|
5
|
-
# usage:
|
6
|
-
#
|
7
|
-
# qb some_role . | print-error
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'json'
|
11
|
-
require 'pp'
|
12
|
-
|
13
|
-
out = STDIN.read
|
14
|
-
|
15
|
-
json = out[/FAILED\!\ \=\>\ (\{.*\})\n/, 1]
|
16
|
-
|
17
|
-
data = JSON.load json
|
18
|
-
stderr = data['module_stderr']
|
19
|
-
|
20
|
-
# pp data
|
21
|
-
|
22
|
-
puts "STDERR:\n\n"
|
23
|
-
|
24
|
-
puts stderr
|
data/bin/qb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# stub instead of `bundle exec qb ...`
|
3
|
-
|
4
|
-
# so you know you're using the local repo version (vs an installed gem)...
|
5
|
-
puts "*** LOADING REPO VERSION ***"
|
6
|
-
|
7
|
-
root = File.dirname(File.realpath(File.join(__FILE__, '..')))
|
8
|
-
|
9
|
-
puts "source: #{ root }"
|
10
|
-
puts
|
11
|
-
|
12
|
-
Dir.chdir root do
|
13
|
-
require 'bundler/setup'
|
14
|
-
end
|
15
|
-
|
16
|
-
load File.join(root, 'exe/qb')
|
data/bin/rake
DELETED
data/bin/setup
DELETED
data/bin/ungem
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
[
|
6
|
-
'bin/console',
|
7
|
-
'bin/setup',
|
8
|
-
'lib',
|
9
|
-
'spec',
|
10
|
-
'.rspec',
|
11
|
-
'.travis.yml',
|
12
|
-
'Gemfile',
|
13
|
-
'LICENSE.txt',
|
14
|
-
'qb.gemspec',
|
15
|
-
'Rakefile',
|
16
|
-
].each do |path|
|
17
|
-
`git reset HEAD #{ path }`
|
18
|
-
FileUtils.rm_rf path
|
19
|
-
end
|
data/dev/ansible.cfg
DELETED
data/dev/hosts
DELETED
data/dev/requirements.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
- name: nrser.nodenv
|
2
|
-
src: https://github.com/nrser/ansible-nrser.nodenv.git
|
3
|
-
version: v0.1.2
|
4
|
-
- name: nrser.rbenv_gem
|
5
|
-
src: https://github.com/nrser/ansible-nrser.rbenv_gem.git
|
6
|
-
version: v0.1.3
|
7
|
-
- name: nrser.rbenv
|
8
|
-
src: https://github.com/nrser/ansible-nrser.rbenv.git
|
9
|
-
version: v0.1.2
|
10
|
-
- name: nrser.dev_setup
|
11
|
-
src: https://github.com/nrser/ansible-nrser.dev_setup.git
|
12
|
-
version: v0.1.3
|
data/dev/scratch/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
scratch work.
|
2
|
-
|
3
|
-
for playing around with ideas, testing things out, etc. i find it useful to keep this stuff around so i can refer back to it, though this directory should be cleaned up from time to time to remove long outdated code.
|
4
|
-
|
5
|
-
generally, work should be put in it's own directory (unless it's just a single file) so it's clear what belongs to what.
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# WANT_JSON
|
3
|
-
|
4
|
-
# init bundler in dev env
|
5
|
-
if ENV['QB_DEV_ENV']
|
6
|
-
ENV.each {|k, v|
|
7
|
-
if k.start_with? 'QB_DEV_ENV_'
|
8
|
-
ENV[k.sub('QB_DEV_ENV_', '')] = v
|
9
|
-
end
|
10
|
-
}
|
11
|
-
require 'bundler/setup'
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'qb'
|
15
|
-
|
16
|
-
class Test < QB::AnsibleModule
|
17
|
-
def main
|
18
|
-
changed! blah: "blow me: #{ @args['x'] }"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Test.new.run
|
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
# meta/qb.yml file for ansible_module
|
3
|
-
#
|
4
|
-
# qb settings for this role. see README.md for more info.
|
5
|
-
#
|
6
|
-
|
7
|
-
# description of the role to show in it's help output.
|
8
|
-
description: null
|
9
|
-
|
10
|
-
# prefix for role variables
|
11
|
-
var_prefix: null
|
12
|
-
|
13
|
-
# how to get a default for `dir` if it's not provided as the only
|
14
|
-
# positional argument. if a positional argument is provided it will
|
15
|
-
# override the method defined here.
|
16
|
-
#
|
17
|
-
# options:
|
18
|
-
#
|
19
|
-
# - null
|
20
|
-
# - require the value on the command line.
|
21
|
-
# - git_root
|
22
|
-
# - use the git root fof the directory that the `qb` command is invoked
|
23
|
-
# from. useful for 'project-centric' commands so they can be invoked
|
24
|
-
# from anywhere in the repo.
|
25
|
-
# - cwd
|
26
|
-
# - use the directory the `qb` command is invoked form.
|
27
|
-
# - {exe: PATH}
|
28
|
-
# - invoke an execuable, passing a JSON serialization of the options
|
29
|
-
# mapping their CLI names to values. path can be relative to role
|
30
|
-
# directory.
|
31
|
-
default_dir: cwd
|
32
|
-
|
33
|
-
# default user to become for play
|
34
|
-
default_user: null
|
35
|
-
|
36
|
-
# set to false to not save options in .qb-options.yml files
|
37
|
-
save_options: false
|
38
|
-
|
39
|
-
options: []
|
40
|
-
# - name: example
|
41
|
-
# description: an example of a variable.
|
42
|
-
# required: false
|
43
|
-
# type: boolean # boolean (default) | string
|
44
|
-
# short: e
|
data/dev/scratch/case.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
def on_length procs
|
3
|
-
length_map = procs.map {|proc|
|
4
|
-
[proc.arity, proc]
|
5
|
-
}.to_h
|
6
|
-
|
7
|
-
length_map[length].(*self)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def f args
|
12
|
-
puts "args: #{ args.inspect }"
|
13
|
-
args.on_length([
|
14
|
-
-> {
|
15
|
-
puts "none"
|
16
|
-
},
|
17
|
-
->(x) {
|
18
|
-
puts "single: #{ x }"
|
19
|
-
},
|
20
|
-
->(x, y) {
|
21
|
-
puts "double: #{ x }, #{ y }"
|
22
|
-
},
|
23
|
-
])
|
24
|
-
puts
|
25
|
-
end
|
26
|
-
|
27
|
-
f = (args) ->
|
28
|
-
(x) ->
|
29
|
-
(x:Hash) ->
|
30
|
-
['', x]
|
31
|
-
(x) ->
|
32
|
-
[x, {}]
|
33
|
-
|
34
|
-
(x, y) -> [x, y]
|
35
|
-
|
36
|
-
f []
|
37
|
-
f [:x]
|
38
|
-
f [:x, :y]
|
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
# meta/qb.yml file for empty
|
3
|
-
#
|
4
|
-
# qb settings for this role. see README.md for more info.
|
5
|
-
#
|
6
|
-
|
7
|
-
# description of the role to show in it's help output.
|
8
|
-
description: null
|
9
|
-
|
10
|
-
# prefix for role variables
|
11
|
-
var_prefix: null
|
12
|
-
|
13
|
-
# how to get a default for `dir` if it's not provided as the only
|
14
|
-
# positional argument. if a positional argument is provided it will
|
15
|
-
# override the method defined here.
|
16
|
-
#
|
17
|
-
# options:
|
18
|
-
#
|
19
|
-
# - null
|
20
|
-
# - require the value on the command line.
|
21
|
-
# - git_root
|
22
|
-
# - use the git root fof the directory that the `qb` command is invoked
|
23
|
-
# from. useful for 'project-centric' commands so they can be invoked
|
24
|
-
# from anywhere in the repo.
|
25
|
-
# - cwd
|
26
|
-
# - use the directory the `qb` command is invoked form.
|
27
|
-
# - {exe: PATH}
|
28
|
-
# - invoke an execuable, passing a JSON serialization of the options
|
29
|
-
# mapping their CLI names to values. path can be relative to role
|
30
|
-
# directory.
|
31
|
-
default_dir: cwd
|
32
|
-
|
33
|
-
# default user to become for play
|
34
|
-
default_user: null
|
35
|
-
|
36
|
-
# set to false to not save options in .qb-options.yml files
|
37
|
-
save_options: true
|
38
|
-
|
39
|
-
options: []
|
40
|
-
# - name: example
|
41
|
-
# description: an example of a variable.
|
42
|
-
# required: false
|
43
|
-
# type: boolean # boolean (default) | string
|
44
|
-
# short: e
|
data/dev/scratch/options/Gemfile
DELETED
@@ -1,3 +0,0 @@
|
|
1
|
-
want to be able to support option names having aliases. because sometimes it's hard to remember exactly what the option is called, and qb aims to make things as stupid fast and easy from the command line as possible (at the expense of more complexity in the code).
|
2
|
-
|
3
|
-
driven at the moment by wanting the qb option `-H` / `--HOSTS` to be available as `-I` / `--INVENTORY` (the ansible name for it) as well as `--HOST`, so that's what the initial example at least will focus on.
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
opts = {}
|
5
|
-
|
6
|
-
parser = OptionParser.new do |parser|
|
7
|
-
parser.banner = "hey there"
|
8
|
-
|
9
|
-
parser.on(
|
10
|
-
'-X VALUE',
|
11
|
-
'x',
|
12
|
-
) do |value|
|
13
|
-
opts['x'] = value
|
14
|
-
end
|
15
|
-
|
16
|
-
parser.on(
|
17
|
-
'-I INVENTORY', '-H INVENTORY',
|
18
|
-
'--INVENTORY=INVENTORY', '--HOSTS=INVENTORY',
|
19
|
-
Array,
|
20
|
-
"inventory",
|
21
|
-
) do |value|
|
22
|
-
opts['hosts'] = value
|
23
|
-
end
|
24
|
-
|
25
|
-
parser.on_tail('-h') do
|
26
|
-
puts parser
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
parser.parse! ARGV
|
31
|
-
|
32
|
-
puts YAML.dump(opts)
|
@@ -1 +0,0 @@
|
|
1
|
-
deal with option type declarations in role `meta/qb.yml` files and parsing those values in conjunction with the cli option parser.
|
@@ -1,104 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
|
5
|
-
require 'pp'
|
6
|
-
require 'slop'
|
7
|
-
require 'yaml'
|
8
|
-
|
9
|
-
opt_defs = YAML.load File.read(File.join(File.dirname(__FILE__), 'opts.yml'))
|
10
|
-
|
11
|
-
pp opt_defs
|
12
|
-
|
13
|
-
# ARGV = ARGV + ['--array', 'T,F,T', '--no-bool', 'F']
|
14
|
-
|
15
|
-
def make_option type
|
16
|
-
Slop.string_to_option_class(config[:type_config]).new([], '')
|
17
|
-
end
|
18
|
-
|
19
|
-
class Slop::ArrayOfOption < Slop::ArrayOption
|
20
|
-
# def initialize flags, desc, **config, &block
|
21
|
-
# super flags, desc, **config, &block
|
22
|
-
# @item_option =
|
23
|
-
# end
|
24
|
-
|
25
|
-
def call value
|
26
|
-
super(value).map {|string|
|
27
|
-
make_option(config[:type_config]).call string
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class Slop::ValueOption < Slop::Option
|
33
|
-
def initialize flags, desc, **config, &block
|
34
|
-
super flags, desc, **config, &block
|
35
|
-
@value = config.fetch :type_config
|
36
|
-
end
|
37
|
-
|
38
|
-
def call value
|
39
|
-
unless value == @value
|
40
|
-
raise "bad value: #{ value.inspect }, should be #{ @value }"
|
41
|
-
end
|
42
|
-
|
43
|
-
value
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class Slop::OneOfOption < Slop::Option
|
48
|
-
def initialize flags, desc, **config, &block
|
49
|
-
super flags, desc, **config, &block
|
50
|
-
@types = config.fetch(:type_config).map {|spec|
|
51
|
-
case spec
|
52
|
-
when Hash
|
53
|
-
make_option(spec['type'])
|
54
|
-
else
|
55
|
-
make_option('value', type_config: spec)
|
56
|
-
end
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
def call value
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
opts = Slop.parse(ARGV) do |o|
|
66
|
-
# o.string '-h', '--host', 'a hostname'
|
67
|
-
# o.integer '--port', 'custom port', default: 80
|
68
|
-
# o.bool '-v', '--verbose', 'enable verbose mode'
|
69
|
-
# o.bool '-q', '--quiet', 'suppress output (quiet mode)'
|
70
|
-
# o.bool '-c', '--check-ssl-certificate', 'check SSL certificate for host'
|
71
|
-
# o.on '--version', 'print the version' do
|
72
|
-
# puts Slop::VERSION
|
73
|
-
# exit
|
74
|
-
# end
|
75
|
-
|
76
|
-
# o.array_of '--array', 'an array of integers', item_type: 'integer'
|
77
|
-
|
78
|
-
opt_defs.each do |opt_def|
|
79
|
-
config = case opt_def['type']
|
80
|
-
when String
|
81
|
-
{type: opt_def['type']}
|
82
|
-
when Hash
|
83
|
-
{
|
84
|
-
type: opt_def['type'].keys[0],
|
85
|
-
type_config: opt_def['type'].values[0],
|
86
|
-
}
|
87
|
-
else
|
88
|
-
raise "HERE"
|
89
|
-
end
|
90
|
-
|
91
|
-
pp config
|
92
|
-
|
93
|
-
o.on "--#{ opt_def['name'] }",
|
94
|
-
opt_def['description'],
|
95
|
-
**config
|
96
|
-
end
|
97
|
-
|
98
|
-
o.on '-h', 'help' do
|
99
|
-
puts o
|
100
|
-
exit
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
pp opts.to_hash
|