capistrano-redmine-deployment 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c60ab7f09f79a4d3b3e90a9bf6edb0da4dc66129392dd09971a2883de1413515
4
+ data.tar.gz: a49b08f33c15eb4f9491c65501a85b26a33eb20c89fde872f463a29d70b56a0f
5
+ SHA512:
6
+ metadata.gz: 2cc8663317d582086c96f39be819bbd203fd118e58e5428ec9dcdfd1dcebaec273c9c4eb4ee21cdb70f370e2acf5715052a43ae6a15eacb72900f768b040a196
7
+ data.tar.gz: 195c99e17cb7ebfee2d15f6d4db30f2d33003d36b4accafc7d1ddb9c504e17fb7f4abe711ec8fb08dee856a012a17387eba049fdf9699eb5130ec1f86f100a44
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ # defaults
2
+ /.bundle/
3
+ /tmp/
4
+ Gemfile.lock
5
+
6
+ # testing
7
+ .rspec_status
8
+ /spec/reports/
9
+
10
+ # documentation & coverage
11
+ /.yardoc
12
+ /_yardoc/
13
+ /coverage/
14
+ /doc/
15
+ /docs/yard
16
+ /.coveralls.yml
17
+
18
+ # builds
19
+ /pkg/
20
+ /*.gem
21
+
22
+ # IDE related files
23
+ /.idea
24
+ /.ruby-version
25
+ /.bundle-version
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ruby_smart-support.gemspec
6
+ gemspec
7
+
8
+ gem "rake"
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Capistrano::Redmine::Deployment
2
+
3
+ [![GitHub](https://img.shields.io/badge/github-ruby--smart/capistrano-redmine-deployment-blue.svg)](http://github.com/ruby-smart/capistrano-redmine-deployment)
4
+ [![Documentation](https://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.info/gems/capistrano-redmine-deployment)
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/capistrano-redmine-deployment.svg?kill_cache=1)](https://badge.fury.io/rb/capistrano-redmine-deployment)
7
+ [![License](https://img.shields.io/github/license/ruby-smart/capistrano-redmine-deployment)](docs/LICENSE.txt)
8
+
9
+ Redmine Deployment Tracking (for redmine_deployment plugin)
10
+
11
+ _capistrano-redmine-deployment_ is a capistrano task to log deployments to any related redmine repository.
12
+ The plugin 'redmine_deployment' is required.
13
+
14
+ -----
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'capistrano-redmine-deployment'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle install
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install capistrano-redmine-deployment
31
+
32
+ Configure redmine credentials within your `config/deploy.rb`.
33
+ ```ruby
34
+ # redmine deployment credentials (without api_key)
35
+ set(:redmine_host, "https://your-redmine-host")
36
+ set(:redmine_project, "target-redmine-project-identifier")
37
+ set(:redmine_repository, "target-redmine-repository-identifier")
38
+ ```
39
+
40
+ Setup redmine API-KEY through rake-task:
41
+
42
+ $ rake capistrano:redmine:deploy:setup
43
+
44
+
45
+ Require deployment tasks within your `Capfile`
46
+
47
+ require 'capistrano/redmine/deployment/receipts'
48
+
49
+ ## Redmine requirements
50
+
51
+ Install the plugin `redmine_deployment`.
52
+
53
+ ## Features
54
+ * logs (success/failed) deployment to associated redmine repository
55
+
56
+ -----
57
+
58
+ ## Docs
59
+
60
+ [CHANGELOG](docs/CHANGELOG.md)
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/ruby-smart/support).
65
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](docs/CODE_OF_CONDUCT.md).
66
+
67
+ ## License
68
+
69
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
70
+
71
+ A copy of the [LICENSE](docs/LICENSE.md) can be found @ the docs.
72
+
73
+ ## Code of Conduct
74
+
75
+ Everyone interacting in the project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [CODE OF CONDUCT](docs/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "capistrano-redmine-deployment"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/capistrano/redmine/deployment/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'capistrano-redmine-deployment'
7
+ spec.version = Capistrano::Redmine::Deployment.version
8
+ spec.authors = ['Tobias Gonsior']
9
+ spec.email = ['info@ruby-smart.org']
10
+ spec.summary = 'Redmine Deployment Tracking (for redmine_deployment plugin)'
11
+ spec.description = <<~DESC
12
+ 'capistrano-redmine-deployment' is a capistrano task to log deployments to any related redmine repository.
13
+ The plugin 'redmine_deployment' is required.
14
+ DESC
15
+
16
+ spec.homepage = 'https://github.com/ruby-smart/capistrano-redmine-deployment'
17
+ spec.license = 'MIT'
18
+ spec.required_ruby_version = '>= 2.6.0'
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = 'https://github.com/ruby-smart/capistrano-redmine-deployment'
22
+ spec.metadata['documentation_uri'] = 'https://rubydoc.info/gems/capistrano-redmine-deployment'
23
+ spec.metadata['changelog_uri'] = "#{spec.metadata["source_code_uri"]}/blob/main/docs/CHANGELOG.md"
24
+
25
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
31
+ end
32
+
33
+ spec.require_paths = ['lib']
34
+ end
data/docs/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Capistrano::Redmine::Deployment - CHANGELOG
2
+
3
+ ## [1.0.0] - 2024-10-01
4
+ * **[add]** config, client & receipts
5
+ * **[add]** rake task for setup
6
+ * **[add]** railties setup task
7
+ * **[fix]** deployment bugs
8
+
9
+ ## [0.1.0] - 2024-09-29
10
+ * Initial commit
11
+ * docs, version, structure
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at tg@reimbursement.institute. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/docs/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Ruby Smart
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module Capistrano
7
+ module Redmine
8
+ module Deployment
9
+ class Client
10
+
11
+ attr_reader :config
12
+
13
+ class << self
14
+ def deploy_success!(config, deployment)
15
+ deployment[:result] = 'success'
16
+
17
+ new(config).deploy!(deployment)
18
+ end
19
+
20
+ def deploy_fail!(config, deployment)
21
+ deployment[:result] = 'fail'
22
+
23
+ new(config).deploy!(deployment)
24
+ end
25
+ end
26
+
27
+ def initialize(config, logging: true)
28
+ @config = config
29
+ @logging = logging
30
+ end
31
+
32
+ def silent!
33
+ @logging = false
34
+ end
35
+
36
+ def log?
37
+ @logging
38
+ end
39
+
40
+ def deploy!(deployment)
41
+ log_deploy(deployment) if log?
42
+
43
+ response = send_deployment(deployment)
44
+
45
+ if response['deployment']
46
+ log_deploy_done(response) if log?
47
+
48
+ true
49
+ else
50
+ log_deploy_errors(response) if log?
51
+
52
+ false
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def send_deployment(deployment)
59
+ uri = URI("#{config.host}/projects/#{config.project}/deploy/#{config.repository}.json")
60
+
61
+ http = Net::HTTP.new(uri.host, uri.port)
62
+ http.use_ssl = true if uri.port == 443
63
+
64
+ request = Net::HTTP::Post.new(uri.request_uri)
65
+ request["Content-Type"] = "application/json"
66
+ request['X-Redmine-API-Key'] = config.api_key
67
+ request.body = { deployment: deployment }.to_json
68
+
69
+ response = http.request(request)
70
+
71
+ begin
72
+ JSON.parse(response.body)
73
+ rescue JSON::ParserError
74
+ response.body
75
+ end
76
+ end
77
+
78
+ def log_deploy(deployment)
79
+ puts "Sending deployment information to #{config.host} (project: '#{config.project}' | repo: '#{config.repository}')"
80
+
81
+ puts " Commits......: #{deployment[:from_revision]} ... #{deployment[:to_revision]}"
82
+ puts " Environment..: #{deployment[:environment] || '-'}"
83
+ puts " Branch.......: #{deployment[:branch] || '-'}"
84
+ puts " Server(s)....: #{deployment[:servers]}"
85
+ puts " Result.......: #{deployment[:result]}"
86
+ end
87
+
88
+ def log_deploy_done(response)
89
+ puts "\e[32mSuccessfully created deployment ##{response['deployment']['id']}\e[0m"
90
+ end
91
+
92
+ def log_deploy_errors(response)
93
+ if response['errors']
94
+ puts "\e[31mFailed to created deployment: #{response['errors'].join(', ')}\e[0m"
95
+ else
96
+ puts "\e[31mFailed to created deployment: #{response.inspect}\e[0m"
97
+ end
98
+
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module Capistrano
6
+ module Redmine
7
+ module Deployment
8
+ class Config
9
+
10
+ attr_reader :file
11
+
12
+ class << self
13
+ def resolve(capistrano: nil, file: nil)
14
+ # build new empty config
15
+ config = new
16
+
17
+ # try to resolve from capistrano
18
+ config.assign!(config_from_capistrano(capistrano)) if capistrano
19
+
20
+ # try to resolve from current PWD
21
+ config.assign!(config_from_file(File.join(Dir.pwd, '.redmine')))
22
+ config.assign!(config_from_file(File.join(ENV['HOME'], '.redmine')))
23
+ config.assign!(config_from_file(file)) if file
24
+
25
+ config
26
+ end
27
+
28
+ def config_from_capistrano(capistrano)
29
+ config = {
30
+ host: capistrano.fetch(:redmine_host),
31
+ project: capistrano.fetch(:redmine_project) || capistrano.fetch(:redmine_project_id),
32
+ repository: capistrano.fetch(:redmine_repository)
33
+ }
34
+
35
+ new(config)
36
+ end
37
+
38
+ def config_from_file(file)
39
+ new(file: file)
40
+ end
41
+ end
42
+
43
+ def initialize(config = {}, file: nil)
44
+ @config = config
45
+ @file = file
46
+ load
47
+ end
48
+
49
+ def set(key, value)
50
+ if value && value != ''
51
+ @config[key.to_sym] = value
52
+ else
53
+ @config.delete(key.to_sym)
54
+ end
55
+ end
56
+
57
+ def get(key)
58
+ @config[key.to_sym]
59
+ end
60
+
61
+ def to_h
62
+ @config
63
+ end
64
+
65
+ def assign!(other)
66
+ return unless other
67
+
68
+ other.to_h.each do |key, value|
69
+ next if !value || value == ''
70
+
71
+ set(key, value)
72
+ end
73
+ end
74
+
75
+ def valid?
76
+ %i[host project repository api_key].all? { |key|
77
+ val = get(key)
78
+ val && val != ''
79
+ }
80
+ end
81
+
82
+ def method_missing(name)
83
+ get(name)
84
+ end
85
+
86
+ def save
87
+ return false unless @file
88
+
89
+ File.open(@file, 'w') { |f| f.write(YAML.dump(@config)) } rescue false
90
+ end
91
+
92
+ def load
93
+ if @file && File.exist?(@file)
94
+ @config = YAML.load_file(@file)
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+
102
+
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capistrano
4
+ module Redmine
5
+ module Deployment
6
+ # Returns the version of the currently loaded module as a <tt>Gem::Version</tt>
7
+ def self.gem_version
8
+ Gem::Version.new VERSION::STRING
9
+ end
10
+
11
+ module VERSION
12
+ MAJOR = 1
13
+ MINOR = 0
14
+ TINY = 0
15
+ PRE = nil
16
+
17
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
18
+
19
+ def self.to_s
20
+ STRING
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails'
4
+
5
+ module Capistrano
6
+ module Redmine
7
+ module Deployment
8
+ class Railtie < Rails::Railtie
9
+ railtie_name 'capistrano-redmine-deployment'
10
+
11
+ rake_tasks do
12
+ path = File.expand_path(__dir__)
13
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+
@@ -0,0 +1,74 @@
1
+ require 'capistrano/redmine/deployment/config'
2
+ require 'capistrano/redmine/deployment/client'
3
+
4
+ after 'deploy:cleanup', 'redmine:log_success_deployment'
5
+ after 'deploy:failed', 'redmine:log_fail_deployment'
6
+
7
+ namespace :redmine do
8
+ desc "Logs the success deployment of your redmine repository"
9
+ task :log_success_deployment do
10
+ run_locally do
11
+ # resolve redmine config
12
+ config = Capistrano::Redmine::Deployment::Config.resolve(capistrano: self)
13
+
14
+ unless config.valid?
15
+ puts "\e[31m Seems like your redmine configuration is missing or unfinished.\n Run rake task 'rake capistrano:redmine:deployment:setup' to start.\n Skipping redmine deployment.\e[0m"
16
+ next
17
+ end
18
+
19
+ # resolve configs
20
+ previous_revision = fetch(:previous_revision)
21
+ current_revision = fetch(:current_revision)
22
+ environment = fetch(:stage) || fetch(:environment)
23
+ branch = fetch(:branch) || 'main'
24
+ roles = roles(:all)
25
+
26
+ if previous_revision == current_revision
27
+ puts "\e[31m Seems like your old revision & new revision are the same. Skipping redmine deployment.\e[0m"
28
+ next
29
+ end
30
+
31
+ # create new deployment hash
32
+ deployment = {
33
+ branch: branch,
34
+ environment: environment,
35
+ servers: (roles.map { |r| r.hostname }.uniq.join(',') rescue ''),
36
+ from_revision: previous_revision,
37
+ to_revision: current_revision
38
+ }
39
+
40
+ Capistrano::Redmine::Deployment::Client.deploy_success!(config, deployment)
41
+ end
42
+ end
43
+
44
+ desc "Logs the fail deployment of your redmine repository"
45
+ task :log_fail_deployment do
46
+ run_locally do
47
+ # resolve redmine config
48
+ config = Capistrano::Redmine::Deployment::Config.resolve(capistrano: self)
49
+
50
+ unless config.valid?
51
+ puts "\e[31m Seems like your redmine configuration is missing or unfinished.\n Run rake task 'rake capistrano:redmine:deployment:setup' to start.\n Skipping redmine deployment.\e[0m"
52
+ next
53
+ end
54
+
55
+ # resolve configs
56
+ previous_revision = fetch(:previous_revision)
57
+ current_revision = fetch(:current_revision)
58
+ environment = fetch(:stage) || fetch(:environment)
59
+ branch = fetch(:branch) || 'main'
60
+ roles = roles(:all)
61
+
62
+ # create new deployment hash
63
+ deployment = {
64
+ branch: branch,
65
+ environment: environment,
66
+ servers: (roles.map { |r| r.hostname }.uniq.join(',') rescue ''),
67
+ from_revision: previous_revision,
68
+ to_revision: current_revision
69
+ }
70
+
71
+ Capistrano::Redmine::Deployment::Client.deploy_fail!(config, deployment)
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,52 @@
1
+ namespace :capistrano do
2
+ namespace :redmine do
3
+ namespace :deployment do
4
+ desc <<-END_DESC
5
+ Configure the redmine credentials for deployment.
6
+ END_DESC
7
+
8
+ task :setup do
9
+ require 'capistrano/redmine/deployment/config'
10
+
11
+ puts "******************************************************************************************************"
12
+ puts "== Capistrano::Redmine::Deployment - setup =="
13
+ puts "******************************************************************************************************"
14
+ puts ""
15
+ puts " This task creates a '.redmine' file in your current application folder (pwd)."
16
+ puts " This file must NOT be exposed and should be EXCLUDED by your scm."
17
+ puts " Define application-related settings within your 'config/deploy.rb' (e.g. host, project, repository)."
18
+ puts " Define authentication-related settings with this task (e.g. api_key)."
19
+ puts ""
20
+ puts "******************************************************************************************************"
21
+ print "REDMINE API-KEY (required) > "
22
+ redmine_api_key = STDIN.gets.strip
23
+ print "REDMINE HOST (optional) > "
24
+ redmine_host = STDIN.gets.strip
25
+ print "REDMINE PROJECT (optional) > "
26
+ redmine_project = STDIN.gets.strip
27
+ print "REDMINE REPOSITORY (optional) > "
28
+ redmine_repository = STDIN.gets.strip
29
+ puts ""
30
+
31
+ # build config
32
+ config = Capistrano::Redmine::Deployment::Config.config_from_file(File.join(Dir.pwd, '.redmine'))
33
+
34
+ # force set to overwrite possible existing keys
35
+ config.set(:api_key, redmine_api_key)
36
+ config.set(:host, redmine_host)
37
+ config.set(:project, redmine_project)
38
+ config.set(:repository, redmine_repository)
39
+
40
+ if config.save
41
+ puts "Successfully stored config @ #{config.file}"
42
+ else
43
+ puts "FAILED to store config @ #{config.file}"
44
+ end
45
+
46
+ puts ""
47
+ puts "******************************************************************************************************"
48
+ puts ""
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'gem_version'
4
+
5
+ module Capistrano
6
+ module Redmine
7
+ module Deployment
8
+ # Returns the version of the currently loaded Gem as a <tt>Gem::Version</tt>
9
+ def self.version
10
+ gem_version
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'capistrano/redmine/deployment/version'
4
+ require_relative 'capistrano/redmine/deployment/config'
5
+ require_relative 'capistrano/redmine/deployment/client'
6
+ require_relative 'capistrano/redmine/deployment/railtie' if defined?(Rails)
7
+
8
+ module Capistrano
9
+ module Redmine
10
+ module Deployment
11
+
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-redmine-deployment
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Tobias Gonsior
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ 'capistrano-redmine-deployment' is a capistrano task to log deployments to any related redmine repository.
15
+ The plugin 'redmine_deployment' is required.
16
+ email:
17
+ - info@ruby-smart.org
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - Gemfile
24
+ - README.md
25
+ - Rakefile
26
+ - bin/console
27
+ - bin/setup
28
+ - capistrano-redmine-deployment.gemspec
29
+ - docs/CHANGELOG.md
30
+ - docs/CODE_OF_CONDUCT.md
31
+ - docs/LICENSE.md
32
+ - lib/capistrano-redmine-deployment.rb
33
+ - lib/capistrano/redmine/deployment/client.rb
34
+ - lib/capistrano/redmine/deployment/config.rb
35
+ - lib/capistrano/redmine/deployment/gem_version.rb
36
+ - lib/capistrano/redmine/deployment/railtie.rb
37
+ - lib/capistrano/redmine/deployment/receipts.rb
38
+ - lib/capistrano/redmine/deployment/tasks/setup.rake
39
+ - lib/capistrano/redmine/deployment/version.rb
40
+ homepage: https://github.com/ruby-smart/capistrano-redmine-deployment
41
+ licenses:
42
+ - MIT
43
+ metadata:
44
+ homepage_uri: https://github.com/ruby-smart/capistrano-redmine-deployment
45
+ source_code_uri: https://github.com/ruby-smart/capistrano-redmine-deployment
46
+ documentation_uri: https://rubydoc.info/gems/capistrano-redmine-deployment
47
+ changelog_uri: https://github.com/ruby-smart/capistrano-redmine-deployment/blob/main/docs/CHANGELOG.md
48
+ allowed_push_host: https://rubygems.org
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 2.6.0
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.3.22
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Redmine Deployment Tracking (for redmine_deployment plugin)
68
+ test_files: []