qb 0.1.30 → 0.1.31

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
  SHA1:
3
- metadata.gz: 98ff12a6480515c8ce9f9ec5416d8f27a0ea58e4
4
- data.tar.gz: b7a8a742e2122159ffc4b46912466a726ad762e2
3
+ metadata.gz: c148a94c7547523edbf2258879d61a34316ef84a
4
+ data.tar.gz: 446d188612b882cb0f6ce4ef8b670161c6b1734a
5
5
  SHA512:
6
- metadata.gz: 578c5273900a9f95cc310a85a6e1036fa0b056585aa8c48ca4573d9ec218a81f118b4ebe08b5ec46bdf345962de08843f21e72e64a6151e8f446a07c14a4f76d
7
- data.tar.gz: 67d1ab031ee43fa22e826a678041fb2d97aaf75153f29535396918878738eee71c4704ab94d153436a267c56d0db0a4df42ba0e0bea3364918d0118d1d156312
6
+ metadata.gz: 2c6aaac0da8e6c48efb3d507d28b8f4d63b9539d54973c55d0644ea3e690cb5c1fdba83569b80159b8c0fc03791bb234b34d341325d871ebc1b9e7c9e236ce1b
7
+ data.tar.gz: 392448a4c0750de37ccab9976c1ce1f0e7e8980d14f3349d80181f108166d759956fcbf157a7de480194ce06ccb9aa9cf5f9bc7145720d40d42e1fe1667f1e29
data/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
1
  # temp playbook created by qb for ansible-playbook to consume
2
- /.qb-playbook.yml
2
+ .qb-playbook.yml
3
3
 
4
4
  /dev/repos
5
5
  /dev/ref/tmp
@@ -0,0 +1,24 @@
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/exe/qb CHANGED
@@ -48,11 +48,49 @@ def set_debug! args
48
48
  end
49
49
  end
50
50
 
51
- # needed for to clean the env if using bundler (like in dev)
51
+ # needed for to clean the env if using bundler (like in dev).
52
+ #
53
+ # this is because the ansible gem module doesn't work right with the bundler
54
+ # env vars set, so we need to remove them, but when running in dev we want
55
+ # modules written in ruby like nrser.state_mate's `state` script to have
56
+ # access to them so it can fire up bundler and get the right libraries.
57
+ #
58
+ # to accomplish this, we detect Bundler, and when it's present we copy the
59
+ # bundler-related env vars (which i found by looking at
60
+ # https://github.com/bundler/bundler/blob/master/lib/bundler.rb#L257)
61
+ # into a hash to pass around the env sanitization, then copy them into
62
+ # corresponding 'QB_DEV_ENV_<NAME>' vars that modules can restore.
63
+ #
64
+ # we also set a 'QB_DEV_ENV=true' env var for modules to easily detect that
65
+ # we're running in dev and restore the variables.
66
+ #
52
67
  def with_clean_env &block
53
68
  if defined? Bundler
54
- Bundler.with_clean_env &block
69
+ # copy the Bundler env vars into a hash
70
+ dev_env = ENV.select {|k, v|
71
+ k.start_with?("BUNDLE_") ||
72
+ [
73
+ 'GEM_HOME',
74
+ 'GEM_PATH',
75
+ 'MANPATH',
76
+ 'RUBYOPT',
77
+ 'RUBYLIB',
78
+ ].include?(k)
79
+ }
80
+
81
+ Bundler.with_clean_env do
82
+ # now that we're in a clean env, copy the Bundler env vars into
83
+ # 'QB_DEV_ENV_<NAME>' vars.
84
+ dev_env.each {|k, v| ENV["QB_DEV_ENV_#{ k }"] = v}
85
+
86
+ # and set QB_DEV_ENV=true
87
+ ENV['QB_DEV_ENV'] = 'true'
88
+
89
+ # invoke the block
90
+ block.call
91
+ end
55
92
  else
93
+ # bundler isn't loaded, so no env var silliness to deal with
56
94
  block.call
57
95
  end
58
96
  end
@@ -278,10 +316,8 @@ def main args
278
316
  ROOT + 'library',
279
317
  ].join(':')
280
318
 
281
- Dir.chdir QB::ROOT do
282
- # the `gem` ansible module doesn't work right when the bundler env vars
283
- # are set... so we need to clear them.
284
- with_clean_env do
319
+ Dir.chdir QB::ROOT do
320
+ with_clean_env do
285
321
  template = []
286
322
  template << "ANSIBLE_ROLES_PATH=<%= roles_path %>"
287
323
  template << "ANSIBLE_LIBRARY=<%= library_path %>"
@@ -1,7 +1,7 @@
1
1
  module QB
2
2
  GEM_NAME = 'qb'
3
3
 
4
- VERSION = "0.1.30"
4
+ VERSION = "0.1.31"
5
5
 
6
6
  def self.gemspec
7
7
  Gem.loaded_specs[GEM_NAME]
data/qb.gemspec CHANGED
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
43
43
 
44
44
  spec.add_dependency "cmds",'~> 0.0', ">= 0.0.9"
45
45
  spec.add_dependency "nrser-extras", '~> 0.0', ">= 0.0.3"
46
- spec.add_dependency "state_mate", '~> 0.0', ">= 0.0.8"
46
+ spec.add_dependency "state_mate", '~> 0.0', ">= 0.0.9"
47
47
 
48
48
 
49
49
  if QB::VERSION.end_with? '.dev'
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  # defaults file for nrser.state_mate
3
- state_mate_version: 0.0.8
3
+ state_mate_version: 0.0.9
@@ -1,35 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
  # WANT_JSON
3
3
 
4
-
5
- # def in_bundle?
6
-
7
-
8
- # conditionally setup bundler if we're in a bundle
9
- #
10
- # if
11
- # require 'bundler/setup'
12
- # rescue Exception => e
13
- # end
14
-
15
- require 'json'
16
- require 'shellwords'
17
- require 'pp'
18
- require 'yaml'
19
-
20
4
  # ugh... we need to clear the bundler env vars before running
21
- # `ansible-playbook` because they break the `git` ansible modules.
5
+ # `ansible-playbook` because they break the `git` ansible modules, so we
6
+ # don't have the bundler env vars here when we're in dev.
22
7
  #
23
- # so, what we'll do is just try to require the first gem, and if it fails,
24
- # require bundler and try again...
8
+ # what we do is have exe/qb copy all the bundler env vars to
9
+ # `QB_DEV_ENV_<NAME` ones around the env sanitization, along with adding
10
+ # `QB_DEV_ENV=true`. then we pick those up here and restore them.
25
11
  #
26
- begin
27
- require 'nrser'
28
- rescue LoadError => e
12
+ if ENV['QB_DEV_ENV']
13
+ ENV.each {|k, v|
14
+ if k.start_with? 'QB_DEV_ENV_'
15
+ ENV[k.sub('QB_DEV_ENV_', '')] = v
16
+ end
17
+ }
18
+
29
19
  require 'bundler/setup'
30
- require 'nrser'
31
20
  end
32
21
 
22
+ require 'pp'
23
+ require 'json'
24
+ require 'shellwords'
25
+ require 'yaml'
26
+
27
+ require 'nrser'
33
28
  require 'state_mate'
34
29
  require 'state_mate/adapters/yaml'
35
30
 
@@ -30,6 +30,5 @@
30
30
  state:
31
31
  json:
32
32
  key: "{{ npm_package_json_path }}:scripts:{{ item.key }}"
33
- set: "{{ item.value }}"
34
- create: true
33
+ init: "{{ item.value }}"
35
34
  with_dict: "{{ npm_package_scripts }}"
@@ -1,5 +1,5 @@
1
1
  const gulp = require('gulp');
2
- const Ugh = require('nrser/lib/ugh').Ugh;
2
+ const Ugh = require('@nrser/ugh').Ugh;
3
3
 
4
4
  const ugh = new Ugh({gulp, packageDir: __dirname});
5
5
 
@@ -5,13 +5,8 @@ allow_duplicates: yes
5
5
 
6
6
  dependencies:
7
7
  - role: nrser.state_mate
8
-
9
- - role: qb.npm_package
10
8
 
11
9
  - role: qb.npm_package
12
10
  npm_package_main: lib/index.js
13
- npm_package_scripts:
14
- clean: gulp clean
15
- build: "gulp build"
16
- test: "gulp mocha"
17
- watch: "gulp watch"
11
+ npm_package_scripts: "{{ nrser_js_package_scripts }}"
12
+
@@ -5,7 +5,7 @@
5
5
  state:
6
6
  json:
7
7
  key: "{{ npm_package_json_path }}:dependencies:{{ item.key }}"
8
- set: "{{ item.value }}"
8
+ init: "{{ item.value }}"
9
9
  create: true
10
10
  with_dict: "{{ nrser_js_deps }}"
11
11
 
@@ -13,7 +13,7 @@
13
13
  state:
14
14
  json:
15
15
  key: "{{ npm_package_json_path }}:devDependencies:{{ item.key }}"
16
- set: "{{ item.value }}"
16
+ init: "{{ item.value }}"
17
17
  create: true
18
18
  with_dict: "{{ nrser_js_dev_deps }}"
19
19
 
@@ -3,10 +3,11 @@
3
3
 
4
4
  nrser_js_deps:
5
5
  lodash: "^4.16.2"
6
- nrser: "^0.3.1"
6
+ nrser: "^0.5.0"
7
7
  tcomb: "^3.2.15"
8
8
 
9
9
  nrser_js_dev_deps:
10
+ "@nrser/ugh": "^0.1.6"
10
11
  babel-cli: "^6.16.0"
11
12
  babel-core: "^6.17.0"
12
13
  babel-plugin-metalog: "^0.1.0"
@@ -26,3 +27,10 @@ nrser_js_dev_deps:
26
27
  kexec: "^3.0.0"
27
28
  mocha: "^3.1.2"
28
29
  node-notifier: "^4.6.1"
30
+
31
+ nrser_js_package_scripts:
32
+ clean: gulp clean
33
+ build: "gulp build:this"
34
+ build-all: gulp build
35
+ test: gulp mocha
36
+ watch: gulp watch
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2016-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,7 +101,7 @@ dependencies:
101
101
  version: '0.0'
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 0.0.8
104
+ version: 0.0.9
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,7 +111,7 @@ dependencies:
111
111
  version: '0.0'
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 0.0.8
114
+ version: 0.0.9
115
115
  description:
116
116
  email:
117
117
  - neil@ztkae.com
@@ -131,6 +131,7 @@ files:
131
131
  - Rakefile
132
132
  - ansible.cfg
133
133
  - bin/console
134
+ - bin/print-error
134
135
  - bin/qb
135
136
  - bin/setup
136
137
  - bin/ungem
@@ -240,8 +241,6 @@ files:
240
241
  - roles/nrser.rbenv_gem/vars/main.yml
241
242
  - roles/nrser.state_mate/.gitignore
242
243
  - roles/nrser.state_mate/.rspec
243
- - roles/nrser.state_mate/Gemfile
244
- - roles/nrser.state_mate/Gemfile.lock
245
244
  - roles/nrser.state_mate/README.md
246
245
  - roles/nrser.state_mate/VERSION
247
246
  - roles/nrser.state_mate/defaults/main.yml
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :test, :development do
4
- gem "rspec"
5
- gem "cmds"
6
- gem "nrser-extras"
7
- gem "state_mate", path: "#{ ENV.fetch('GITHUB_ROOT') }/nrser/state_mate"
8
- end
@@ -1,46 +0,0 @@
1
- PATH
2
- remote: /Users/nrser/dev/gh/nrser/state_mate
3
- specs:
4
- state_mate (0.0.7.dev)
5
- CFPropertyList (~> 2.3)
6
- cmds (~> 0.0, >= 0.0.9)
7
- nrser (~> 0.0, >= 0.0.13)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- CFPropertyList (2.3.2)
13
- cmds (0.0.9)
14
- erubis (~> 2.7)
15
- nrser (>= 0.0.13)
16
- diff-lcs (1.2.5)
17
- erubis (2.7.0)
18
- nrser (0.0.13)
19
- nrser-extras (0.0.3)
20
- cmds (>= 0.0.7)
21
- nrser (>= 0.0.13)
22
- rspec (3.3.0)
23
- rspec-core (~> 3.3.0)
24
- rspec-expectations (~> 3.3.0)
25
- rspec-mocks (~> 3.3.0)
26
- rspec-core (3.3.2)
27
- rspec-support (~> 3.3.0)
28
- rspec-expectations (3.3.1)
29
- diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.3.0)
31
- rspec-mocks (3.3.2)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.3.0)
34
- rspec-support (3.3.0)
35
-
36
- PLATFORMS
37
- ruby
38
-
39
- DEPENDENCIES
40
- cmds
41
- nrser-extras
42
- rspec
43
- state_mate!
44
-
45
- BUNDLED WITH
46
- 1.10.6