kameleon-builder 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.bumpversion.cfg ADDED
@@ -0,0 +1,17 @@
1
+ [bumpversion]
2
+ commit = True
3
+ tag = True
4
+ current_version = 2.6.0
5
+ parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+))?
6
+ serialize =
7
+ {major}.{minor}.{patch}.{release}
8
+ {major}.{minor}.{patch}
9
+
10
+ [bumpversion:file:version.txt]
11
+
12
+ [bumpversion:part:release]
13
+ optional_value = gamma
14
+ values =
15
+ dev
16
+ gamma
17
+
@@ -1,7 +1,18 @@
1
1
  Kameleon CHANGELOG
2
2
  ==================
3
3
 
4
- version 2.5.0
4
+ Version 2.6.0
5
+ -------------
6
+
7
+ Released on May 13th 2015
8
+
9
+ - Added --list-checkpoints to ``kameleon build`` command
10
+ - Removed ``kameleon checkpoints`` and ``kameleon clean`` commands
11
+ - Displayed error information in normal and verbose mode
12
+ - Fixed ruby 1.8.7 compatibility
13
+ - Added Zsh completion (See completion)
14
+
15
+ Version 2.5.0
5
16
  -------------
6
17
 
7
18
  Released on Jan 27th 2015
@@ -16,7 +27,7 @@ Released on Jan 27th 2015
16
27
  - Improved UI with more color and less output messages
17
28
 
18
29
 
19
- version 2.4.0
30
+ Version 2.4.0
20
31
  -------------
21
32
 
22
33
  Released on Dec 23rd 2014
@@ -28,7 +39,7 @@ Released on Dec 23rd 2014
28
39
  - Moved repository command to the upper level (``kameleon repository``)
29
40
 
30
41
 
31
- version 2.3.5
42
+ Version 2.3.5
32
43
  -------------
33
44
 
34
45
  Released on Dec 2nd 2014
@@ -36,7 +47,7 @@ Released on Dec 2nd 2014
36
47
  - Fixed kameleon 2.3.4 regressions about ``kameleon build``
37
48
 
38
49
 
39
- version 2.3.4
50
+ Version 2.3.4
40
51
  -------------
41
52
 
42
53
  Released on Nov 26th 2014
@@ -44,7 +55,7 @@ Released on Nov 26th 2014
44
55
  - Fixed kameleon 2.3.3 regressions about the template import
45
56
 
46
57
 
47
- version 2.3.3
58
+ Version 2.3.3
48
59
  -------------
49
60
 
50
61
  Released on Nov 26th 2014
@@ -52,14 +63,14 @@ Released on Nov 26th 2014
52
63
  - Minor improvements
53
64
  - Fixed issue with listing the templates avaiable in a repository
54
65
 
55
- version 2.3.2
66
+ Version 2.3.2
56
67
  -------------
57
68
 
58
69
  Released on Nov 20th 2014
59
70
 
60
71
  - Search steps directories in the workspace first.
61
72
 
62
- version 2.3.1
73
+ Version 2.3.1
63
74
  -------------
64
75
 
65
76
  Released on Nov 5th 2014
@@ -67,7 +78,7 @@ Released on Nov 5th 2014
67
78
  - ``--from-checkpoint`` option automatically enable the checkpoint process.
68
79
  - ``--from-checkpoint`` could take a special value "last" to refer to the last valid checkpoint.
69
80
 
70
- version 2.3.0
81
+ Version 2.3.0
71
82
  -------------
72
83
 
73
84
  Released on Oct 16th 2014
@@ -88,7 +99,7 @@ Released on Oct 16th 2014
88
99
  - Added ``kameleon template repository`` to manage external git recipes repositories
89
100
 
90
101
 
91
- version 2.2.5
102
+ Version 2.2.5
92
103
  -------------
93
104
 
94
105
  Released on Sep 19th 2014
@@ -107,7 +118,7 @@ Released on Sep 19th 2014
107
118
 
108
119
 
109
120
 
110
- version 2.2.4
121
+ Version 2.2.4
111
122
  -------------
112
123
 
113
124
  Released on Sep 2nd 2014
@@ -121,13 +132,13 @@ Released on Sep 2nd 2014
121
132
  - [proxy cache] Restructured persistent cache and improved caching of pipes
122
133
  - [proxy cache] Added ``ProxyAdrres`` paramter to polipo to take into account all the host network interfaces
123
134
 
124
- version 2.2.3
135
+ Version 2.2.3
125
136
  -------------
126
137
  Released on Aug 19th 2014
127
138
 
128
139
  - [template] The extlinux MBR path has changed because jessie is not frozen (Fix #17)
129
140
 
130
- version 2.2.2
141
+ Version 2.2.2
131
142
  -------------
132
143
 
133
144
  Released on July 23rd 2014
@@ -136,7 +147,7 @@ Released on July 23rd 2014
136
147
  - [core] Added ``--templates-path`` CLI option to set different templates directory
137
148
  - [core] Fixed regression about recipe ancestors loading
138
149
 
139
- version 2.2.1
150
+ Version 2.2.1
140
151
  -------------
141
152
 
142
153
  Released on July 22nd 2014
@@ -144,7 +155,7 @@ Released on July 22nd 2014
144
155
  - [core] Switch to default yaml parser (psych) and removed syck from dependencies
145
156
  - [core] Loaded a recipe with all ancestors
146
157
 
147
- version 2.2.0
158
+ Version 2.2.0
148
159
  -------------
149
160
 
150
161
  Released on July 20th 2014
@@ -214,7 +225,7 @@ Released on July 20th 2014
214
225
  - virtualbox/ubuntu-14.04-desktop-amd64
215
226
 
216
227
 
217
- version 2.1.3
228
+ Version 2.1.3
218
229
  -------------
219
230
 
220
231
  Released on June 16th 2014
@@ -226,7 +237,7 @@ Released on June 16th 2014
226
237
  - [template] Set a small timeout with netcat
227
238
  - [template] Added new debian 7 appliance with kameleon.
228
239
 
229
- version 2.1.0
240
+ Version 2.1.0
230
241
  -------------
231
242
 
232
243
  Released on June 12th 2014
@@ -304,8 +315,8 @@ Released on June 12th 2014
304
315
  - [docs] More documentation
305
316
 
306
317
 
307
- version 2.0.0
308
- =============
318
+ Version 2.0.0
319
+ -------------
309
320
 
310
321
  Released on February 17th 2014
311
322
 
@@ -0,0 +1,198 @@
1
+ #compdef kameleon
2
+
3
+ # This is ZSH completion script based on the kameleon 2.6.0.dev API
4
+ #
5
+ # Author: Michael Mercier
6
+ #
7
+ # This was made with the help of this howto:
8
+ # https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
9
+ # and with the _git completion file
10
+
11
+ # Helpers
12
+ template_list="kameleon template list | tail -n +4 | cut -f1 -d'|'"
13
+
14
+ # Repository kameleon subcommands
15
+ _kameleon_repository () {
16
+ local curcontext=$curcontext state line ret=1
17
+ declare -A opt_args
18
+
19
+ _arguments -C \
20
+ ': :->command' \
21
+ '*:: :->option-or-argument' && ret=0
22
+
23
+ case $state in
24
+ (command)
25
+ declare -a commands
26
+
27
+ commands=(
28
+ add:'Adds a new named NAME repository at URL'
29
+ help:'Describe available subcommands or one specific subcommand'
30
+ list:'Lists available repositories'
31
+ update:'Update specified repository')
32
+
33
+ _describe -t commands command commands && ret=0
34
+ ;;
35
+ (option-or-argument)
36
+ curcontext=${curcontext%:*}-$line[1]:
37
+
38
+ case $line[1] in
39
+ (add)
40
+ _arguments \
41
+ '1:Repository local name' \
42
+ '2:Repository URL or local path:_urls' \
43
+ '(-b --branch=)'{-b,--branch=}':To checkout BRANCH' && ret=0
44
+ ;;
45
+ (help)
46
+ _arguments \
47
+ '::Repository sub command:(add list update)' && ret=0
48
+ ;;
49
+ (update)
50
+ _arguments \
51
+ ":Update the repository named NAME:($(kameleon repository list))" && ret=0
52
+ ;;
53
+ esac
54
+ esac
55
+ return ret
56
+ }
57
+
58
+ # Template kameleon subcommands
59
+ _kameleon_template () {
60
+ local curcontext=$curcontext state line ret=1
61
+ declare -A opt_args
62
+
63
+ _arguments -C \
64
+ ': :->command' \
65
+ '*:: :->option-or-argument' && ret=0
66
+
67
+ case $state in
68
+ (command)
69
+ declare -a commands
70
+
71
+ commands=(
72
+ help:'Describe available subcommands or one specific subcommand'
73
+ import:'Imports the given template'
74
+ info:'Display detailed information about a template'
75
+ list:'Lists available templates'
76
+ repository:'alias for \"kameleon repository\"')
77
+
78
+ _describe -t commands command commands && ret=0
79
+ ;;
80
+ (option-or-argument)
81
+ curcontext=${curcontext%:*}-$line[1]:
82
+
83
+ case $line[1] in
84
+ (help)
85
+ _arguments \
86
+ '::Template sub command:(import info list repository)' && ret=0
87
+ ;;
88
+ (import)
89
+ _arguments \
90
+ ":template name:($(kameleon template list | tail -n +4 | cut -f1 -d'|'))" && ret=0
91
+ ;;
92
+ (info)
93
+ _arguments \
94
+ ":template name:($(kameleon template list | tail -n +4 | cut -f1 -d'|'))" && ret=0
95
+ '*'{-g,--global}':Custom global variable define as key\:value' && ret=0
96
+ ;;
97
+ (repository)
98
+ _kameleon_repository && ret=0
99
+ ;;
100
+ esac
101
+ esac
102
+ return ret
103
+ }
104
+ # TODO:
105
+ # - add checkpoint list completion
106
+ # - add key completion for global
107
+ # - factorize some options
108
+ # - allow common options everywere (not just befor command)
109
+
110
+ _kameleon () {
111
+ local curcontext=$curcontext state line ret=1
112
+ declare -A opt_args
113
+
114
+ _arguments -C \
115
+ '(--no-color)--color[Enables colorization in output (Default)]' \
116
+ '(--color)--no-color[Disables colorization in output]' \
117
+ '(--no-verbose --debug)--verbose[Enables verbose output for kameleon Users]' \
118
+ '(--verbose)--no-verbose[Disables verbose output for kameleon Users (Default)]' \
119
+ '(--no-debug)--debug[Enables debug output for kameleon Developpers]' \
120
+ '(--debug --verbose)--no-debug[Disables debug output for kameleon Users and Developpers(Default)]' \
121
+ '(--no-script)--script[Never prompts for User intervention]' \
122
+ '(--script)--no-script[Prompts for user intervention if necessary (Default)]' \
123
+ ': :->command' \
124
+ '*:: :->option-or-argument' && ret=0
125
+
126
+ case $state in
127
+ (command)
128
+ declare -a commands
129
+
130
+ commands=(
131
+ build:'Builds the appliance from the given recipe'
132
+ help:'Describe available commands or one specific command'
133
+ info:'Display detailed information about a recipe'
134
+ list:'Lists all defined recipes in the current directory'
135
+ new:'Creates a new recipe'
136
+ repository:'Manages set of remote git repositories'
137
+ template:'Lists and imports templates'
138
+ version:'Prints the Kameleon version information')
139
+
140
+ _describe -t commands command commands && ret=0
141
+ ;;
142
+ (option-or-argument)
143
+ curcontext=${curcontext%:*}-$line[1]:
144
+
145
+ case $line[1] in
146
+ (build)
147
+ _arguments -C \
148
+ '(--from-cache)1:Kameleon recipe path:_files' \
149
+ '(1)--from-cache=:Persistent cache tar file to build the image:_files' \
150
+ '(-b --build-path)'{-b,--build-path=}':Build directory path:_directories' \
151
+ '--clean[Runs the command `kameleon clean` first]' \
152
+ '--from-checkpoint=:Specify checkpoint to build the image' \
153
+ '--enable-checkpoint[Enables checkpoint \[experimental\]]' \
154
+ {--checkpoints,--list-checkpoints}'[Lists all availables checkpoints]' \
155
+ '--enable-cache[Generates a persistent cache for the appliance]' \
156
+ '--cache-path=:Cache directory path:_directories' \
157
+ '*'{-g,--global}':Custom global variable define as key\:value' && ret=0
158
+ ;;
159
+ (help)
160
+ _arguments \
161
+ ":Kameleon commands:($(kameleon commands))" && ret=0
162
+ ;;
163
+ (info)
164
+ _arguments \
165
+ '*'{-g,--global}':Custom global variable define as key\:value' \
166
+ '(--from-cache)1:Kameleon recipe path:_files' \
167
+ '(1)--from-cache=:Persistent cache tar file to get info from:_files' && ret=0
168
+ ;;
169
+ (list)
170
+ _nothing
171
+ ;;
172
+ (new)
173
+ _arguments \
174
+ '1:Kameleon recipe path:_files' \
175
+ '2:Template name:->template_name' && ret=0
176
+ case "$state" in
177
+ template_name)
178
+ _alternative ":templates name:($(kameleon template list | tail -n +4 | cut -f1 -d'|'))" && ret=0
179
+ ;;
180
+ esac
181
+ ;;
182
+ (repository)
183
+ _kameleon_repository && ret=0
184
+ ;;
185
+ (template)
186
+ _kameleon_template && ret=0
187
+ ;;
188
+ (*)
189
+ _nothing
190
+ ;;
191
+ esac
192
+ ;;
193
+ esac
194
+
195
+ return ret
196
+ }
197
+
198
+ _kameleon "$@"
data/lib/kameleon.rb CHANGED
@@ -35,12 +35,12 @@ module Kameleon
35
35
 
36
36
  def userdir
37
37
  @userdir ||= Pathname.new(File.join('~', '.kameleon.d'))
38
- Dir.mkdir(File.expand_path(@userdir.to_path)) unless File.exists?(File.expand_path(@userdir.to_path))
38
+ Dir.mkdir(File.expand_path(@userdir.to_s)) unless File.exists?(File.expand_path(@userdir.to_s))
39
39
  @userdir
40
40
  end
41
41
 
42
42
  def userconf_path
43
- @userconf_path ||= Pathname.new(File.join(File.expand_path(userdir.to_path), 'config'))
43
+ @userconf_path ||= Pathname.new(File.join(File.expand_path(userdir.to_s), 'config'))
44
44
  end
45
45
 
46
46
  def init_userconf()
@@ -73,7 +73,7 @@ module Kameleon
73
73
  :debug => userconf.fetch("debug", false),
74
74
  :script => userconf.fetch("script", false),
75
75
  :repositories_path => userconf.fetch("repositories_path",
76
- File.join(userdir.to_path, 'repos')),
76
+ File.join(userdir.to_s, 'repos')),
77
77
  }
78
78
  end
79
79
 
data/lib/kameleon/cli.rb CHANGED
@@ -141,7 +141,7 @@ module Kameleon
141
141
 
142
142
  template_path = File.join(Kameleon.env.repositories_path, template_name)
143
143
 
144
- recipe_path = Pathname.new(Kameleon.env.workspace).join(recipe_path).to_path
144
+ recipe_path = Pathname.new(Kameleon.env.workspace).join(recipe_path).to_s
145
145
 
146
146
  begin
147
147
  tpl = Kameleon::RecipeTemplate.new(template_path)
@@ -208,6 +208,9 @@ module Kameleon
208
208
  method_option :enable_checkpoint, :type => :boolean ,
209
209
  :default => false,
210
210
  :desc => "Enables checkpoint [experimental]"
211
+ method_option :list_checkpoints, :type => :boolean , :aliases => "--checkpoints",
212
+ :default => false,
213
+ :desc => "Lists all availables checkpoints"
211
214
  method_option :enable_cache, :type => :boolean,
212
215
  :default => false,
213
216
  :desc => "Generates a persistent cache for the appliance."
@@ -236,39 +239,27 @@ module Kameleon
236
239
  end
237
240
  raise BuildError, "A recipe file or a persistent cache archive " \
238
241
  "is required to run this command." if recipe_path.nil?
239
- clean(recipe_path) if options[:clean]
240
- engine = Kameleon::Engine.new(Recipe.new(recipe_path), options)
241
- Kameleon.ui.info("Starting build recipe '#{recipe_path}'")
242
- start_time = Time.now.to_i
243
- engine.build
244
- total_time = Time.now.to_i - start_time
245
- Kameleon.ui.info("")
246
- Kameleon.ui.info("Successfully built '#{recipe_path}'")
247
- Kameleon.ui.info("Total duration : #{total_time} secs")
248
- end
249
-
250
- desc "checkpoints [RECIPE_PATH]", "Lists all availables checkpoints"
251
- method_option :build_path, :type => :string ,
252
- :default => nil, :aliases => "-b",
253
- :desc => "Set the build directory path"
254
- def checkpoints(recipe_path)
255
- Kameleon.ui.level = "error"
256
- engine = Kameleon::Engine.new(Recipe.new(recipe_path), options)
257
- engine.pretty_checkpoints_list
258
- end
259
-
260
- desc "clean [RECIPE_PATH]", "Cleans all contexts and removing the checkpoints"
261
- method_option :build_path, :type => :string ,
262
- :default => nil, :aliases => "-b",
263
- :desc => "Sets the build directory path"
264
- def clean(recipe_path)
265
- opts = Hash.new.merge options
266
- opts[:lazyload] = false
267
- opts[:fail_silently] = true
268
- engine = Kameleon::Engine.new(Recipe.new(recipe_path), opts)
269
- engine.clean(:with_checkpoint => true)
242
+ if options[:clean]
243
+ opts = Hash.new.merge options
244
+ opts[:lazyload] = false
245
+ opts[:fail_silently] = true
246
+ engine = Kameleon::Engine.new(Recipe.new(recipe_path), opts)
247
+ engine.clean(:with_checkpoint => true)
248
+ elsif options[:list_checkpoints]
249
+ Kameleon.ui.level = "error"
250
+ engine = Kameleon::Engine.new(Recipe.new(recipe_path), options)
251
+ engine.pretty_checkpoints_list
252
+ else
253
+ engine = Kameleon::Engine.new(Recipe.new(recipe_path), options)
254
+ Kameleon.ui.info("Starting build recipe '#{recipe_path}'")
255
+ start_time = Time.now.to_i
256
+ engine.build
257
+ total_time = Time.now.to_i - start_time
258
+ Kameleon.ui.info("")
259
+ Kameleon.ui.info("Successfully built '#{recipe_path}'")
260
+ Kameleon.ui.info("Total duration : #{total_time} secs")
261
+ end
270
262
  end
271
- map %w(clear) => :clean
272
263
 
273
264
  desc "commands", "Lists all available commands", :hide => true
274
265
  def commands
@@ -34,9 +34,9 @@ module Kameleon
34
34
  Kameleon.ui.debug(" @#{key} : #{options[key]}")
35
35
  end
36
36
  @debug = true if ENV['KAMELEON_DEBUG']
37
-
38
- Dir.mkdir(@repositories_path.to_path) unless File.exists?(@repositories_path.to_path)
39
-
37
+ unless (File.exist?(@repositories_path.to_s) || File.symlink?(@repositories_path.to_s))
38
+ Dir.mkdir(@repositories_path.to_s)
39
+ end
40
40
  end
41
41
  end
42
42
  end
@@ -47,8 +47,8 @@ module Kameleon
47
47
  end
48
48
 
49
49
  def get_steps_dirs(recipe_path)
50
- relative_path = recipe_path.to_path.gsub(Kameleon.env.root_dir.to_path + '/', '')
51
- if relative_path.eql? recipe_path.to_path
50
+ relative_path = recipe_path.to_s.gsub(Kameleon.env.root_dir.to_s + '/', '')
51
+ if relative_path.eql? recipe_path.to_s
52
52
  subdirs = [recipe_path.dirname]
53
53
  else
54
54
  last_dir = Kameleon.env.root_dir
@@ -61,8 +61,8 @@ module Kameleon
61
61
  end
62
62
  steps_dirs = []
63
63
  subdirs.reverse_each do |p|
64
- steps_dirs.push(File.expand_path(File.join(p.to_path, 'steps')))
65
- steps_dirs.push(File.expand_path(File.join(p.to_path, '.steps')))
64
+ steps_dirs.push(File.expand_path(File.join(p.to_s, 'steps')))
65
+ steps_dirs.push(File.expand_path(File.join(p.to_s, '.steps')))
66
66
  end
67
67
  steps_dirs.select! { |x| File.exists? x }
68
68
  end
@@ -77,10 +77,10 @@ module Kameleon
77
77
  recipes_hash = []
78
78
  recipes_files = get_recipes(repository_path)
79
79
  recipes_files.each do |f|
80
- path = f.to_path
80
+ path = f.to_s
81
81
  begin
82
82
  recipe = RecipeTemplate.new(path)
83
- name = path.gsub(repository_path.to_path + '/', '').chomp('.yaml')
83
+ name = path.gsub(repository_path.to_s + '/', '').chomp('.yaml')
84
84
  recipes_hash.push({
85
85
  "name" => name,
86
86
  "description" => recipe.metainfo['description'],
@@ -104,7 +104,7 @@ module Kameleon
104
104
  path.children.collect do |child|
105
105
  if child.file?
106
106
  if child.extname == ".yaml"
107
- unless child.to_path.include? "/steps/" or child.to_path.include? "/.steps/"
107
+ unless child.to_s.include? "/steps/" or child.to_s.include? "/.steps/"
108
108
  child
109
109
  end
110
110
  end
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ from __future__ import unicode_literals, print_function
4
+ import argparse
5
+ import re
6
+ import os
7
+ import subprocess
8
+
9
+
10
+ def generate_changelog_title(version):
11
+ version_title = "Version %s" % version
12
+ return version_title + "\n" + "-" * len(version_title)
13
+
14
+
15
+ def bump_dev_version(part='patch'):
16
+ """ Increment the version number to the next development version
17
+
18
+ * (Configurably) bumps the development dev version number
19
+ * Preloads the correct changelog template for editing
20
+
21
+ You can run it like::
22
+
23
+ $ python scripts/next_release.py
24
+
25
+ which, by default, will create a 'patch' dev version (0.0.1 => 0.0.2-dev).
26
+
27
+ You can also specify a patch level (patch, minor, major) to change to::
28
+
29
+ $ python scripts/make_release.py major
30
+
31
+ which will create a 'major' release (0.0.2 => 1.0.0-dev).
32
+
33
+ """
34
+
35
+ # Dry run 'bumpversion' to find out what the new version number
36
+ # would be. Useful side effect: exits if the working directory is not
37
+ # clean.
38
+
39
+ bumpver = subprocess.check_output(
40
+ ['bumpversion', part, '--dry-run', '--verbose'],
41
+ stderr=subprocess.STDOUT)
42
+ m = re.search(r'Parsing version \'(\d+\.\d+\.\d+)\'', bumpver)
43
+ current_version = m.groups(0)[0]
44
+ m = re.search(r'New version will be \'(\d+\.\d+\.\d+)\.dev\'', bumpver)
45
+ next_version = m.groups(0)[0] + ".dev"
46
+
47
+ current_version_title = generate_changelog_title(current_version)
48
+ next_version_title = generate_changelog_title(next_version)
49
+
50
+ next_release_template = "%s\n\n**unreleased**\n\n" % next_version_title
51
+
52
+ changes = ""
53
+ with open('CHANGES') as fd:
54
+ changes += fd.read()
55
+
56
+ changes = changes.replace(current_version_title,
57
+ next_release_template + current_version_title)
58
+
59
+ with open('CHANGES', "w") as fd:
60
+ fd.write(changes)
61
+
62
+ # Tries to load the EDITOR environment variable, else falls back to vim
63
+ editor = os.environ.get('EDITOR', 'vim')
64
+ os.system("{} CHANGES".format(editor))
65
+
66
+ subprocess.check_output(['python', 'setup.py', 'sdist'])
67
+
68
+ # Have to add it so it will be part of the commit
69
+ subprocess.check_output(['git', 'add', 'CHANGES'])
70
+ subprocess.check_output(
71
+ ['git', 'commit', '-m', 'Changelog for {}'.format(next_version)])
72
+
73
+ # Really run bumpver to set the new release and tag
74
+ bv_args = ['bumpversion', part, '--no-tag', '--new-version', next_version]
75
+
76
+ subprocess.check_output(bv_args)
77
+
78
+
79
+ if __name__ == '__main__':
80
+ parser = argparse.ArgumentParser(
81
+ description=bump_dev_version.__doc__,
82
+ formatter_class=argparse.RawTextHelpFormatter
83
+ )
84
+ parser.add_argument("part", help="Part of the version to be bumped",
85
+ choices=["patch", "minor", "major"])
86
+ args = parser.parse_args()
87
+ bump_dev_version(args.part)
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ from __future__ import unicode_literals, print_function
4
+ import os
5
+ import re
6
+
7
+ from io import open
8
+
9
+ import argparse
10
+ import datetime
11
+ import subprocess
12
+
13
+
14
+ def generate_changelog_title(version):
15
+ version_title = "Version %s" % version
16
+ return version_title + "\n" + "-" * len(version_title)
17
+
18
+
19
+ def get_release_date():
20
+ dt = datetime.date.today()
21
+ if 4 <= dt.day <= 20 or 24 <= dt.day <= 30:
22
+ suffix = "th"
23
+ else:
24
+ suffix = ["st", "nd", "rd"][dt.day % 10 - 1]
25
+ return dt.strftime("%%B %%d%s %%Y" % suffix)
26
+
27
+
28
+ def bumpversion():
29
+ """ Automated software release workflow
30
+
31
+ * (Configurably) bumps the release version number
32
+ * Preloads the correct changelog template for editing
33
+ * Builds a source distribution
34
+ * Sets release date
35
+ * Tags the release
36
+
37
+ You can run it like::
38
+
39
+ $ python scripts/bumpversion.py
40
+
41
+ """
42
+
43
+ # Dry run 'bumpversion' to find out what the new version number
44
+ # would be. Useful side effect: exits if the working directory is not
45
+ # clean.
46
+
47
+ bumpver = subprocess.check_output(
48
+ ['bumpversion', 'release', '--dry-run', '--verbose'],
49
+ stderr=subprocess.STDOUT)
50
+ m = re.search(r'Parsing version \'(\d+\.\d+\.\d+)\.dev\'', bumpver)
51
+ current_version = m.groups(0)[0] + ".dev"
52
+ m = re.search(r'New version will be \'(\d+\.\d+\.\d+)\'', bumpver)
53
+ release_version = m.groups(0)[0]
54
+
55
+ date = get_release_date()
56
+
57
+ current_version_title = generate_changelog_title(current_version)
58
+ release_version_title = generate_changelog_title(release_version)
59
+ changes = ""
60
+ with open('CHANGES') as fd:
61
+ changes += fd.read()
62
+
63
+ changes = changes.replace(current_version_title, release_version_title)\
64
+ .replace("**unreleased**", "Released on %s" % date)
65
+
66
+ with open('CHANGES', "w") as fd:
67
+ fd.write(changes)
68
+
69
+ # Tries to load the EDITOR environment variable, else falls back to vim
70
+ editor = os.environ.get('EDITOR', 'vim')
71
+ os.system("{} CHANGES".format(editor))
72
+
73
+ # Have to add it so it will be part of the commit
74
+ subprocess.check_output(['git', 'add', 'CHANGES'])
75
+ subprocess.check_output(
76
+ ['git', 'commit', '-m', 'Changelog for {}'.format(release_version)])
77
+
78
+ # Really run bumpver to set the new release and tag
79
+ bv_args = ['bumpversion', 'release']
80
+
81
+ bv_args += ['--new-version', release_version]
82
+
83
+ subprocess.check_output(bv_args)
84
+
85
+
86
+ if __name__ == '__main__':
87
+ parser = argparse.ArgumentParser(
88
+ description=bumpversion.__doc__,
89
+ formatter_class=argparse.RawTextHelpFormatter
90
+ )
91
+ args = parser.parse_args()
92
+ bumpversion()
data/version.txt CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.6.0
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kameleon-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Salem Harrache
@@ -12,60 +13,66 @@ authors:
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2015-01-27 00:00:00.000000000 Z
16
+ date: 2015-05-13 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: childprocess
19
20
  requirement: !ruby/object:Gem::Requirement
21
+ none: false
20
22
  requirements:
21
- - - "~>"
23
+ - - ~>
22
24
  - !ruby/object:Gem::Version
23
25
  version: 0.5.3
24
- - - ">="
26
+ - - ! '>='
25
27
  - !ruby/object:Gem::Version
26
28
  version: 0.3.0
27
29
  type: :runtime
28
30
  prerelease: false
29
31
  version_requirements: !ruby/object:Gem::Requirement
32
+ none: false
30
33
  requirements:
31
- - - "~>"
34
+ - - ~>
32
35
  - !ruby/object:Gem::Version
33
36
  version: 0.5.3
34
- - - ">="
37
+ - - ! '>='
35
38
  - !ruby/object:Gem::Version
36
39
  version: 0.3.0
37
40
  - !ruby/object:Gem::Dependency
38
41
  name: thor
39
42
  requirement: !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
- - - "~>"
45
+ - - ~>
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0.19'
44
- - - ">="
48
+ - - ! '>='
45
49
  - !ruby/object:Gem::Version
46
50
  version: 0.15.0
47
51
  type: :runtime
48
52
  prerelease: false
49
53
  version_requirements: !ruby/object:Gem::Requirement
54
+ none: false
50
55
  requirements:
51
- - - "~>"
56
+ - - ~>
52
57
  - !ruby/object:Gem::Version
53
58
  version: '0.19'
54
- - - ">="
59
+ - - ! '>='
55
60
  - !ruby/object:Gem::Version
56
61
  version: 0.15.0
57
62
  - !ruby/object:Gem::Dependency
58
63
  name: table_print
59
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
60
66
  requirements:
61
- - - "~>"
67
+ - - ~>
62
68
  - !ruby/object:Gem::Version
63
69
  version: 1.5.2
64
70
  type: :runtime
65
71
  prerelease: false
66
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
67
74
  requirements:
68
- - - "~>"
75
+ - - ~>
69
76
  - !ruby/object:Gem::Version
70
77
  version: 1.5.2
71
78
  description: The mindful appliance builder
@@ -80,18 +87,18 @@ executables:
80
87
  extensions: []
81
88
  extra_rdoc_files: []
82
89
  files:
83
- - ".editorconfig"
84
- - ".env"
85
- - ".gitignore"
90
+ - .bumpversion.cfg
91
+ - .editorconfig
92
+ - .env
93
+ - .gitignore
86
94
  - AUTHORS
87
- - CHANGELOG.rst
95
+ - CHANGES
88
96
  - COPYING
89
97
  - Gemfile
90
98
  - README.rst
91
- - Thorfile
92
99
  - Vagrantfile
93
100
  - bin/kameleon
94
- - completion/_kameleon.zsh
101
+ - completion/_kameleon
95
102
  - completion/kameleon.bash
96
103
  - completion/kameleon.fish
97
104
  - contrib/kameleon_bashrc.sh
@@ -146,6 +153,8 @@ files:
146
153
  - lib/kameleon/ui.rb
147
154
  - lib/kameleon/utils.rb
148
155
  - lib/kameleon/version.rb
156
+ - scripts/bump-dev-version.py
157
+ - scripts/bump-release-version.py
149
158
  - tests/helper.rb
150
159
  - tests/recipes/steps/aliases/defaults.yaml
151
160
  - tests/recipes/steps/bootstrap/linux/bootstrap.yaml
@@ -162,27 +171,28 @@ files:
162
171
  homepage: http://kameleon.imag.fr/
163
172
  licenses:
164
173
  - GPL-2
165
- metadata: {}
166
174
  post_install_message:
167
175
  rdoc_options: []
168
176
  require_paths:
169
177
  - lib
170
178
  required_ruby_version: !ruby/object:Gem::Requirement
179
+ none: false
171
180
  requirements:
172
- - - ">="
181
+ - - ! '>='
173
182
  - !ruby/object:Gem::Version
174
183
  version: '0'
175
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
176
186
  requirements:
177
- - - ">="
187
+ - - ! '>='
178
188
  - !ruby/object:Gem::Version
179
189
  version: '0'
180
190
  requirements:
181
191
  - polipo 1.0.3, or greater
182
192
  rubyforge_project:
183
- rubygems_version: 2.4.5
193
+ rubygems_version: 1.8.23.2
184
194
  signing_key:
185
- specification_version: 4
195
+ specification_version: 3
186
196
  summary: Kameleon is a tool to build virtual machines from scratch
187
197
  test_files:
188
198
  - tests/helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: d24c2bbdf9e6c88d1e2d4d573210b1c8414c2af8
4
- data.tar.gz: 00379931012e6056b8cdcf89c196f60e02e3984a
5
- SHA512:
6
- metadata.gz: 20f79f9f06cfc7975a4dce207b07c037ed3ceebc9e6c3571e671ba48335b8608c9abc37d9899f03ea3444227b31384e625cf8d157bde0d7eb490b3b904a80516
7
- data.tar.gz: dec068dcdcd64c17d00a04d5378226e4036e761fd9c66d172d13859c600e63f1d3594eca6352724bb9d39c0cc15d2f77a9fa81b69ae18b073df22e8e0ede9fcd
data/Thorfile DELETED
@@ -1,29 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
-
3
- require "bundler"
4
- require "thor/rake_compat"
5
-
6
- class Default < Thor
7
- include Thor::RakeCompat
8
- Bundler::GemHelper.install_tasks
9
-
10
- desc "build", "Build kameleon-#{Kameleon::VERSION}.gem into the pkg directory"
11
- def build
12
- Rake::Task["build"].execute
13
- end
14
-
15
- desc "install", "Build and install kameleon-#{Kameleon::VERSION}.gem into system gems"
16
- def install
17
- Rake::Task["install"].execute
18
- end
19
-
20
- desc "release", "Create tag #{Kameleon::VERSION} and build and push kameleon-#{Kameleon::VERSION}.gem to Rubygems"
21
- def release
22
- Rake::Task["release"].execute
23
- end
24
-
25
- desc "spec", "Run RSpec code examples"
26
- def spec
27
- exec "rspec spec"
28
- end
29
- end
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env zsh
2
-
3
- if [[ ! -o interactive ]]; then
4
- return
5
- fi
6
-
7
- compctl -f -K _kameleon kameleon
8
-
9
- _kameleon() {
10
- local words completions
11
- read -cA words
12
-
13
- if [ "${#words}" -eq 2 ]; then
14
- completions="$(kameleon commands)"
15
- fi
16
-
17
- reply=("${(ps:\n:)completions}")
18
- }