goodboy 0.0.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 +7 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +49 -0
- data/exe/goodboy +15 -0
- data/goodboy.gemspec +32 -0
- data/lib/goodboy.rb +10 -0
- data/lib/goodboy/command_handler.rb +17 -0
- data/lib/goodboy/commands/release.rb +49 -0
- data/lib/goodboy/config.rb +13 -0
- data/lib/goodboy/errors.rb +10 -0
- data/lib/goodboy/helpers.rb +15 -0
- data/lib/goodboy/version.rb +3 -0
- data/lib/goodboy/version_file.rb +13 -0
- data/test.yml +4 -0
- metadata +145 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8e239b266ad28f3b876bb8693db0a779dd317f7b8b26e8824fd5e00cdb4ae124
|
|
4
|
+
data.tar.gz: 0c0f63c970a5d9bd81e66d00b88782ffa8c6d542090a73109fc8356e6cf9af14
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 32323aaa4c3b89498eb76d00aa35f4727cd4fbc269a6d5c7cdc93e46e065420a7863a50e1d43d79e68494a5f47d67b2fa2430d666d9cdefb216cdc993b61f8a8
|
|
7
|
+
data.tar.gz: 65a5bd12b033dbde87b73e6e54f5f9311d2279380ccc720b257d71166868806f655d31b8d67cb6026ad8307af4ae8751858bc0380dce65c72a7901270d48d1e9
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/pkg
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.1
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
goodboy (0.0.1)
|
|
5
|
+
gem-release
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
byebug (10.0.2)
|
|
11
|
+
coderay (1.1.2)
|
|
12
|
+
diff-lcs (1.3)
|
|
13
|
+
gem-release (1.0.0)
|
|
14
|
+
method_source (0.9.0)
|
|
15
|
+
pry (0.11.3)
|
|
16
|
+
coderay (~> 1.1.0)
|
|
17
|
+
method_source (~> 0.9.0)
|
|
18
|
+
pry-byebug (3.6.0)
|
|
19
|
+
byebug (~> 10.0)
|
|
20
|
+
pry (~> 0.10)
|
|
21
|
+
rake (10.5.0)
|
|
22
|
+
rspec (3.7.0)
|
|
23
|
+
rspec-core (~> 3.7.0)
|
|
24
|
+
rspec-expectations (~> 3.7.0)
|
|
25
|
+
rspec-mocks (~> 3.7.0)
|
|
26
|
+
rspec-core (3.7.1)
|
|
27
|
+
rspec-support (~> 3.7.0)
|
|
28
|
+
rspec-expectations (3.7.0)
|
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
+
rspec-support (~> 3.7.0)
|
|
31
|
+
rspec-mocks (3.7.0)
|
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
33
|
+
rspec-support (~> 3.7.0)
|
|
34
|
+
rspec-support (3.7.1)
|
|
35
|
+
timecop (0.9.1)
|
|
36
|
+
|
|
37
|
+
PLATFORMS
|
|
38
|
+
ruby
|
|
39
|
+
|
|
40
|
+
DEPENDENCIES
|
|
41
|
+
bundler (~> 1.16)
|
|
42
|
+
goodboy!
|
|
43
|
+
pry-byebug
|
|
44
|
+
rake (~> 10.0)
|
|
45
|
+
rspec (~> 3.7)
|
|
46
|
+
timecop
|
|
47
|
+
|
|
48
|
+
BUNDLED WITH
|
|
49
|
+
1.16.2
|
data/exe/goodboy
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require 'goodboy'
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
puts Goodboy.run(ARGV[0])
|
|
8
|
+
Goodboy.debug { puts "no exception, exerything is allright" }
|
|
9
|
+
exit 0
|
|
10
|
+
rescue => error
|
|
11
|
+
STDERR.puts error.message
|
|
12
|
+
Goodboy.debug { STDERR.puts error.backtrace }
|
|
13
|
+
exit 1
|
|
14
|
+
end
|
|
15
|
+
|
data/goodboy.gemspec
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'goodboy/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'goodboy'
|
|
7
|
+
spec.version = Goodboy::VERSION
|
|
8
|
+
spec.authors = ['Bartlomiej Rapacz']
|
|
9
|
+
spec.email = ['bartlomiej.rapacz@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = %q{CQRS library for Ruby}
|
|
12
|
+
spec.description = %q{A simple CQRS library for Ruby.}
|
|
13
|
+
spec.homepage = "https://github.com/brapacz/goodboy"
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
|
+
end
|
|
21
|
+
spec.bindir = 'exe'
|
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
|
+
spec.require_paths = ['lib']
|
|
24
|
+
|
|
25
|
+
spec.add_dependency 'gem-release'
|
|
26
|
+
|
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
|
30
|
+
spec.add_development_dependency 'timecop'
|
|
31
|
+
spec.add_development_dependency 'pry-byebug'
|
|
32
|
+
end
|
data/lib/goodboy.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Goodboy
|
|
2
|
+
class CommandHandler
|
|
3
|
+
def handle(command_name, config: Config.new)
|
|
4
|
+
find_command!(command_name).new(config: config).run!
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def find_command!(command_name)
|
|
10
|
+
raise MissingCommandError unless command_name
|
|
11
|
+
command_klass_sufix = command_name.split('_').map(&:capitalize!).join
|
|
12
|
+
command_klass_name = "Goodboy::Commands::#{command_klass_sufix}"
|
|
13
|
+
raise(UnknownCommandError, command_name) unless Kernel.const_defined?(command_klass_name)
|
|
14
|
+
Kernel.const_get(command_klass_name)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'date'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module Goodboy
|
|
6
|
+
module Commands
|
|
7
|
+
class Release
|
|
8
|
+
def initialize(git: Git.new, date: Date.today, config: Config.new)
|
|
9
|
+
@git = git
|
|
10
|
+
@date = date
|
|
11
|
+
@config = config
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def run!
|
|
15
|
+
# check if `git status` returns "nothing to commit"
|
|
16
|
+
@git.ensure_clean!
|
|
17
|
+
|
|
18
|
+
# read current change
|
|
19
|
+
previous_release = @git.last_release_tag
|
|
20
|
+
previous_change = Change.parse(@git.read_file(@config.current_change_file, revision: previous_release))
|
|
21
|
+
|
|
22
|
+
# read previous change
|
|
23
|
+
current_change = Change.parse(File.read(@config.current_change_file, 'r'))
|
|
24
|
+
# no changes in changelog
|
|
25
|
+
raise NoChangesError if previous_change == current_change
|
|
26
|
+
|
|
27
|
+
version_file = VersionFile.new(current_change)
|
|
28
|
+
|
|
29
|
+
# put it into change log
|
|
30
|
+
Changelog.read(@config.changelog_file).append(current_change, version: version_file.new_numer, date: @date)
|
|
31
|
+
|
|
32
|
+
# bump version
|
|
33
|
+
version_file.bump!
|
|
34
|
+
|
|
35
|
+
# add version and changelog to commit, commit & push
|
|
36
|
+
@git.add_file!(version_file.filename)
|
|
37
|
+
@git.add_file!(@config.changelog_file)
|
|
38
|
+
@git.commit! release_message(
|
|
39
|
+
date: date,
|
|
40
|
+
version: version_file.new_numer
|
|
41
|
+
)
|
|
42
|
+
@git.push!
|
|
43
|
+
rescue => e
|
|
44
|
+
@git.reset! unless Git::NotCleanError
|
|
45
|
+
raise
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Goodboy
|
|
2
|
+
class Config
|
|
3
|
+
DEFAULT_CHANGES_FILE = '.last_change.yml'
|
|
4
|
+
DEFAULT_CHANGELOG_FILE = 'CHANGELOG.md'
|
|
5
|
+
|
|
6
|
+
attr_reader :changes_file, :changelog_file
|
|
7
|
+
|
|
8
|
+
def initialize(changes_file = DEFAULT_CHANGES_FILE, changelog_file: DEFAULT_CHANGELOG_FILE)
|
|
9
|
+
@changelog_file = changelog_file
|
|
10
|
+
@changes_file = changes_file
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Goodboy
|
|
2
|
+
class VersionFile < GemRelease::VersionFile
|
|
3
|
+
def initialize(**options)
|
|
4
|
+
@project_name = options[:project_name] # Optionally override project name.
|
|
5
|
+
@content = options[:content] # Option to not read from actual file on disk.
|
|
6
|
+
super(options)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def gem_name
|
|
10
|
+
@project_name || super
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/test.yml
ADDED
metadata
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: goodboy
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bartlomiej Rapacz
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-06-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: gem-release
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.16'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.16'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.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: '3.7'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.7'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: timecop
|
|
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: pry-byebug
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
description: A simple CQRS library for Ruby.
|
|
98
|
+
email:
|
|
99
|
+
- bartlomiej.rapacz@gmail.com
|
|
100
|
+
executables:
|
|
101
|
+
- goodboy
|
|
102
|
+
extensions: []
|
|
103
|
+
extra_rdoc_files: []
|
|
104
|
+
files:
|
|
105
|
+
- ".gitignore"
|
|
106
|
+
- ".rspec"
|
|
107
|
+
- ".ruby-version"
|
|
108
|
+
- Gemfile
|
|
109
|
+
- Gemfile.lock
|
|
110
|
+
- exe/goodboy
|
|
111
|
+
- goodboy.gemspec
|
|
112
|
+
- lib/goodboy.rb
|
|
113
|
+
- lib/goodboy/command_handler.rb
|
|
114
|
+
- lib/goodboy/commands/release.rb
|
|
115
|
+
- lib/goodboy/config.rb
|
|
116
|
+
- lib/goodboy/errors.rb
|
|
117
|
+
- lib/goodboy/helpers.rb
|
|
118
|
+
- lib/goodboy/version.rb
|
|
119
|
+
- lib/goodboy/version_file.rb
|
|
120
|
+
- test.yml
|
|
121
|
+
homepage: https://github.com/brapacz/goodboy
|
|
122
|
+
licenses:
|
|
123
|
+
- MIT
|
|
124
|
+
metadata: {}
|
|
125
|
+
post_install_message:
|
|
126
|
+
rdoc_options: []
|
|
127
|
+
require_paths:
|
|
128
|
+
- lib
|
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
requirements: []
|
|
140
|
+
rubyforge_project:
|
|
141
|
+
rubygems_version: 2.7.7
|
|
142
|
+
signing_key:
|
|
143
|
+
specification_version: 4
|
|
144
|
+
summary: CQRS library for Ruby
|
|
145
|
+
test_files: []
|