qb 0.1.42 → 0.1.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qb/version.rb +1 -1
  3. data/library/qb_facts.py +16 -0
  4. data/node_modules/.bin/semver +1 -0
  5. data/node_modules/semver/LICENSE +15 -0
  6. data/node_modules/semver/README.md +350 -0
  7. data/node_modules/semver/bin/semver +133 -0
  8. data/node_modules/semver/package.json +22 -0
  9. data/node_modules/semver/range.bnf +16 -0
  10. data/node_modules/semver/semver.js +1203 -0
  11. data/package.json +11 -0
  12. data/plugins/filter_plugins/version.py +63 -0
  13. data/qb.gemspec +53 -2
  14. data/roles/qb.release_yarn/defaults/main.yml +4 -0
  15. data/{dev/scratch/empty → roles/qb.release_yarn}/meta/main.yml +1 -1
  16. data/{dev/scratch/stdio → roles/qb.release_yarn}/meta/qb.yml +17 -12
  17. data/roles/qb.release_yarn/tasks/main.yml +74 -0
  18. metadata +15 -49
  19. data/.gitignore +0 -176
  20. data/.gitmodules +0 -18
  21. data/.qb-options.yml +0 -8
  22. data/.rspec +0 -2
  23. data/.travis.yml +0 -4
  24. data/Gemfile +0 -6
  25. data/Rakefile +0 -6
  26. data/bin/console +0 -14
  27. data/bin/print-error +0 -24
  28. data/bin/qb +0 -16
  29. data/bin/rake +0 -3
  30. data/bin/setup +0 -9
  31. data/bin/ungem +0 -19
  32. data/dev/ansible.cfg +0 -5
  33. data/dev/hosts +0 -2
  34. data/dev/requirements.yml +0 -12
  35. data/dev/scratch/README.md +0 -5
  36. data/dev/scratch/ansible_module/defaults/main.yml +0 -2
  37. data/dev/scratch/ansible_module/library/test +0 -22
  38. data/dev/scratch/ansible_module/meta/main.yml +0 -8
  39. data/dev/scratch/ansible_module/meta/qb.yml +0 -44
  40. data/dev/scratch/ansible_module/tasks/main.yml +0 -9
  41. data/dev/scratch/case.rb +0 -38
  42. data/dev/scratch/empty/defaults/main.yml +0 -2
  43. data/dev/scratch/empty/meta/qb.yml +0 -44
  44. data/dev/scratch/empty/tasks/main.yml +0 -2
  45. data/dev/scratch/options/Gemfile +0 -3
  46. data/dev/scratch/options/Gemfile.lock +0 -13
  47. data/dev/scratch/options/aliases/README.md +0 -3
  48. data/dev/scratch/options/aliases/optparse.rb +0 -32
  49. data/dev/scratch/options/types/README.md +0 -1
  50. data/dev/scratch/options/types/opts.yml +0 -13
  51. data/dev/scratch/options/types/slop.rb +0 -104
  52. data/dev/scratch/stateSpec.js +0 -50
  53. data/dev/scratch/stdio/defaults/main.yml +0 -4
  54. data/dev/scratch/stdio/library/test +0 -34
  55. data/dev/scratch/stdio/meta/main.yml +0 -8
  56. data/dev/scratch/stdio/tasks/main.yml +0 -5
  57. data/dev/scratch/stream/defaults/main.yml +0 -2
  58. data/dev/scratch/stream/meta/main.yml +0 -7
  59. data/dev/scratch/stream/meta/qb.yml +0 -44
  60. data/dev/scratch/stream/tasks/main.yml +0 -4
  61. data/dev/setup.yml +0 -61
  62. data/temp.yml +0 -19
@@ -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
@@ -1,8 +0,0 @@
1
- ---
2
- qb.gem:
3
- constant: QB
4
- license: MIT
5
- qb.project:
6
- dev-bin: false
7
- qb.install_gem:
8
- rubies: global
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.2
4
- before_install: gem install bundler -v 1.10.6
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # gem 'state_mate', path: './dev/gems/state_mate'
4
-
5
- # Specify your gem's dependencies in qb.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -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
@@ -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
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- bundle exec rake
data/bin/setup DELETED
@@ -1,9 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- # TODO: should i change this to always use --path= in the gem role?
6
- # will i even use this with dev/setup.yml?
7
- bundle install --path=./.bundle
8
-
9
- # Do any other automated setup that you need to do here
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
@@ -1,5 +0,0 @@
1
- [defaults]
2
-
3
- roles_path = ./roles/tmp:./roles
4
- inventory = ./hosts
5
- retry_files_enabled = False
data/dev/hosts DELETED
@@ -1,2 +0,0 @@
1
- # connection to the local machine for dev/setup.yml
2
- localhost ansible_connection=local
@@ -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
@@ -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,2 +0,0 @@
1
- ---
2
- # defaults file for ansible_module
@@ -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,8 +0,0 @@
1
- ---
2
- # meta file for ansible_module
3
-
4
- allow_duplicates: yes
5
-
6
- dependencies: []
7
- # - role: role-name
8
-
@@ -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
@@ -1,9 +0,0 @@
1
- ---
2
- # tasks file for ansible_module
3
-
4
- - name: test QB::AnsibleModule
5
- test:
6
- x: ex
7
-
8
- - debug:
9
- msg: "{{ blah }}"
@@ -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,2 +0,0 @@
1
- ---
2
- # defaults file for empty
@@ -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
@@ -1,2 +0,0 @@
1
- ---
2
- # tasks file for empty
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "slop"
@@ -1,13 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- slop (4.4.1)
5
-
6
- PLATFORMS
7
- ruby
8
-
9
- DEPENDENCIES
10
- slop
11
-
12
- BUNDLED WITH
13
- 1.11.2
@@ -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,13 +0,0 @@
1
- ---
2
- - name: array_of_int
3
- description: an array of integers
4
- type:
5
- array_of: integer
6
-
7
- - name: scope
8
- description: can be string or false
9
- type:
10
- one_of:
11
- - type: string
12
- - false
13
-
@@ -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