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
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "qb",
3
+ "version": "0.0.0",
4
+ "main": "index.js",
5
+ "repository": "git@github.com:nrser/qb.git",
6
+ "author": "nrser <neil@ztkae.com>",
7
+ "license": "see LICENSE.txt",
8
+ "dependencies": {
9
+ "semver": "^5.3.0"
10
+ }
11
+ }
@@ -0,0 +1,63 @@
1
+ from __future__ import (absolute_import, division, print_function)
2
+ __metaclass__ = type
3
+
4
+ import subprocess
5
+ import os
6
+
7
+ from ansible.errors import AnsibleError
8
+
9
+
10
+ QB_ROOT = os.path.realpath(
11
+ os.path.join(
12
+ os.path.dirname(os.path.realpath(__file__)), # /plugins/filter_plugins
13
+ '..', # /plugins
14
+ '..', # /
15
+ )
16
+ )
17
+
18
+
19
+ def semver_inc(version, level = None, preid = None):
20
+ '''increment the version at level, with optional preid for pre- levels.
21
+
22
+ runs
23
+
24
+ semver --increment <level> [--preid <preid>] <version>
25
+
26
+ >>> semver_inc('1.0.0', 'minor', preid = 'dev')
27
+ '1.0.1-dev.0'
28
+
29
+ '''
30
+
31
+ cmd = [
32
+ os.path.join(QB_ROOT, 'node_modules', '.bin', 'semver'),
33
+ '--increment',
34
+ ]
35
+
36
+ if not (level is None):
37
+ cmd.append(level)
38
+
39
+ if not (preid is None):
40
+ cmd.append('--preid')
41
+ cmd.append(preid)
42
+
43
+ cmd.append(version)
44
+
45
+ out = subprocess.check_output(cmd)
46
+
47
+ return out.rstrip()
48
+
49
+
50
+ class FilterModule(object):
51
+ ''' version manipulation filters '''
52
+
53
+ def filters(self):
54
+ return {
55
+ 'semver_inc': semver_inc,
56
+ }
57
+
58
+
59
+ # testing - call camel_case on first cli arg and print result
60
+ if __name__ == '__main__':
61
+ import doctest
62
+ doctest.testmod()
63
+
data/qb.gemspec CHANGED
@@ -1,8 +1,40 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ require 'pathname'
3
+
4
+ GEM_ROOT = File.expand_path(File.dirname(__FILE__))
5
+ lib = File.join(GEM_ROOT, 'lib')
3
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
7
  require 'qb/version'
5
8
 
9
+ # things not to package (String | Regexp)
10
+ OMIT_FILES = [
11
+ # standard gem ignores (test files)
12
+ %r{^(test|spec|feature)/},
13
+ # all the development files
14
+ %r{^dev/},
15
+ # all the temp files
16
+ %r{^tmp/},
17
+ # dotfiles / dev config
18
+ '.gitignore',
19
+ '.gitmodules',
20
+ '.qb-options.yml',
21
+ '.rspec',
22
+ '.travis.yml',
23
+ # don't think we need this *in* the gem - it's for bundler in dev
24
+ 'Gemfile',
25
+ # dev executables are in /bin (gem executables are in /exe)
26
+ %r{^bin/},
27
+ # yarn artifacts
28
+ 'yarn.lock',
29
+ 'node_modules/.yarn-integrity',
30
+ # nrser.blockinfile tests carried over from fork
31
+ %r{^roles/nrser.blockinfile/tests/},
32
+ # temp playbook used in development
33
+ 'temp.yml',
34
+ # don't think we need the Rakefile
35
+ 'Rakefile',
36
+ ]
37
+
6
38
  Gem::Specification.new do |spec|
7
39
  spec.name = QB::GEM_NAME
8
40
  spec.version = QB::VERSION
@@ -14,7 +46,26 @@ Gem::Specification.new do |spec|
14
46
  spec.homepage = "https://github.com/nrser/qb"
15
47
  spec.license = "MIT"
16
48
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
49
+ checked_in_files = `git ls-files -z`.split("\x0")
50
+
51
+ node_modules_files = Dir.glob(
52
+ File.join(GEM_ROOT, 'node_modules/**/*'), File::FNM_DOTMATCH
53
+ ).map {|abs_path|
54
+ Pathname.new(abs_path).relative_path_from(Pathname.new(GEM_ROOT)).to_s
55
+ }
56
+
57
+ spec.files = (checked_in_files + node_modules_files).reject {|fp|
58
+ OMIT_FILES.any? {|pattern|
59
+ case pattern
60
+ when String
61
+ fp == pattern
62
+ when Regexp
63
+ pattern.match fp
64
+ else
65
+ raise "bad pattern: #{ pattern.inspect }"
66
+ end
67
+ }
68
+ }
18
69
 
19
70
  # get an array of submodule dirs by executing 'pwd' inside each submodule
20
71
  gem_dir = File.expand_path(File.dirname(__FILE__)) + "/"
@@ -0,0 +1,4 @@
1
+ ---
2
+ # defaults file for qb.release_yarn
3
+ release_yarn_level: patch
4
+ release_yarn_package_dir: "{{ qb_dir }}"
@@ -1,5 +1,5 @@
1
1
  ---
2
- # meta file for empty
2
+ # meta file for qb.release_yarn
3
3
 
4
4
  allow_duplicates: yes
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- # meta/qb.yml file for stdio
2
+ # meta/qb.yml file for qb.release_yarn
3
3
  #
4
4
  # qb settings for this role. see README.md for more info.
5
5
  #
@@ -18,6 +18,8 @@ var_prefix: null
18
18
  #
19
19
  # - null
20
20
  # - require the value on the command line.
21
+ # - false
22
+ # - don't provide qb_dir (means doesn't load or save options either).
21
23
  # - git_root
22
24
  # - use the git root fof the directory that the `qb` command is invoked
23
25
  # from. useful for 'project-centric' commands so they can be invoked
@@ -28,13 +30,13 @@ var_prefix: null
28
30
  # - invoke an execuable, passing a JSON serialization of the options
29
31
  # mapping their CLI names to values. path can be relative to role
30
32
  # directory.
31
- default_dir: cwd
33
+ default_dir: null
32
34
 
33
35
  # default user to become for play
34
36
  default_user: null
35
37
 
36
38
  # set to false to not save options in .qb-options.yml files
37
- save_options: false
39
+ save_options: true
38
40
 
39
41
  options:
40
42
  # - name: example
@@ -42,14 +44,17 @@ options:
42
44
  # required: false
43
45
  # type: boolean # boolean (default) | string
44
46
  # short: e
45
- - name: raise
46
- description: raise an error in main.
47
- required: false
48
- type: boolean
49
- short: r
50
47
 
51
- - name: count
52
- description: count to 10 on stdout with 1 sec sleeps between
48
+ - name: level
49
+ short: l
50
+ description: level to increment version.
53
51
  required: false
54
- type: boolean
55
- short: c
52
+ type:
53
+ one_of:
54
+ - major
55
+ - minor
56
+ - patch
57
+ - premajor
58
+ - preminor
59
+ - prepatch
60
+ - prerelease
@@ -0,0 +1,74 @@
1
+ ---
2
+ # tasks file for qb.release_yarn
3
+
4
+ - name: load package.json
5
+ include_vars:
6
+ file: "{{ release_yarn_package_dir }}/package.json"
7
+ name: release_gem_package_json
8
+
9
+ - name: get current version
10
+ set_fact:
11
+ release_yarn_current_version: "{{ release_gem_package_json.version }}"
12
+
13
+ - name: create release version
14
+ set_fact:
15
+ release_yarn_release_version: "{{
16
+ release_yarn_current_version | semver_inc(release_yarn_level)
17
+ }}"
18
+
19
+ - name: >
20
+ increment to version {{ release_yarn_release_version }}
21
+ and create the git tag
22
+ command: "yarn version --new-version={{ release_yarn_release_version }}"
23
+ args:
24
+ chdir: "{{ release_yarn_package_dir }}"
25
+
26
+ - name: >
27
+ git push the v{{ release_yarn_release_version }} tag
28
+ command: "git push origin v{{ release_yarn_release_version }}"
29
+ args:
30
+ chdir: "{{ release_yarn_package_dir }}"
31
+
32
+ - name: >
33
+ npm publish v{{ release_yarn_release_version }}
34
+ command: npm publish
35
+ args:
36
+ chdir: "{{ release_yarn_package_dir }}"
37
+
38
+ - name: create the next -dev version
39
+ set_fact:
40
+ release_yarn_next_version: "{{
41
+ release_yarn_release_version | semver_inc(
42
+ level='prerelease',
43
+ preid='dev'
44
+ )
45
+ }}"
46
+
47
+ - name: >
48
+ increment to {{ release_yarn_next_version }} version
49
+ command: >
50
+ yarn version
51
+ --new-version={{ release_yarn_next_version }}
52
+ --no-git-tag-version
53
+ args:
54
+ chdir: "{{ release_yarn_package_dir }}"
55
+
56
+ - name: git add package.json
57
+ command: git add package.json
58
+ args:
59
+ chdir: "{{ release_yarn_package_dir }}"
60
+
61
+ - name: >
62
+ git commit next dev version
63
+ command: git commit -m "start {{ release_yarn_next_version }}"
64
+ args:
65
+ chdir: "{{ release_yarn_package_dir }}"
66
+
67
+ - name: git push next dev version
68
+ command: git push
69
+ args:
70
+ chdir: "{{ release_yarn_package_dir }}"
71
+
72
+ - debug:
73
+ msg: >
74
+ v{{ release_yarn_package_dir }} released.
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.42
4
+ version: 0.1.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,54 +140,9 @@ executables:
140
140
  extensions: []
141
141
  extra_rdoc_files: []
142
142
  files:
143
- - ".gitignore"
144
- - ".gitmodules"
145
- - ".qb-options.yml"
146
- - ".rspec"
147
- - ".travis.yml"
148
- - Gemfile
149
143
  - LICENSE.txt
150
144
  - README.md
151
- - Rakefile
152
145
  - ansible.cfg
153
- - bin/console
154
- - bin/print-error
155
- - bin/qb
156
- - bin/rake
157
- - bin/setup
158
- - bin/ungem
159
- - dev/ansible.cfg
160
- - dev/hosts
161
- - dev/requirements.yml
162
- - dev/scratch/README.md
163
- - dev/scratch/ansible_module/defaults/main.yml
164
- - dev/scratch/ansible_module/library/test
165
- - dev/scratch/ansible_module/meta/main.yml
166
- - dev/scratch/ansible_module/meta/qb.yml
167
- - dev/scratch/ansible_module/tasks/main.yml
168
- - dev/scratch/case.rb
169
- - dev/scratch/empty/defaults/main.yml
170
- - dev/scratch/empty/meta/main.yml
171
- - dev/scratch/empty/meta/qb.yml
172
- - dev/scratch/empty/tasks/main.yml
173
- - dev/scratch/options/Gemfile
174
- - dev/scratch/options/Gemfile.lock
175
- - dev/scratch/options/aliases/README.md
176
- - dev/scratch/options/aliases/optparse.rb
177
- - dev/scratch/options/types/README.md
178
- - dev/scratch/options/types/opts.yml
179
- - dev/scratch/options/types/slop.rb
180
- - dev/scratch/stateSpec.js
181
- - dev/scratch/stdio/defaults/main.yml
182
- - dev/scratch/stdio/library/test
183
- - dev/scratch/stdio/meta/main.yml
184
- - dev/scratch/stdio/meta/qb.yml
185
- - dev/scratch/stdio/tasks/main.yml
186
- - dev/scratch/stream/defaults/main.yml
187
- - dev/scratch/stream/meta/main.yml
188
- - dev/scratch/stream/meta/qb.yml
189
- - dev/scratch/stream/tasks/main.yml
190
- - dev/setup.yml
191
146
  - exe/qb
192
147
  - lib/qb.rb
193
148
  - lib/qb/ansible_module.rb
@@ -200,7 +155,16 @@ files:
200
155
  - library/git_mkdir.py
201
156
  - library/qb_facts.py
202
157
  - library/stream
158
+ - node_modules/.bin/semver
159
+ - node_modules/semver/LICENSE
160
+ - node_modules/semver/README.md
161
+ - node_modules/semver/bin/semver
162
+ - node_modules/semver/package.json
163
+ - node_modules/semver/range.bnf
164
+ - node_modules/semver/semver.js
165
+ - package.json
203
166
  - plugins/filter_plugins/string.py
167
+ - plugins/filter_plugins/version.py
204
168
  - qb.gemspec
205
169
  - roles/nrser.blockinfile/CONTRIBUTING.md
206
170
  - roles/nrser.blockinfile/README.md
@@ -571,6 +535,10 @@ files:
571
535
  - roles/qb.release_gem/meta/main.yml
572
536
  - roles/qb.release_gem/meta/qb.yml
573
537
  - roles/qb.release_gem/tasks/main.yml
538
+ - roles/qb.release_yarn/defaults/main.yml
539
+ - roles/qb.release_yarn/meta/main.yml
540
+ - roles/qb.release_yarn/meta/qb.yml
541
+ - roles/qb.release_yarn/tasks/main.yml
574
542
  - roles/qb.role/.qb-options.yml
575
543
  - roles/qb.role/defaults/main.yml
576
544
  - roles/qb.role/meta/main.yml
@@ -594,8 +562,6 @@ files:
594
562
  - roles/qb.vars/meta/main.yml
595
563
  - roles/qb.vars/meta/qb.yml
596
564
  - roles/qb.vars/tasks/main.yml
597
- - temp.yml
598
- - tmp/.gitkeep
599
565
  homepage: https://github.com/nrser/qb
600
566
  licenses:
601
567
  - MIT
data/.gitignore DELETED
@@ -1,176 +0,0 @@
1
- # temp playbook created by qb for ansible-playbook to consume
2
- .qb-playbook.yml
3
-
4
- /dev/repos
5
- /dev/ref/tmp
6
- /tmp
7
-
8
- ##############################################################################
9
- # BEGIN Global/OSX.gitignore
10
- #
11
- .DS_Store
12
- .AppleDouble
13
- .LSOverride
14
-
15
- # Icon must end with two
16
- Icon
17
-
18
-
19
- # Thumbnails
20
- ._*
21
-
22
- # Files that might appear in the root of a volume
23
- .DocumentRevisions-V100
24
- .fseventsd
25
- .Spotlight-V100
26
- .TemporaryItems
27
- .Trashes
28
- .VolumeIcon.icns
29
-
30
- # Directories potentially created on remote AFP share
31
- .AppleDB
32
- .AppleDesktop
33
- Network Trash Folder
34
- Temporary Items
35
- .apdisk
36
- #
37
- # END Global/OSX.gitignore
38
- ##############################################################################
39
-
40
- ##############################################################################
41
- # BEGIN Ruby.gitignore
42
- #
43
- /*.gem
44
- *.rbc
45
- /.config
46
- /coverage/
47
- /InstalledFiles
48
- /pkg/
49
- /spec/reports/
50
- /spec/examples.txt
51
- /test/tmp/
52
- /test/version_tmp/
53
- /tmp/
54
-
55
- ## Specific to RubyMotion:
56
- .dat*
57
- .repl_history
58
- build/
59
- *.bridgesupport
60
- build-iPhoneOS/
61
- build-iPhoneSimulator/
62
-
63
- ## Specific to RubyMotion (use of CocoaPods):
64
- #
65
- # We recommend against adding the Pods directory to your .gitignore. However
66
- # you should judge for yourself, the pros and cons are mentioned at:
67
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
68
- #
69
- # vendor/Pods/
70
-
71
- ## Documentation cache and generated files:
72
- /.yardoc/
73
- /_yardoc/
74
- /doc/
75
- /rdoc/
76
-
77
- ## Environment normalization:
78
- .bundle/
79
- /vendor/bundle
80
- /lib/bundler/man/
81
-
82
- # for a library or gem, you might want to ignore these files since the code is
83
- # intended to run in multiple environments; otherwise, check them in:
84
- # Gemfile.lock
85
- # .ruby-version
86
- # .ruby-gemset
87
-
88
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
89
- .rvmrc
90
- #
91
- # END Ruby.gitignore
92
- ##############################################################################
93
-
94
- ##############################################################################
95
- # BEGIN Gem.gitignore
96
- #
97
- /Gemfile.lock
98
- /.ruby-version
99
- /.ruby-gemset
100
- #
101
- # END Gem.gitignore
102
- ##############################################################################
103
-
104
- ##############################################################################
105
- # BEGIN Python.gitignore
106
- #
107
- # Byte-compiled / optimized / DLL files
108
- __pycache__/
109
- *.py[cod]
110
- *$py.class
111
-
112
- # C extensions
113
- *.so
114
-
115
- # Distribution / packaging
116
- .Python
117
- env/
118
- build/
119
- develop-eggs/
120
- dist/
121
- downloads/
122
- eggs/
123
- .eggs/
124
- # lib/ (needed for ruby gem)
125
- lib64/
126
- parts/
127
- sdist/
128
- var/
129
- *.egg-info/
130
- .installed.cfg
131
- *.egg
132
-
133
- # PyInstaller
134
- # Usually these files are written by a python script from a template
135
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
136
- *.manifest
137
- *.spec
138
-
139
- # Installer logs
140
- pip-log.txt
141
- pip-delete-this-directory.txt
142
-
143
- # Unit test / coverage reports
144
- htmlcov/
145
- .tox/
146
- .coverage
147
- .coverage.*
148
- .cache
149
- nosetests.xml
150
- coverage.xml
151
- *,cover
152
- .hypothesis/
153
-
154
- # Translations
155
- *.mo
156
- *.pot
157
-
158
- # Django stuff:
159
- *.log
160
- local_settings.py
161
-
162
- # Sphinx documentation
163
- docs/_build/
164
-
165
- # PyBuilder
166
- target/
167
-
168
- #Ipython Notebook
169
- .ipynb_checkpoints
170
-
171
- # pyenv
172
- .python-version
173
- #
174
- # END Python.gitignore
175
- ##############################################################################
176
- /dev/roles/tmp