deploy_pin 1.7.2 → 1.7.3

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: 92739dddf68cb804a3d4e76873afcaa11bcf5481ebcf8dd45d277ae992616eb7
4
- data.tar.gz: 729e8e6401392109892d868613e996517a56e476a01f74ed968a6fd79d5c9f0f
3
+ metadata.gz: bbad45594241ef2a7613489332a0efcd0604c58c30775e53027603b58059fd34
4
+ data.tar.gz: 24a5638349e03c92b567bb4c6e48f028c1df0129ddedfe9b4705d20036954817
5
5
  SHA512:
6
- metadata.gz: 4655ced6a71eec2d98aa92e30cd5a16584c50b02b7d3757b8bd7a5c6898d6b93a904944d8e9ce478a80889e62f76ac78c6808b533ff004546cab4e33965a4e02
7
- data.tar.gz: 105bef59cd93ba4a9c2fe88e8c60c75ce000439810c346359fcb9f823cdb025cf989137216a5f74c8aa5f212672ebc06df42feac1c2247dee745ea40b36e8d4a
6
+ metadata.gz: 14fef9659762d17bbdf5c721090417da057acad42d0cd235aa324ca85a635857a327db5fb3242a0bcac9e3988d114c8ca5fe08819ca9a466694c9209ae20df7f
7
+ data.tar.gz: 13b62e5697393d56efd1903713805770099d80b5e7668b81a723e42ede661fc3fd9643cde7ff4e0359d035def86cb1cac4873083dc988739f0733d1589221536
data/README.md CHANGED
@@ -143,7 +143,7 @@ Check the documentation [here](lib/deploy_pin/parallel_wrapper.rb) for more deta
143
143
 
144
144
  ## Formatting
145
145
 
146
- `run_formatter` is used to format the output of a `run` task, and `list_formatter` is used to format the output of a `list` task. To set a default value, you should define it in the deploy_pin initializer:
146
+ `run_formatter` is used to format the output of a `run` task, `list_formatter` for the `list` task and `list_short_formatter` is used to format the output of a `short_list` task. To set a default value, you should define it in the deploy_pin initializer:
147
147
 
148
148
  ```ruby
149
149
  # config/initializers/deploy_pin.rb
@@ -171,6 +171,23 @@ DeployPin.setup do
171
171
  puts("\n<<<\n#{task.script.strip.green}\n>>>\n\n")
172
172
  end
173
173
  )
174
+ short_list_formatter(
175
+ lambda do |group, tasks, start_index|
176
+ puts(" Group: #{group} ".center(38, "=").light_cyan.bold)
177
+ puts("\n")
178
+
179
+ tasks.each.with_index(start_index) do |task, index|
180
+ puts(" Task ##{index} ".center(38, "=").blue.bold)
181
+ # print details
182
+ task.details.each do |key, value|
183
+ key_aligned = "#{key}:".ljust(20)
184
+ puts("#{key_aligned}#{value}")
185
+ end
186
+
187
+ puts("\n")
188
+ end
189
+ end
190
+ )
174
191
  end
175
192
  ```
176
193
 
@@ -241,5 +258,34 @@ bundle exec rake deploy_pin:run[rollback] - # enters "pending state"
241
258
  ## Contributing
242
259
  Contribution directions go here.
243
260
 
261
+ ### Running Tests Locally
262
+
263
+ To ensure your changes meet the required standards and pass all tests before submitting a pull request, you can simulate the GitHub Actions workflow locally using the [`act`](https://github.com/nektos/act) tool.
264
+
265
+ #### Prerequisites
266
+
267
+ 1. **Install `act`**
268
+ Follow the installation guide provided in the official [`act` documentation](https://nektosact.com/installation/index.html).
269
+
270
+ 2. **Docker**
271
+ Ensure Docker is installed and running on your machine.
272
+
273
+ #### Running the Workflow
274
+
275
+ Use the following command to simulate the workflow locally:
276
+
277
+ ```bash
278
+ act pull_request --secret-file .env --container-architecture linux/amd64 -W .github/workflows -j rspec
279
+ ```
280
+
281
+ This command does the following:
282
+ - `pull_request`: Runs the pull_request workflow defined in your .github/workflows directory.
283
+ - `--secret-file .env`: Uses the .env file provided in the repository to load environment variables.
284
+ - `--container-architecture linux/amd64`: Ensures compatibility with GitHub Actions runners.
285
+ - `-W .github/workflows`: Specifies the directory containing the workflow files.
286
+ - `-j rspec`: Runs the `rspec` job defined in the workflow.
287
+
288
+ For more details on customizing this command, refer to the [act documentation](https://nektosact.com/).
289
+
244
290
  ## License
245
291
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -26,6 +26,14 @@ module DeployPin
26
26
  end
27
27
  end
28
28
 
29
+ def short_list
30
+ groups_tasks = init_tasks.group_by(&:group).to_a
31
+ groups_tasks.inject(0) do |offset, (group, tasks)|
32
+ DeployPin.short_list_formatter.call(group, tasks, offset)
33
+ offset + tasks.count
34
+ end
35
+ end
36
+
29
37
  def executable
30
38
  # cache tasks
31
39
  tasks = init_tasks
@@ -11,6 +11,10 @@ module DeployPin
11
11
  DeployPin::Collector.new(identifiers:).list
12
12
  end
13
13
 
14
+ def self.short_list(identifiers:)
15
+ DeployPin::Collector.new(identifiers:).short_list
16
+ end
17
+
14
18
  def self.summary(identifiers:)
15
19
  # print summary
16
20
  self.print('======= Summary ========')
@@ -10,6 +10,7 @@ module DeployPin
10
10
  :identifier,
11
11
  :group,
12
12
  :title,
13
+ :affected_areas,
13
14
  :script,
14
15
  :recurring,
15
16
  :explicit_timeout
@@ -21,6 +22,7 @@ module DeployPin
21
22
  @identifier = nil
22
23
  @group = nil
23
24
  @title = ''
25
+ @affected_areas = ''
24
26
  @script = ''
25
27
  @explicit_timeout = false
26
28
  @parallel = false
@@ -80,6 +82,8 @@ module DeployPin
80
82
  @recurring = Regexp.last_match(3)
81
83
  when /\A# task_title:(.+)/
82
84
  @title = Regexp.last_match(1).strip
85
+ when /\A# affected_areas:(.+)/
86
+ @affected_areas = Regexp.last_match(1).strip
83
87
  when /\A[^#].*/
84
88
  @script += line
85
89
 
@@ -101,7 +105,8 @@ module DeployPin
101
105
  {
102
106
  identifier:,
103
107
  group:,
104
- title:
108
+ title:,
109
+ affected_areas:
105
110
  }
106
111
  end
107
112
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployPin
4
- VERSION = '1.7.2'
4
+ VERSION = '1.7.3'
5
5
  end
data/lib/deploy_pin.rb CHANGED
@@ -19,6 +19,7 @@ module DeployPin
19
19
  fallback_group
20
20
  groups
21
21
  list_formatter
22
+ short_list_formatter
22
23
  run_formatter
23
24
  statement_timeout
24
25
  task_wrapper
@@ -19,5 +19,13 @@ module DeployPin
19
19
  def copy_initializer
20
20
  template 'deploy_pin.rb', 'config/initializers/deploy_pin.rb'
21
21
  end
22
+
23
+ def activerecord_migration_class
24
+ if ::ActiveRecord::Migration.respond_to?(:current_version)
25
+ "ActiveRecord::Migration[#{::ActiveRecord::Migration.current_version}]"
26
+ else
27
+ 'ActiveRecord::Migration'
28
+ end
29
+ end
22
30
  end
23
31
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateDeployPins < ActiveRecord::Migration[7.0]
3
+ class CreateDeployPins < <%= activerecord_migration_class %>
4
4
  def change
5
5
  create_table :deploy_pins do |t|
6
6
  t.string :uuid
@@ -34,4 +34,21 @@ DeployPin.setup do
34
34
  puts("\n<<<\n#{task.script.strip.green}\n>>>\n\n")
35
35
  end
36
36
  )
37
+ short_list_formatter(
38
+ lambda do |group, tasks, start_index|
39
+ puts(" Group: #{group} ".center(38, "=").light_cyan.bold)
40
+ puts("\n")
41
+
42
+ tasks.each.with_index(start_index) do |task, index|
43
+ puts(" Task ##{index} ".center(38, "=").blue.bold)
44
+ # print details
45
+ task.details.each do |key, value|
46
+ key_aligned = "#{key}:".ljust(20)
47
+ puts("#{key_aligned}#{value}")
48
+ end
49
+
50
+ puts("\n")
51
+ end
52
+ end
53
+ )
37
54
  end
@@ -15,4 +15,11 @@ namespace :deploy_pin do
15
15
  DeployPin::Runner.list(**args)
16
16
  DeployPin::Runner.summary(**args)
17
17
  end
18
+
19
+ task :short_list, [:identifiers] => :environment do |_t, args|
20
+ args.with_defaults(identifiers: DeployPin.groups)
21
+
22
+ DeployPin::Runner.short_list(**args)
23
+ DeployPin::Runner.summary(**args)
24
+ end
18
25
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_pin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Sych
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-17 00:00:00.000000000 Z
10
+ date: 2025-01-23 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: colorize
@@ -56,16 +55,22 @@ dependencies:
56
55
  name: rails
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - "~>"
58
+ - - ">="
60
59
  - !ruby/object:Gem::Version
61
60
  version: '7.0'
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '9.0'
62
64
  type: :runtime
63
65
  prerelease: false
64
66
  version_requirements: !ruby/object:Gem::Requirement
65
67
  requirements:
66
- - - "~>"
68
+ - - ">="
67
69
  - !ruby/object:Gem::Version
68
70
  version: '7.0'
71
+ - - "<"
72
+ - !ruby/object:Gem::Version
73
+ version: '9.0'
69
74
  - !ruby/object:Gem::Dependency
70
75
  name: redis
71
76
  requirement: !ruby/object:Gem::Requirement
@@ -260,7 +265,6 @@ licenses:
260
265
  - MIT
261
266
  metadata:
262
267
  allowed_push_host: https://rubygems.org
263
- post_install_message:
264
268
  rdoc_options: []
265
269
  require_paths:
266
270
  - lib
@@ -275,8 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
279
  - !ruby/object:Gem::Version
276
280
  version: '0'
277
281
  requirements: []
278
- rubygems_version: 3.5.16
279
- signing_key:
282
+ rubygems_version: 3.6.2
280
283
  specification_version: 4
281
284
  summary: pin some task around deployment
282
285
  test_files: []