samus 3.0.5 → 3.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 107ddf3e23736a0ae074d659c9424986ecbb81b312e20067d859f61eb687dddc
4
- data.tar.gz: 11b372f860d94c0def8601eabef8f5245b7088588f69e82badf04b697f8d4659
3
+ metadata.gz: 47915496a5eff19917c66ca7388eedbec635fc74edec591d3812c372be5320df
4
+ data.tar.gz: 8ccd1ec5293c13e891c99b018522192f1a7412c80455836c542f7e5a82c5bf64
5
5
  SHA512:
6
- metadata.gz: e9a6ca0de674ae5bf6849c4b677a77afc153c062a9e6bfaea652e4ba42a5d4f84d4ab5ea2920687e464d88731002ebcea494beacad44e4e0d57247a78cae7496
7
- data.tar.gz: 949768fe1572e39b222a33bcb2016dcb6190081dece25d2b28c3b54f0490f9a304cbc5954baf026d94b93abc78418b6906392fc615157440ac9f8cd918f0118b
6
+ metadata.gz: 9e0688d7e14d2b8d2fdcc8ae93c71c2f92d369dd4d5aa501a825fe4f8006e5b4cd5073e1b553b08d59de2d0b5636f556c8403a88a9e6e3fd694a10ebbe86f251
7
+ data.tar.gz: 959212c3c2437831e675b6c2d2a73f0a807c6ab55cdc66ecde554f5916851c3bcc0eaf57721116e913a96274bb8913f8c454ee697bc03095e88f54f43dbadf43
@@ -1,3 +1,15 @@
1
+ # master
2
+
3
+ # 3.0.6 - April 02nd, 2019
4
+
5
+ [3.0.6]: https://github.com/lsegal/samus/compare/v3.0.5...v3.0.6
6
+
7
+ - Add `--skip-restore` to samus build to skip restoring Git repository. Useful
8
+ with Docker build support in order to inspect output of a built release.
9
+ - Add `build/changelog-rotate` command for changelog rotation.
10
+ - Add `inspect` and `clean` Rake tasks for `DockerReleaseTask` to inspect and
11
+ remove a previously built release respectively.
12
+
1
13
  # 3.0.5 - April 1st, 2019
2
14
 
3
15
  - Fix bug that breaks DockerReleaseTask if .gitconfig or .samus configs are
@@ -97,7 +109,3 @@ end
97
109
  # 1.3.0 - July 23, 2014
98
110
 
99
111
  - Fix issue where repository would not reset when using `samus-build` command.
100
-
101
- ```
102
-
103
- ```
data/bin/samus CHANGED
@@ -43,6 +43,7 @@ command =
43
43
 
44
44
  dry_run = false
45
45
  zip_release = true
46
+ skip_restore = false
46
47
  outfile = nil
47
48
  docker = false
48
49
  docker_image = "lsegal/samus:latest"
@@ -63,6 +64,9 @@ options = OptionParser.new do |opts|
63
64
  opts.on('-o FILE', '--output', 'The file (no extension) to generate') do |file|
64
65
  outfile = file
65
66
  end
67
+ opts.on('--skip-restore', 'Skips restore after build completes') do
68
+ skip_restore = true
69
+ end
66
70
  end
67
71
  opts.on('--docker', 'Use Docker to build or publish') do |_v|
68
72
  docker = true
@@ -107,7 +111,7 @@ elsif command == Samus::Builder
107
111
  Samus::Builder.build_version = ver.sub(/^v/, '')
108
112
 
109
113
  (ARGV.empty? ? ['samus.json'] : ARGV).each do |file|
110
- command.new(file).build(dry_run, zip_release, outfile)
114
+ command.new(file).build(dry_run, zip_release, outfile, skip_restore)
111
115
  end
112
116
  else
113
117
  puts options
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ file = ARGV[0]
4
+ ver = ENV['_VERSION']
5
+ master = ENV['_MASTER'] || 'master'
6
+ title_fmt = ENV['_TITLE_FORMAT'] || "[$version] - %B %-d$day_nth, %Y"
7
+
8
+ content = File.read(file)
9
+ compare_url = `git config remote.origin.url`.strip.sub(/^git@(.+?):/, 'https://\1/')
10
+ day_nth = {1 => 'st', 2 => 'nd', 3 => 'rd'}[Time.now.day % 10] || 'th'
11
+ title = Time.now.strftime(title_fmt).sub('$version', ver).sub('$day_nth', day_nth)
12
+
13
+ match = /\A\s*# #{master}\r?\n(?<body>.*?)(?<rest>\r?\n# .+|\Z)/mis.match(content)
14
+ raise "Failed to rotate changelog: #{file}" unless match
15
+
16
+ prev_ver = match['rest'][/(\d+\.\d+(?:\.\d+)?)/, 1]
17
+ repl = "# #{master}\n\n# #{title}\n\n" +
18
+ (prev_ver ? "[#{ver}]: #{compare_url}/compare/v#{prev_ver}...v#{ver}\n" : '') +
19
+ match['body'] + match['rest']
20
+ File.open(file, 'w') {|f| f.write(repl) }
21
+ puts "Added new #{file} header: #{title}"
22
+ puts "Previous #{file} version: #{prev_ver.inspect}"
@@ -0,0 +1,16 @@
1
+ Rotates the latest ChangeLog entries into an arbitrary formatted title heading.
2
+ The heading is formatted via `title_format` and can include the version
3
+ and release date.
4
+
5
+ Files:
6
+
7
+ - The path to the ChangeLog file.
8
+
9
+ Arguments:
10
+
11
+ - master: (optional) defaults to "master", should match the first development
12
+ heading used for in-flux changelog entries before rotation.
13
+ - title_format: (optional) a `Time.strftime` date formatted string that can
14
+ also include `$version` to represent the title of the rotated changelog entry.
15
+ Example: `$version - %B %-d, %Y`. It is recommended to put the version at the
16
+ front of the title to improve the reliability of generating a compare URL.
@@ -6,8 +6,8 @@ module Samus
6
6
 
7
7
  module Rake
8
8
  # Autoloads
9
- autoload :ReleaseTask, File.expand_path('samus/rake/samus_task', __dir__)
10
- autoload :DockerReleaseTask, File.expand_path('samus/rake/samus_task', __dir__)
9
+ autoload :ReleaseTask, File.expand_path('samus/rake/tasks', __dir__)
10
+ autoload :DockerReleaseTask, File.expand_path('samus/rake/tasks', __dir__)
11
11
  end
12
12
 
13
13
  module_function
@@ -22,7 +22,7 @@ module Samus
22
22
  @manifest = {}
23
23
  end
24
24
 
25
- def build(dry_run = false, zip_release = true, outfile = nil)
25
+ def build(dry_run = false, zip_release = true, outfile = nil, skip_restore = false)
26
26
  orig_pwd = Dir.pwd
27
27
  manifest = { 'version' => version, 'actions' => [] }
28
28
  build_branch = "samus-release/v#{version}"
@@ -60,9 +60,13 @@ module Samus
60
60
  end
61
61
  end
62
62
  ensure
63
- restore_git_repo
64
- system "git checkout -q #{orig_branch} 2>#{devnull}"
65
- system "git branch -qD #{build_branch} 2>#{devnull}"
63
+ if skip_restore
64
+ remove_restore_file
65
+ else
66
+ restore_git_repo
67
+ system "git checkout -q #{orig_branch} 2>#{devnull}"
68
+ system "git branch -qD #{build_branch} 2>#{devnull}"
69
+ end
66
70
  end
67
71
 
68
72
  private
@@ -60,7 +60,7 @@ module Samus
60
60
  Samus::CONFIG_PATH => '.samus',
61
61
  File.expand_path('~/.gitconfig') => '.gitconfig'
62
62
  }.merge(extra_config)
63
- @config_files.reject! {|src, _dst| !File.exist?(src) }
63
+ @config_files.select! {|src, _dst| File.exist?(src) }
64
64
  end
65
65
 
66
66
  def copy_prep
@@ -83,12 +83,12 @@ module Samus
83
83
  "COPY . /build",
84
84
  config_copies.join("\n"),
85
85
  "RUN rm -rf /build/.samusprep",
86
- "RUN samus build ${VERSION}"
86
+ "RUN samus build --skip-restore ${VERSION}"
87
87
  ].join("\n"))
88
88
  end
89
89
  fname
90
90
  end
91
-
91
+
92
92
  def define
93
93
  namespace(@namespace) do
94
94
  desc '[VERSION=X.Y.Z] Builds a Samus release using Docker'
@@ -99,7 +99,7 @@ module Samus
99
99
 
100
100
  begin
101
101
  copy_prep
102
- sh "docker build . -t #{img} -f #{build_or_get_dockerfile} --build-arg VERSION=#{ver}"
102
+ sh "docker build . --rm -t #{img} -f #{build_or_get_dockerfile} --build-arg VERSION=#{ver}"
103
103
  ensure
104
104
  FileUtils.rm_rf(PREP_DIR)
105
105
  end
@@ -109,10 +109,20 @@ module Samus
109
109
  task :publish do
110
110
  img = release_image
111
111
  mount = mount_samus_config ? "-v #{Samus::CONFIG_PATH}:/root/.samus:ro" : ''
112
- sh "docker run #{mount} --rm #{img}"
113
- sh "docker rmi -f #{img}" if delete_image_after_publish
112
+ sh "docker run #{mount} --rm #{release_image}"
113
+ Rake::Task["#{@namespace}:clean"].execute if delete_image_after_publish
114
114
  sh "git pull" if git_pull_after_publish
115
115
  end
116
+
117
+ desc '[VERSION=X.Y.Z] Inspects a built release using Docker shell'
118
+ task :inspect do
119
+ sh "docker run -it --entrypoint sh #{release_image}"
120
+ end
121
+
122
+ desc '[VERSION=X.Y.Z] Removes a built release using Docker'
123
+ task :clean do
124
+ sh "docker rmi -f #{release_image}"
125
+ end
116
126
  end
117
127
  end
118
128
  end
@@ -140,7 +150,7 @@ module Samus
140
150
  def zipfile
141
151
  @zipfile || "release-v#{release_version}.tar.gz"
142
152
  end
143
-
153
+
144
154
  def define
145
155
  namespace(@namespace) do
146
156
  desc '[VERSION=X.Y.Z] Builds a Samus release'
@@ -1,3 +1,3 @@
1
1
  module Samus
2
- VERSION = '3.0.5'.freeze
2
+ VERSION = '3.0.6'.freeze
3
3
  end
data/samus.json CHANGED
@@ -8,6 +8,13 @@
8
8
  "replace": "VERSION = '$version'"
9
9
  }
10
10
  },
11
+ {
12
+ "action": "changelog-rotate",
13
+ "files": ["CHANGELOG.md"],
14
+ "arguments": {
15
+ "title_format": "$version - %B %d$day_nth, %Y"
16
+ }
17
+ },
11
18
  {
12
19
  "action": "chmod-files",
13
20
  "files": [
@@ -19,7 +26,7 @@
19
26
  },
20
27
  {
21
28
  "action": "git-commit",
22
- "files": ["lib/*/version.rb"]
29
+ "files": ["CHANGELOG.md", "lib/*/version.rb"]
23
30
  },
24
31
  {
25
32
  "action": "git-merge",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lsegal@soen.ca
@@ -32,6 +32,8 @@ files:
32
32
  - commands/build/archive-zip.help.md
33
33
  - commands/build/changelog-parse
34
34
  - commands/build/changelog-parse.help.md
35
+ - commands/build/changelog-rotate
36
+ - commands/build/changelog-rotate.help.md
35
37
  - commands/build/chmod-files
36
38
  - commands/build/chmod-files.help.md
37
39
  - commands/build/fs-copy
@@ -90,7 +92,7 @@ files:
90
92
  - lib/samus/credentials.rb
91
93
  - lib/samus/publish_action.rb
92
94
  - lib/samus/publisher.rb
93
- - lib/samus/rake/samus_task.rb
95
+ - lib/samus/rake/tasks.rb
94
96
  - lib/samus/version.rb
95
97
  - samus.gemspec
96
98
  - samus.json