dod 0.1.0 → 0.1.1
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 +4 -4
- data/lib/dod.rb +1 -1
- data/lib/dod/client/bitbucket_server_api.rb +2 -2
- data/lib/dod/commands/runner.rb +9 -5
- data/lib/dod/helpers/repository.rb +16 -0
- data/lib/dod/version.rb +1 -1
- metadata +2 -2
- data/lib/dod/helpers/git_helper.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16787ca2162037f8a1545d1c409e21670d3c2424
|
4
|
+
data.tar.gz: a8214f700b6e9f8b5364445f1bcd193e6446c64b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f7469a05b199594d00ebc9752860e7476c378e1cd8c4f4bd60f00d636a7b8d60e26559b53b68bc948d7edf8ecaa54072fed12415959dc730b4d6b7abda4fea
|
7
|
+
data.tar.gz: 9593165d2566963de8c3f44eeb17d7faca5ddc2bcb850ad200fc53ebdabe9ea217e601e5d56995b97e214912a7fc463582ddd9b5c14e0cf077811de8440b21f5
|
data/lib/dod.rb
CHANGED
@@ -5,8 +5,8 @@ module Dod
|
|
5
5
|
attr_accessor :endpoint, :pull_request_id
|
6
6
|
|
7
7
|
def initialize(environment, project, repo, branch)
|
8
|
-
@username = environment["
|
9
|
-
@password = environment["
|
8
|
+
@username = environment["bamboo_BITBUCKET_USERNAME"]
|
9
|
+
@password = environment["bamboo_BITBUCKET_PASSWORD"]
|
10
10
|
|
11
11
|
self.endpoint = "https://stash.allegrogroup.com/rest/api/1.0/projects/#{project}/repos/#{repo}"
|
12
12
|
self.pull_request_id = get_pull_request_id(branch)
|
data/lib/dod/commands/runner.rb
CHANGED
@@ -11,7 +11,7 @@ module Dod
|
|
11
11
|
def initialize(argv)
|
12
12
|
donefile = argv.option("donefile", "Donefile")
|
13
13
|
@donefile_path = donefile if File.exist?(donefile)
|
14
|
-
@
|
14
|
+
@repository = Repository.new
|
15
15
|
@donefile = Donefile.new
|
16
16
|
super
|
17
17
|
end
|
@@ -21,9 +21,6 @@ module Dod
|
|
21
21
|
if self.class == Runner && !@donefile_path
|
22
22
|
help!("Could not find a Donefile.")
|
23
23
|
end
|
24
|
-
if not File.directory?(".git")
|
25
|
-
help!("Not a git repository.")
|
26
|
-
end
|
27
24
|
end
|
28
25
|
|
29
26
|
def self.options
|
@@ -34,7 +31,14 @@ module Dod
|
|
34
31
|
|
35
32
|
def run
|
36
33
|
tasks = @donefile.parse_tasks(@donefile_path)
|
37
|
-
|
34
|
+
project_name = @repository.project_name(ENV)
|
35
|
+
repo_name = @repository.repo_name(ENV)
|
36
|
+
current_branch = environment["bamboo_repository_git_branch"]
|
37
|
+
unless project_name && repo_name && current_branch
|
38
|
+
puts "Lack of definition of one of the environment variable (bamboo_repository_git_branch, bamboo_planRepository_repositoryUrl or bamboo_planRepository_repositoryUrl).".red
|
39
|
+
return
|
40
|
+
end
|
41
|
+
bitbucket = BitbucketServerAPI.new(ENV, project_name, repo_name, current_branch)
|
38
42
|
bitbucket.create_definition_of_done(tasks)
|
39
43
|
end
|
40
44
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dod
|
2
|
+
class Repository
|
3
|
+
|
4
|
+
def repo_name(environment)
|
5
|
+
repo_url = environment["bamboo_planRepository_repositoryUrl"]
|
6
|
+
url_components = URI.parse(repo_url)
|
7
|
+
url_components.path.split('/')[2].split('.').first
|
8
|
+
end
|
9
|
+
|
10
|
+
def project_name(environment)
|
11
|
+
repo_url = environment["bamboo_planRepository_repositoryUrl"]
|
12
|
+
url_components = URI.parse(repo_url)
|
13
|
+
url_components.path.split('/')[1].upcase
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/dod/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksander Grzyb
|
@@ -93,7 +93,7 @@ files:
|
|
93
93
|
- lib/dod/client/bitbucket_server_api.rb
|
94
94
|
- lib/dod/commands/runner.rb
|
95
95
|
- lib/dod/dod_core/donefile.rb
|
96
|
-
- lib/dod/helpers/
|
96
|
+
- lib/dod/helpers/repository.rb
|
97
97
|
- lib/dod/version.rb
|
98
98
|
homepage:
|
99
99
|
licenses:
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'git'
|
2
|
-
|
3
|
-
module Dod
|
4
|
-
class GitHelper
|
5
|
-
|
6
|
-
attr_accessor :g
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@g = Git.open(".")
|
10
|
-
end
|
11
|
-
|
12
|
-
def current_branch
|
13
|
-
g.current_branch
|
14
|
-
end
|
15
|
-
|
16
|
-
def repo_name
|
17
|
-
url_components = URI.parse(g.remote('origin').url)
|
18
|
-
url_components.path.split('/')[3].split('.').first
|
19
|
-
end
|
20
|
-
|
21
|
-
def project_name
|
22
|
-
url_components = URI.parse(g.remote('origin').url)
|
23
|
-
url_components.path.split('/')[2].upcase
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|