plus-one 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4be0ebc84ed16cfb703573b366a2a1864d13557e
4
+ data.tar.gz: 0a39f568130501f99b1965892f8631d2a4939810
5
+ SHA512:
6
+ metadata.gz: a4474d45ea59d0d49c0a29cc90ced71c02b0951e546a081269e24184b8954b7b83088c18ce24562c1f2a464fe3c361cbfc7c8a2429e6a0e8006a08fdfa04e566
7
+ data.tar.gz: 82d8064c0b0a9e1e6b90f8ffe9b465a0c02db56bc17b3c841e2b1744b4fbed9f06ec5f4766f42842a49410d6aef228750462bc8b380bfb098d6fed60d95b2587
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea
11
+ .byebug_history
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'bin/**/*'
4
+ TargetRubyVersion: 2.3
5
+ Documentation:
6
+ Enabled: false
7
+ Metrics/LineLength:
8
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Ralf Claassens
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,58 @@
1
+ # PlusOne
2
+
3
+ This repo contains a generic releases script for bumping a git tag and pushing it to the 'origin'
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'plus-one'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### help
22
+
23
+ ```bash
24
+ $ bundle exec plus-one
25
+ Commands:
26
+ plus-one create # create next release
27
+ plus-one current # show current release
28
+ plus-one help [COMMAND] # Describe available commands or one specific command
29
+ ```
30
+
31
+ ### create a release
32
+
33
+ ```bash
34
+ $ bundle exec plus-one create
35
+ Fetching from origin
36
+ You are about to create release 'v1.0.1'.
37
+
38
+ This means:
39
+ * a tag 'v1.0.1' will be created
40
+ * this tag will be pushed to origin
41
+ Continue? y
42
+ # will create tag and push
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ 1. [Fork the repository](https://github.com/ralfclaassens/plus-one)
48
+
49
+ 1. Clone your newly created repository (e.g. `git clone git@github.com:ralfclaassens/plus-one.git`)
50
+
51
+ 1. Create a feature branch (`git checkout -b my-additions`) and make the changes
52
+
53
+ 1. Commit your changes (`git commit -am 'My additions'`)
54
+
55
+ 1. Push the branch (`git push origin -u my-new-feature`)
56
+
57
+ 1. Visit the Project-page of your fork and select 'New Merge Request' (select `my-additions` as source-branch)
58
+
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
3
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'plus-one'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
@@ -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,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'plus-one/cli'
5
+
6
+ PlusOne::Cli.start(ARGV)
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'thor'
5
+ require 'cocaine'
6
+
7
+ module PlusOne
8
+ class OurVersion < Gem::Version
9
+ def succ
10
+ major, minor, patch = segments
11
+ self.class.new([major, minor, patch.next].join('.'))
12
+ end
13
+
14
+ def self.from_tag(tag)
15
+ new(tag[/(\d+\.\d+\.\d+)/, 1])
16
+ end
17
+
18
+ def to_s
19
+ "v#{super}"
20
+ end
21
+ end
22
+
23
+ class Cli < Thor
24
+ desc 'create', 'create next plus-one'
25
+ def create
26
+ git_fetch!
27
+ say <<-EOS
28
+ You are about to create plus-one '#{next_release}'.
29
+
30
+ This means:
31
+ * a tag '#{next_release}' will be created
32
+ * this tag will be pushed to origin
33
+ EOS
34
+ create_release!(next_release) if yes?('Continue?')
35
+ end
36
+
37
+ desc 'current', 'show current plus-one'
38
+ def current
39
+ git_fetch!
40
+ say("#{current_release} (#{release_date(current_release)})")
41
+ end
42
+
43
+ no_commands do
44
+ def git(rest, **opts)
45
+ Cocaine::CommandLine.new('git', rest, opts)
46
+ end
47
+
48
+ def git_fetch!
49
+ say('Fetching from origin')
50
+ git('fetch origin --tags', swallow_stderr: true).run
51
+ end
52
+
53
+ def create_release!(release)
54
+ git_tag = git(%(tag -a #{release} -m "Version #{release}"))
55
+ git_push_tags = git(%(push origin --tags))
56
+ git_push = git(%(push origin))
57
+
58
+ git_tag.run
59
+ git_push.run
60
+ git_push_tags.run
61
+ end
62
+
63
+ def current_release
64
+ OurVersion.from_tag(git('tag | sort').run.chomp.split("\n").last)
65
+ end
66
+
67
+ def release_date(release)
68
+ git("log -n 1 #{release} --format='%ci'").run.chomp
69
+ end
70
+
71
+ def next_release
72
+ current_release.succ
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require 'plus-one/cli'
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'plus-one'
8
+ spec.version = '1.0.0'
9
+ spec.authors = ['Ralf Claassens']
10
+ spec.email = ['ralfclaassens@gmail.com']
11
+
12
+ spec.summary = "This generic plus-one script for bumping a git tag and pushing it to the 'origin'."
13
+ spec.description = "This generic plus-one script for bumping a git tag and pushing it to the 'origin'."
14
+ spec.homepage = 'https://github.com/ralfclaassens/plus-one'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.11'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'byebug'
24
+ spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'rubocop'
26
+
27
+ spec.add_runtime_dependency 'thor', '~> 0'
28
+ spec.add_runtime_dependency 'cocaine', '~> 0'
29
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plus-one
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ralf Claassens
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: cocaine
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: This generic plus-one script for bumping a git tag and pushing it to
112
+ the 'origin'.
113
+ email:
114
+ - ralfclaassens@gmail.com
115
+ executables:
116
+ - plus-one
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".rubocop.yml"
122
+ - Gemfile
123
+ - LICENSE
124
+ - README.md
125
+ - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - exe/plus-one
129
+ - lib/plus-one/cli.rb
130
+ - lib/plus_one.rb
131
+ - plus-one.gemspec
132
+ homepage: https://github.com/ralfclaassens/plus-one
133
+ licenses: []
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.5.1
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: This generic plus-one script for bumping a git tag and pushing it to the
155
+ 'origin'.
156
+ test_files: []