intello-shipit-cli 1.1.0 → 1.3.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: e8357db54113d84cd737edb6bf57228fa235df527fba88af7de8eecaa4d0f5d4
4
- data.tar.gz: 3716cc73141f21833285e40a3b1b3f28199de3eae8d0133008e5b36e35015d92
3
+ metadata.gz: 0c4795dc17a4c6b03dc3446b9f365f5be72f33ca155f54bb621aac3fbc631e7a
4
+ data.tar.gz: 106c04cf366e83b3b3616e192c866936929bd99d623e75853c91562376d3bd45
5
5
  SHA512:
6
- metadata.gz: 63e909865718db3d151bfdaed972b7f127cd9d905ee42f5a6584849d4d5b706156ba98c795a12acfff063b4375e0762b6c2bd66de31e1e4d9a0564d095f7f8e5
7
- data.tar.gz: 27dee93a4f8a9a667eda387f8946509708738f63c7e1cd1c29d4e48bef437a28117829d893c63c6e6a8925289deeaa3e8686df5e15266814a3b24041c768a752
6
+ metadata.gz: f04183c2c88b07988dd50b82ba70e3db98ed9b1afb02b684617d7b9e5ae2c4bcaa6f2de04c8d07923e73b6f87e2ccc811a06d4fede245cca0e9ff17daa30f12a
7
+ data.tar.gz: f2b9437e9d64b0a78bc6afe4c4d885f979630897fc8713d97bcec0cd99b05bc8d0bf186d320d5ba332e3ee1d4203179d662590937a97611a0bd7c57bdc1de3cd
data/Changelog.md CHANGED
@@ -4,14 +4,20 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  NOTE: the project follows [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## Firmware
7
+ ## v1.3.0 - October 12th, 2022
8
8
 
9
- ### v1.1.0 - February 7th, 2022
9
+ - [enhancement] #8 - Add option to skip CICD when shipping
10
+
11
+ ## v1.2.0 - March 9th, 2022
12
+
13
+ - [bug] #3 - Support when project is located in sub folder
14
+
15
+ ## v1.1.0 - February 7th, 2022
10
16
 
11
17
  - [enhancement] #5 - Run shipit from a Docker environement for nonLinux environement
12
18
  - [task] #1 - Support gitlab.com new Draft status
13
19
 
14
- ### v1.0.0 - November 25th, 2021
20
+ ## v1.0.0 - November 25th, 2021
15
21
 
16
22
  - Inivial version
17
23
 
data/exe/shipit CHANGED
@@ -24,6 +24,7 @@ sort_help :manually
24
24
  flag [:c, :config], default_value: File.join(ENV["HOME"], ".shipit.yml"), desc: "Set the saved configuration path"
25
25
  flag [:e, :endpoint], desc: "Set the shipit API endpoint"
26
26
  flag [:p, :private_token], desc: "Set your private token to access the shipit API"
27
+ flag [:ship_skips_ci], default_value: false, desc: "Skip running the CI/CD after running `shipit work #`"
27
28
 
28
29
  # Switches
29
30
  switch :dry_run, default_value: false, desc: "Dry Run mode, no git or POST/PUT commands are run"
@@ -8,9 +8,9 @@ module Shipit
8
8
  #
9
9
  class Configuration
10
10
  # List of all the configuration attributes stored for use within the gem
11
- ATTRIBUTES = [:endpoint, :private_token, :protected_branches]
11
+ ATTRIBUTES = [:endpoint, :private_token, :protected_branches, :ship_skips_ci]
12
12
 
13
- attr_accessor :endpoint, :private_token, :protected_branches
13
+ attr_accessor :endpoint, :private_token, :protected_branches, :ship_skips_ci
14
14
 
15
15
  # Apply a configuration hash to a configuration instance
16
16
  #
@@ -3,7 +3,7 @@ require "yaml"
3
3
  module Shipit
4
4
  module Cli
5
5
  class ConfigurationFile
6
- ATTR_READER = [:endpoint, :private_token, :protected_branches]
6
+ ATTR_READER = [:endpoint, :private_token, :protected_branches, :ship_skips_ci]
7
7
  attr_reader(*ATTR_READER)
8
8
 
9
9
  def initialize(path, configuration = nil)
@@ -9,12 +9,12 @@ module Shipit
9
9
  new: {
10
10
  desc: "create new branch `branch`",
11
11
  commands: [
12
- '"#{GIT} push #{origin} #{current_branch}:refs/heads/#{branch} --no-verify #{VERBOSE}"',
12
+ '"#{GIT} push #{ship_skips_ci}#{origin} #{current_branch}:refs/heads/#{branch} --no-verify #{VERBOSE}"',
13
13
  '"#{GIT} fetch #{origin} #{VERBOSE}"',
14
14
  '"#{GIT} branch --track #{branch} #{origin}/#{branch} #{VERBOSE}"',
15
15
  '"#{GIT} checkout #{branch} #{VERBOSE}"',
16
16
  '"#{GIT} commit --allow-empty -m \"#{message}\" #{VERBOSE}"',
17
- '"#{GIT} push --no-verify #{VERBOSE}"'
17
+ '"#{GIT} push #{ship_skips_ci}--no-verify #{VERBOSE}"'
18
18
  ]
19
19
  }
20
20
  }
@@ -27,8 +27,10 @@ module Shipit
27
27
  origin = ORIGIN
28
28
  message = opt.fetch(:message, "").gsub("`", "'")
29
29
  dry_run = opt.fetch(:dry_run, false)
30
+ ship_skips_ci = "-o ci.skip " if Shipit::Cli.config.ship_skips_ci.to_s.downcase == "true"
30
31
  grepped_protected_branches = Array(Shipit::Cli.config.protected_branches)
31
32
  .push("master")
33
+ .push("main")
32
34
  .push("develop")
33
35
  .push(get_current_branch)
34
36
  .uniq.map{ |b| "| grep -v #{b} " }.join
@@ -1,5 +1,5 @@
1
1
  module Shipit
2
2
  module Cli
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "1.3.0".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require "active_support/all"
2
+ require "git_clone_url"
2
3
 
3
4
  module Shipit
4
5
  module Cli
@@ -124,18 +125,23 @@ module Shipit
124
125
 
125
126
  # @return [String]
126
127
  def project_name
127
- @project_name ||= project_git_url.split("/").last.gsub(".git", "")
128
+ @project_name ||= project_path_array.last.gsub(".git", "")
128
129
  end
129
130
 
130
131
  # @return [String]
131
132
  def project_namespace
132
- @project_namespace ||= project_git_url.split(":").last.split("/").first
133
+ @project_namespace ||= project_path_array.first(project_path_array.size - 1)
133
134
  end
134
135
 
135
136
  # @return [String]
136
137
  def project_path
137
138
  @project_path ||= [project_namespace, project_name].join("/")
138
139
  end
140
+
141
+ # @return [Array]
142
+ def project_path_array
143
+ @project_path_array ||= GitCloneUrl.parse(project_git_url).path.split("/").reject(&:blank?)
144
+ end
139
145
  end
140
146
  end
141
147
  end
data/shipit-cli.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "activesupport"
23
23
  spec.add_dependency "gli", "~> 2.13"
24
24
  spec.add_dependency "gitlab", "~> 4.3.0"
25
+ spec.add_dependency "git_clone_url", "~> 2.0.0"
25
26
 
26
27
  spec.add_development_dependency "bundler", "~> 2.0"
27
28
  spec.add_development_dependency "guard"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intello-shipit-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Thouret
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: git_clone_url
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement