rake-deveiate 0.17.4 → 0.18.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75429da7cdad951ae72e7dcb020a5b7c96dbc0fe61e9c440061e426122081679
4
- data.tar.gz: ed1113af4145ba0eec87f020a7db97877e9c119c7a68a682dc574522fdae4e6d
3
+ metadata.gz: ddcff2d4dd59a477b6105e7841c52d732553e6c21266a18d8ecc1a9fdb14c2b9
4
+ data.tar.gz: 4848059cbf391eb6700fbc83b9aaf7dec1aecde24f993261816569a06c6b1f0a
5
5
  SHA512:
6
- metadata.gz: b608212076021421b83d5fb0e13676da66729e8f82aa1885667a42a0a9d60650f1a9e4c24d6ef8438e4a31eb3328742657e32dd901b753609de7b17b2f1f6b5e
7
- data.tar.gz: 9e0e5373d7a3cb71601d0f86f3326fca517cc7d9a1bac94180aa451fa6a73d29e2b4cf704d8ecf4e838ed91658987d4dc82b54cfb403441135633dcf04f9631c
6
+ metadata.gz: f443f21c87d6a642a88fa87515f316a7813de4ad28f511023d2a4eeb83ce70f7c824a8b5ed0b7b7fbaf218172d8a5fc1cf97b843ef37b78a8e07276203224067
7
+ data.tar.gz: eb94a0d1f699704a6e2549bcb99036afbd9da183f737fc3351d78bc2944369a94cf2b3ca1165cdfe2be35deec65a2077bba5edce710ec97e417d4fb5869ba7e1
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## v0.18.0 [2021-01-07] Michael Granger <ged@FaerieMUD.org>
6
+
7
+ Improvements:
8
+
9
+ - Add gem push key setting
10
+ - Add release branch check
11
+ - Fix a bunch of git functionality
12
+
13
+
5
14
  ## v0.17.4 [2021-01-02] Michael Granger <ged@FaerieMUD.org>
6
15
 
7
16
  Bugfixes:
@@ -35,7 +35,7 @@ class Rake::DevEiate < Rake::TaskLib
35
35
  VERSION_PATTERN = /VERSION\s*=\s*(?<quote>['"])(?<version>\d+(\.\d+){2}.*)\k<quote>/
36
36
 
37
37
  # The version of this library
38
- VERSION = '0.17.4'
38
+ VERSION = '0.18.0'
39
39
 
40
40
  # The server to release to by default
41
41
  DEFAULT_GEMSERVER = 'https://rubygems.org/'
@@ -285,6 +285,10 @@ class Rake::DevEiate < Rake::TaskLib
285
285
  # The gemserver to push gems to
286
286
  attr_accessor :allowed_push_host
287
287
 
288
+ ##
289
+ # An alternative key to use for pushing gems (private gemserver)
290
+ attr_accessor :gem_push_key
291
+
288
292
  ##
289
293
  # The rsync-compatible target to publish documentation to.
290
294
  attr_accessor :publish_to
@@ -297,6 +301,10 @@ class Rake::DevEiate < Rake::TaskLib
297
301
  # The prefix to use for version tags
298
302
  attr_accessor :release_tag_prefix
299
303
 
304
+ ##
305
+ # The name of the branch to release from
306
+ attr_accessor :release_branch
307
+
300
308
 
301
309
  #
302
310
  # Task definition
@@ -25,16 +25,26 @@ module Rake::DevEiate::Git
25
25
  STATUS_COLORS = {
26
26
  'M' => [:blue], # modified
27
27
  'A' => [:bold, :green], # added
28
- 'R' => [:bold, :black], # removed
28
+ 'D' => [:bold, :black], # deleted
29
29
  'C' => [:white], # clean
30
30
  '!' => [:bold, :white, :on_red], # missing
31
31
  '?' => [:yellow], # not tracked
32
32
  'I' => [:dim, :white], # ignored
33
33
  }
34
34
 
35
+ STATUS_DESCRIPTIONS = {
36
+ 'M' => 'modified',
37
+ 'D' => 'deleted',
38
+ '?' => 'untracked',
39
+ 'A' => 'new',
40
+ }
41
+
35
42
  # File indentation
36
43
  FILE_INDENT = " • "
37
44
 
45
+ # The name of the branch releases should be created from
46
+ DEFAULT_RELEASE_BRANCH = 'master'
47
+
38
48
 
39
49
  ### Define version-control tasks
40
50
  def define_tasks
@@ -42,6 +52,8 @@ module Rake::DevEiate::Git
42
52
 
43
53
  return unless self.is_git_working_copy?
44
54
 
55
+ self.release_branch = DEFAULT_RELEASE_BRANCH
56
+
45
57
  # :TODO: Should be refactored up with the same code in the hg lib.
46
58
  file COMMIT_MSG_FILE.to_s do |task|
47
59
  commit_log = Pathname( task.name )
@@ -133,9 +145,17 @@ module Rake::DevEiate::Git
133
145
 
134
146
  ### The body of the git:prerelease task.
135
147
  def do_git_prerelease( task, args )
136
- uncommitted_files = self.git.status( n: true )
137
- unless uncommitted_files.empty?
138
- self.show_git_file_statuses( uncommitted_files )
148
+ if self.release_branch
149
+ current_branch = self.git.cmd( 'branch --show-current' )
150
+ unless self.release_branch == current_branch
151
+ self.prompt.warn "Releasing from a non-release branch (%s)." % [ current_branch ]
152
+ fail unless self.prompt.yes?( "Release anyway?" )
153
+ end
154
+ end
155
+
156
+ status = self.git.status
157
+ unless status.untracked.empty? && status.changed.empty?
158
+ self.show_git_file_statuses( status )
139
159
 
140
160
  fail unless self.prompt.yes?( "Release anyway?" ) do |q|
141
161
  q.default( false )
@@ -145,7 +165,7 @@ module Rake::DevEiate::Git
145
165
  end
146
166
 
147
167
  pkg_version_tag = self.current_git_version_tag
148
- rev = self.git.identity.id
168
+ rev = self.git.revparse( 'HEAD' )
149
169
 
150
170
  # Look for a tag for the current release version, and if it exists abort
151
171
  if self.git.tags.find {|tag| tag.name == pkg_version_tag }
@@ -155,35 +175,17 @@ module Rake::DevEiate::Git
155
175
 
156
176
  # Tag the current rev
157
177
  self.prompt.ok "Tagging rev %s as %s" % [ rev, pkg_version_tag ]
158
- self.git.tag( pkg_version_tag, rev: rev )
159
-
160
- # Sign the tag
161
- if self.git.extension_enabled?( :gpg )
162
- if self.prompt.yes?( "Sign %s?" % [pkg_version_tag] )
163
- self.git.sign( pkg_version_tag, message: "Signing %s" % [pkg_version_tag] )
164
- end
165
- end
178
+ self.git.cmd "tag -s -m 'Tagging for release %s' %s %s" %
179
+ [ pkg_version_tag, pkg_version_tag, rev ]
166
180
  end
167
181
 
168
182
 
169
183
  ### The body of the git:postrelease task.
170
184
  def do_git_postrelease( task, args )
171
- if self.git.status( 'checksum', unknown: true ).any?
185
+ if self.git.status.untracked.keys.any? {|path| path.start_with?('checksum/') }
172
186
  self.prompt.say "Adding release artifacts..."
173
187
  self.git.add( 'checksum' )
174
- self.git.commit( 'checksum', message: "Adding release checksum." )
175
- end
176
-
177
- if self.prompt.yes?( "Move released changesets to public phase?" )
178
- self.prompt.say "Publicising changesets..."
179
- self.git.phase( public: true )
180
- end
181
-
182
- if self.git.extension_enabled?( :topic )
183
- current_topic = self.git.topic
184
- if current_topic && self.prompt.yes?( "Clear the current topic (%s)?" %[current_topic] )
185
- self.git.topic( clear: true )
186
- end
188
+ self.git.commit( "Adding release checksum." )
187
189
  end
188
190
 
189
191
  Rake::Task['git:push'].invoke
@@ -371,7 +373,7 @@ module Rake::DevEiate::Git
371
373
  header_char = self.header_char_for( self.history_file )
372
374
  ext = self.history_file.extname
373
375
  log_entries = if previous_tag
374
- self.git.log( rev: "#{previous_tag}~-2::" )
376
+ self.git.log.between( previous_tag )
375
377
  else
376
378
  self.git.log
377
379
  end
@@ -455,11 +457,14 @@ module Rake::DevEiate::Git
455
457
  ### Given a +status_hash+ like that returned by Git::Repo.status, return a
456
458
  ### string description of the files and their status.
457
459
  def show_git_file_statuses( statuses )
458
- lines = statuses.map do |entry|
459
- status_color = STATUS_COLORS[ entry.status ]
460
+ entries = statuses.select( &:type ) + statuses.untracked.values
461
+
462
+ lines = entries.map do |entry|
463
+ status = entry.type || '?'
464
+ status_color = STATUS_COLORS[ status ]
460
465
  " %s: %s" % [
461
- self.pastel.white( entry.path.to_s ),
462
- self.pastel.decorate( entry.status_description, *status_color ),
466
+ self.pastel.bold.white( entry.path.to_s ),
467
+ self.pastel.decorate( STATUS_DESCRIPTIONS[status], *status_color ),
463
468
  ]
464
469
  end
465
470
 
@@ -32,6 +32,9 @@ module Rake::DevEiate::Hg
32
32
  # File indentation
33
33
  FILE_INDENT = " • "
34
34
 
35
+ # The name of the branch releases should be created from
36
+ DEFAULT_RELEASE_BRANCH = 'default'
37
+
35
38
 
36
39
  ### Define version-control tasks
37
40
  def define_tasks
@@ -39,6 +42,10 @@ module Rake::DevEiate::Hg
39
42
 
40
43
  return unless self.is_hg_working_copy?
41
44
 
45
+ # :TODO: Actually check for this? Doesn't make much as much sense given my
46
+ # Mercurial workflow.
47
+ self.release_branch = DEFAULT_RELEASE_BRANCH
48
+
42
49
  file COMMIT_MSG_FILE.to_s do |task|
43
50
  commit_log = Pathname( task.name )
44
51
 
@@ -42,7 +42,10 @@ module Rake::DevEiate::Releases
42
42
  gemserver = self.allowed_push_host || Rake::DevEiate::DEFAULT_GEMSERVER
43
43
 
44
44
  if self.prompt.yes?( "Push a new gem to #{gemserver}?" ) {|q| q.default(false) }
45
- sh( Gem.ruby, "-S", "gem", "push", self.gem_path.to_s )
45
+ push_args = [ "push", self.gem_path.to_s ]
46
+ push_args << '-k' << self.gem_push_key if self.gem_push_key
47
+
48
+ sh( Gem.ruby, "-S", "gem", *push_args )
46
49
  end
47
50
  end
48
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-deveiate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.4
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -33,7 +33,7 @@ cert_chain:
33
33
  MCh97sQ/Z/MOusb5+QddBmB+k8EicXyGNl4b5L4XpL7fIQu+Y96TB3JEJlShxFD9
34
34
  k9FjI4d9EP54gS/4
35
35
  -----END CERTIFICATE-----
36
- date: 2021-01-02 00:00:00.000000000 Z
36
+ date: 2021-01-07 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rake
metadata.gz.sig CHANGED
Binary file