gitlab-fastlane 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 39e26903f5b2b921f37fc29efc74def0ef6f86192c30295322db99363b96398f
4
+ data.tar.gz: 65c3df9b026d81b14370192128659a1645c98b2ecf6ec5e0007dfde10639205e
5
+ SHA512:
6
+ metadata.gz: 3e012d8b52275993f61c8747048fe730d55370cf8956e383c147d3b0fe8f4fe75fa019d2978fa7b506799b1af13c150d16f9e83641433357d44d28f47084697e
7
+ data.tar.gz: 54a0c83df82f4129fd5efcc54b126a25a14e45d6fd453c6aae378cdb5928cbe027619c61dfdd7f20f27d6e04b074328dda57b149617230100c030fdeaa3d78f9
data/.commitlintrc.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ "header-case": [1, 'always', 'sentence-case'],
5
+ "subject-empty": [2, 'always'],
6
+ "type-empty": [0, 'always'],
7
+ "header-max-length": [2, 'always', 50],
8
+ "body-max-line-length": [2, 'always', 120],
9
+ },
10
+ };
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.4
7
+ NewCops: enable
8
+ SuggestExtensions: false
9
+
10
+ Style/StringLiterals:
11
+ Enabled: true
12
+ EnforcedStyle: double_quotes
13
+
14
+ Style/StringLiteralsInInterpolation:
15
+ Enabled: true
16
+ EnforcedStyle: double_quotes
17
+
18
+ Layout/LineLength:
19
+ Max: 120
20
+
21
+ Metrics/MethodLength:
22
+ Max: 15
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Revision history for gitlab-fastlane
2
+
3
+ The version numbers below try to follow the conventions at http://semver.org/.
4
+
5
+ Please add new changes under the **Unreleased** section as list items from the newest on top to the oldest.
6
+
7
+ ## Unreleased
8
+
9
+ * Add deploy step to CI
10
+ * Add local pipeline execution with gitlab-ci-local
11
+ * Add git status check feature
12
+ * Add commit-linting to CI pipeline
13
+ * Add bundler-audit security check to CI pipeline
14
+ * Add SimpleCov for test coverage reporting
15
+ * Add gem build step to CI pipeline
16
+ * Update CI to use Ruby 3.4.6
17
+ * Configure custom GitLab CI pipeline
18
+ * Create CLI entry point with basic commands
19
+ * Set up RuboCop for linting
20
+ * Set up RSpec for testing
21
+ * Configure gemspec with project metadata and URLs
22
+ * Initialize Ruby gem structure with bundler
23
+ * Update README and HACKING with gem information
24
+ * Add documentation files
25
+ * Update README with project description
26
+ * Add Issue template
27
+ * Add Merge Request template
28
+ * Configure SAST and Secret Detection in `.gitlab-ci.yml`
29
+ * Create project
data/CONTRIBUTING.md ADDED
File without changes
data/COPYING.md ADDED
@@ -0,0 +1 @@
1
+ All rights reserved to Irya Solutions.
data/DEPLOYING.md ADDED
File without changes
File without changes
data/HACKING.md ADDED
@@ -0,0 +1,90 @@
1
+ # HACKING
2
+
3
+ Here you will find relevant information for developers working in this project.
4
+
5
+ ## Dependencies
6
+
7
+ This is a Ruby gem. You'll need:
8
+ - Ruby 3.4.6 or higher
9
+ - Bundler
10
+ - gitlab-ci-local (for running CI locally): `npm install -g gitlab-ci-local`
11
+
12
+ To install dependencies:
13
+
14
+ ```bash
15
+ bundle install
16
+ ```
17
+
18
+ ## Development Setup
19
+
20
+ After checking out the repo, run:
21
+
22
+ ```bash
23
+ bin/setup
24
+ ```
25
+
26
+ This will install dependencies. You can run `bin/console` for an interactive prompt to experiment.
27
+
28
+ To install this gem locally:
29
+
30
+ ```bash
31
+ bundle exec rake install
32
+ ```
33
+
34
+ ## Project Structure
35
+
36
+ - `lib/gitlab/fastlane.rb` - Main library code
37
+ - `lib/gitlab/fastlane/cli.rb` - CLI command handling
38
+ - `lib/gitlab/fastlane/version.rb` - Version management
39
+ - `exe/` - Executable scripts (CLI entry point)
40
+ - `bin/` - Development helper scripts
41
+
42
+ ## Testing the CLI
43
+
44
+ After installing locally, you can test the CLI:
45
+
46
+ ```bash
47
+ bundle exec exe/gitlab-fastlane help
48
+ bundle exec exe/gitlab-fastlane version
49
+ ```
50
+
51
+ ## Linting
52
+
53
+ Run RuboCop to check code style:
54
+
55
+ ```bash
56
+ bundle exec rubocop
57
+ ```
58
+
59
+ Auto-fix issues:
60
+
61
+ ```bash
62
+ bundle exec rubocop -a
63
+ ```
64
+
65
+ ## Security Audits
66
+
67
+ Check for vulnerable dependencies:
68
+
69
+ ```bash
70
+ gem install bundler-audit
71
+ bundle audit --update
72
+ ```
73
+
74
+ ## Automated tests
75
+
76
+ Run RSpec tests:
77
+
78
+ ```bash
79
+ bundle exec rspec
80
+ ```
81
+
82
+ Run both linting and tests:
83
+
84
+ ```bash
85
+ bundle exec rake
86
+ ```
87
+
88
+ ## Known issues
89
+
90
+ None so far :)
data/MAINTENANCE.md ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Gitlab Fastlane
2
+
3
+ Gitlab Fastlane is a Ruby gem that allows developers to run GitLab CI pipelines locally before opening merge requests. This tool helps ensure that CI checks pass before creating merge requests by running the pipeline locally, checking for uncommitted changes, and tagging commits with validation markers.
4
+
5
+ ## Installation
6
+
7
+ Install the gem by executing:
8
+
9
+ ```bash
10
+ gem install gitlab-fastlane
11
+ ```
12
+
13
+ Or add it to your Gemfile:
14
+
15
+ ```ruby
16
+ gem 'gitlab-fastlane'
17
+ ```
18
+
19
+ ### Prerequisites
20
+
21
+ This gem requires `gitlab-ci-local` to run pipelines locally. Install it using npm:
22
+
23
+ ```bash
24
+ npm install -g gitlab-ci-local
25
+ ```
26
+
27
+ For alternative installation methods, visit: https://github.com/firecow/gitlab-ci-local
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ gitlab-fastlane run
33
+ ```
34
+
35
+ This will:
36
+ 1. Check for unstaged/untracked/uncommited files and warn if found
37
+ 2. Run your GitLab CI pipeline locally using gitlab-ci-local
38
+ 3. Amend the most recent commit with a validation tag
39
+
40
+ ## Technical aspects
41
+
42
+ * On how to get started developing, check the [HACKING](HACKING.md) file
43
+ * On what are the code standards, check the [CONTRIBUTING](CONTRIBUTING.md) file
44
+ * On how to install, check the [DEPLOYING](DEPLOYING.md) file
45
+ * On how to keep the application up and running, check the [MAINTENANCE](MAINTENANCE.md) file
46
+ * On how to recover from disasters, check the [DISASTER_RECOVERY](DISASTER_RECOVERY.md) file
47
+
48
+ ## License
49
+
50
+ [Copyright - All rights reserved to Irya Solutions](COPYING.md)
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
9
+
10
+ task default: %i[rubocop spec]
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "gitlab/fastlane"
5
+
6
+ Gitlab::Fastlane::CLI.start(ARGV)
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module Fastlane
5
+ # Command-line interface for gitlab-fastlane
6
+ class CLI
7
+ def self.start(args)
8
+ command = args.first || "help"
9
+
10
+ case command
11
+ when "run"
12
+ run_command
13
+ when "version", "-v", "--version"
14
+ version_command
15
+ when "help", "-h", "--help"
16
+ show_help
17
+ else
18
+ unknown_command(command)
19
+ end
20
+ end
21
+
22
+ def self.run_command
23
+ return unless git_status_clean?
24
+
25
+ unless gitlab_ci_local_installed?
26
+ puts "Error: gitlab-ci-local is not installed."
27
+ puts "Install it with: npm install -g gitlab-ci-local"
28
+ puts "Or visit: https://github.com/firecow/gitlab-ci-local"
29
+ return
30
+ end
31
+
32
+ puts "Running GitLab CI locally..."
33
+ success = system("gitlab-ci-local")
34
+
35
+ return if success
36
+
37
+ puts "\nPipeline failed. Fix the issues and try again."
38
+ exit 1
39
+ end
40
+
41
+ def self.gitlab_ci_local_installed?
42
+ !`which gitlab-ci-local 2>/dev/null`.strip.empty?
43
+ end
44
+
45
+ def self.git_status_clean?
46
+ status = `git status --porcelain`.strip
47
+
48
+ return true if status.empty?
49
+
50
+ puts "Warning: You have unstaged/untracked changes:"
51
+ puts status
52
+ puts "\nDo you want to continue? (y/N)"
53
+
54
+ response = $stdin.gets.chomp.downcase
55
+ response == "y"
56
+ end
57
+
58
+ def self.version_command
59
+ puts "gitlab-fastlane #{VERSION}"
60
+ end
61
+
62
+ def self.unknown_command(command)
63
+ puts "Unknown command: #{command}"
64
+ show_help
65
+ end
66
+
67
+ def self.show_help
68
+ puts <<~HELP
69
+ gitlab-fastlane - Run GitLab CI pipelines locally
70
+
71
+ Usage:
72
+ gitlab-fastlane run Run CI pipeline locally
73
+ gitlab-fastlane version Show version
74
+ gitlab-fastlane help Show this help
75
+
76
+ Options:
77
+ -h, --help Show this help
78
+ -v, --version Show version
79
+ HELP
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module Fastlane
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "fastlane/version"
4
+ require_relative "fastlane/cli"
5
+
6
+ module Gitlab
7
+ module Fastlane
8
+ class Error < StandardError; end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitlab-fastlane
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Lira
8
+ - Rafael Manzo
9
+ - Diego Camarinha
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Gitlab Fastlane allows developers to run GitLab CI pipelines locally,
15
+ check for uncommitted changes, and tag commits with validation markers to ensure
16
+ CI passes before creating merge requests.
17
+ email:
18
+ - contato@iryasolutions.com.br
19
+ executables:
20
+ - gitlab-fastlane
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - ".commitlintrc.js"
25
+ - ".rspec"
26
+ - ".rubocop.yml"
27
+ - ".ruby-version"
28
+ - CHANGELOG.md
29
+ - CONTRIBUTING.md
30
+ - COPYING.md
31
+ - DEPLOYING.md
32
+ - DISASTER_RECOVERY.md
33
+ - HACKING.md
34
+ - MAINTENANCE.md
35
+ - README.md
36
+ - Rakefile
37
+ - exe/gitlab-fastlane
38
+ - lib/gitlab/fastlane.rb
39
+ - lib/gitlab/fastlane/cli.rb
40
+ - lib/gitlab/fastlane/version.rb
41
+ homepage: https://git.pragmacode.com.br/irya-solutions-open/gitlab-fastlane
42
+ licenses:
43
+ - LGPL-3.0-or-later
44
+ metadata:
45
+ source_code_uri: https://git.pragmacode.com.br/irya-solutions-open/gitlab-fastlane
46
+ changelog_uri: https://git.pragmacode.com.br/irya-solutions-open/gitlab-fastlane/-/blob/main/CHANGELOG.md
47
+ rubygems_mfa_required: 'true'
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.4.6
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.6.9
63
+ specification_version: 4
64
+ summary: Run GitLab CI pipelines locally before opening merge requests
65
+ test_files: []