gitlab_mr_release 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cbe2782d585b794c4e2ea0a87da996aac34fbd1
4
- data.tar.gz: 1374b025de7ad9d41e78472f380b44ee5438bb91
3
+ metadata.gz: 61e097e8b3a6fa3ce74183de3146060ca452dc4d
4
+ data.tar.gz: b773591304833694146b9e60de9a09ad37eb19be
5
5
  SHA512:
6
- metadata.gz: 292c41f99f975800922865faa983392c0dc1f9c598fa969c8441d473254f598416fb3872253e7818edb825098b7e513ef92693a49b7e15b215d70403752e5c6a
7
- data.tar.gz: a54327168775aaf3e955686a38d3cb22f32917a18de1c3dd4272590bdece5a20d5e285d2a1e10601dcb5d49e2875e538170018887697f0393bcc90b81999616c
6
+ metadata.gz: 813dcb7a7f0cfc50f5df943e98eb46c5046f41f4ef89fe0f5fa361a24e831e33397f204b1b65831547fc9bc65a2fb37740b0b55c804102df07d77d1c765cd868
7
+ data.tar.gz: 50512479fd6a58bf347b3924241d1b9803af96fb3d50fc95ffa0613161130c27b4863c5129e31fe39e73455e87df0fc5c60f8b10277043177eaad1fdc88a8598
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/rubicure/compare/v0.1.1...master)
2
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.2.0...master)
3
+
4
+ ## v0.2.0
5
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.1.1...v0.2.0)
6
+
7
+ * Support `DEFAULT_TITLE` with erb
8
+ * https://github.com/sue445/gitlab_mr_release/pull/11
3
9
 
4
10
  ## v0.1.1
5
11
  [full changelog](http://github.com/sue445/rubicure/compare/v0.1.0...v0.1.1)
data/README.md CHANGED
@@ -76,6 +76,7 @@ Environment variables read from `~/.env.gitlab` and current `.env.gitlab`
76
76
  GITLAB_API_ENDPOINT=http://example.com/api/v3
77
77
  GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
78
78
  TEMPLATE_FILE=gitlab_mr_release.md.erb
79
+ DEFAULT_TITLE=Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>
79
80
  ```
80
81
 
81
82
  current `.env.gitlab`
@@ -97,6 +98,17 @@ If defined both `~/.env.gitlab` and current `.env.gitlab`, current `.env.gitlab`
97
98
 
98
99
  `merge_requests` is array of [MergeRequest](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/merge_requests.md#get-single-mr)
99
100
 
101
+ ### variables in DEFAULT_TITLE
102
+ ```sh
103
+ DEFAULT_TITLE=Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>
104
+ ```
105
+
106
+ `DEFAULT_TITLE` supports erb.
107
+
108
+ * `source_branch` is `--source` in commandline args
109
+ * `target_branch` is `--target` in commandline args
110
+
111
+
100
112
  ## Development
101
113
 
102
114
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec gitlab_mr_release` to use the gem in this directory, ignoring other installed copies of this gem.
@@ -8,6 +8,8 @@ module GitlabMrRelease
8
8
 
9
9
  GITLAB_ENV_FILES = %w(.env.gitlab ~/.env.gitlab)
10
10
 
11
+ DEFAULT_TITLE_TEMPLATE = "Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>"
12
+
11
13
  def self.source_root
12
14
  "#{__dir__}/../templates"
13
15
  end
@@ -34,8 +36,6 @@ module GitlabMrRelease
34
36
  assert_env("GITLAB_API_PRIVATE_TOKEN")
35
37
  assert_env("GITLAB_PROJECT_NAME")
36
38
 
37
- title = options[:title] || default_title
38
-
39
39
  template = File.read(template_file)
40
40
 
41
41
  project = GitlabMrRelease::Project.new(
@@ -47,7 +47,7 @@ module GitlabMrRelease
47
47
  mr = project.create_merge_request(
48
48
  source_branch: options[:source],
49
49
  target_branch: options[:target],
50
- title: title,
50
+ title: generate_title,
51
51
  template: template,
52
52
  )
53
53
 
@@ -73,8 +73,19 @@ MergeRequest is created
73
73
  raise "Error: Environment variable #{name} is required" unless ENV[name]
74
74
  end
75
75
 
76
- def default_title
77
- "Release #{options[:source]} -> #{options[:target]}"
76
+ def generate_title
77
+ return options[:title] if options[:title]
78
+
79
+ generate_default_title(
80
+ title_template: ENV["DEFAULT_TITLE"],
81
+ source_branch: options[:source],
82
+ target_branch: options[:target],
83
+ )
84
+ end
85
+
86
+ def generate_default_title(title_template:, source_branch:, target_branch:)
87
+ title_template ||= DEFAULT_TITLE_TEMPLATE
88
+ ERB.new(title_template).result(binding).strip
78
89
  end
79
90
 
80
91
  def template_file
@@ -1,3 +1,3 @@
1
1
  module GitlabMrRelease
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_mr_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2015-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv