allages 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 431112c7a324d6242c33172e228ba4499074974686305ddf7b345930d9c6c7e9
4
+ data.tar.gz: ca44e2c7a9a21968270d6c45eff530cbf26c54924e1f4d8ca433dc3549f6a32f
5
+ SHA512:
6
+ metadata.gz: 4ad1c370f6286152d86ac169574ee24febe3560ac7cb9aea7d1ba82d7319cd2b38e36ac0267fd42fde105b41e66fe7222ff8e373f3b7581a3528df1fba099a4d
7
+ data.tar.gz: c48adace9593ab54b09a9014c5f925e87a52ac96e7377947b8178f3fbb3560fd47592273cfe92ecb305f698000f14bac6091018e8b68f95578ea2d6c513e6b0a
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at apantsiop@yahoo.gr. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in allages.gemspec
4
+ gemspec
@@ -0,0 +1,163 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ allages (0.1.0)
5
+ rails
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.0)
11
+ actionpack (= 6.0.0)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.0)
15
+ actionpack (= 6.0.0)
16
+ activejob (= 6.0.0)
17
+ activerecord (= 6.0.0)
18
+ activestorage (= 6.0.0)
19
+ activesupport (= 6.0.0)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.0)
22
+ actionpack (= 6.0.0)
23
+ actionview (= 6.0.0)
24
+ activejob (= 6.0.0)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.0)
28
+ actionview (= 6.0.0)
29
+ activesupport (= 6.0.0)
30
+ rack (~> 2.0)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.0)
35
+ actionpack (= 6.0.0)
36
+ activerecord (= 6.0.0)
37
+ activestorage (= 6.0.0)
38
+ activesupport (= 6.0.0)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.0)
41
+ activesupport (= 6.0.0)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.0)
47
+ activesupport (= 6.0.0)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.0)
50
+ activesupport (= 6.0.0)
51
+ activerecord (6.0.0)
52
+ activemodel (= 6.0.0)
53
+ activesupport (= 6.0.0)
54
+ activestorage (6.0.0)
55
+ actionpack (= 6.0.0)
56
+ activejob (= 6.0.0)
57
+ activerecord (= 6.0.0)
58
+ marcel (~> 0.3.1)
59
+ activesupport (6.0.0)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.1, >= 2.1.8)
65
+ builder (3.2.3)
66
+ coderay (1.1.2)
67
+ concurrent-ruby (1.1.5)
68
+ crass (1.0.4)
69
+ diff-lcs (1.3)
70
+ erubi (1.8.0)
71
+ globalid (0.4.2)
72
+ activesupport (>= 4.2.0)
73
+ i18n (1.6.0)
74
+ concurrent-ruby (~> 1.0)
75
+ loofah (2.2.3)
76
+ crass (~> 1.0.2)
77
+ nokogiri (>= 1.5.9)
78
+ mail (2.7.1)
79
+ mini_mime (>= 0.1.1)
80
+ marcel (0.3.3)
81
+ mimemagic (~> 0.3.2)
82
+ method_source (0.9.2)
83
+ mimemagic (0.3.3)
84
+ mini_mime (1.0.2)
85
+ mini_portile2 (2.4.0)
86
+ minitest (5.10.3)
87
+ nio4r (2.4.0)
88
+ nokogiri (1.10.4)
89
+ mini_portile2 (~> 2.4.0)
90
+ pry (0.12.2)
91
+ coderay (~> 1.1.0)
92
+ method_source (~> 0.9.0)
93
+ rack (2.0.7)
94
+ rack-test (1.1.0)
95
+ rack (>= 1.0, < 3)
96
+ rails (6.0.0)
97
+ actioncable (= 6.0.0)
98
+ actionmailbox (= 6.0.0)
99
+ actionmailer (= 6.0.0)
100
+ actionpack (= 6.0.0)
101
+ actiontext (= 6.0.0)
102
+ actionview (= 6.0.0)
103
+ activejob (= 6.0.0)
104
+ activemodel (= 6.0.0)
105
+ activerecord (= 6.0.0)
106
+ activestorage (= 6.0.0)
107
+ activesupport (= 6.0.0)
108
+ bundler (>= 1.3.0)
109
+ railties (= 6.0.0)
110
+ sprockets-rails (>= 2.0.0)
111
+ rails-dom-testing (2.0.3)
112
+ activesupport (>= 4.2.0)
113
+ nokogiri (>= 1.6)
114
+ rails-html-sanitizer (1.2.0)
115
+ loofah (~> 2.2, >= 2.2.2)
116
+ railties (6.0.0)
117
+ actionpack (= 6.0.0)
118
+ activesupport (= 6.0.0)
119
+ method_source
120
+ rake (>= 0.8.7)
121
+ thor (>= 0.20.3, < 2.0)
122
+ rake (10.5.0)
123
+ rspec (3.8.0)
124
+ rspec-core (~> 3.8.0)
125
+ rspec-expectations (~> 3.8.0)
126
+ rspec-mocks (~> 3.8.0)
127
+ rspec-core (3.8.2)
128
+ rspec-support (~> 3.8.0)
129
+ rspec-expectations (3.8.4)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.8.0)
132
+ rspec-mocks (3.8.1)
133
+ diff-lcs (>= 1.2.0, < 2.0)
134
+ rspec-support (~> 3.8.0)
135
+ rspec-support (3.8.2)
136
+ sprockets (3.7.2)
137
+ concurrent-ruby (~> 1.0)
138
+ rack (> 1, < 3)
139
+ sprockets-rails (3.2.1)
140
+ actionpack (>= 4.0)
141
+ activesupport (>= 4.0)
142
+ sprockets (>= 3.0.0)
143
+ thor (0.20.3)
144
+ thread_safe (0.3.6)
145
+ tzinfo (1.2.5)
146
+ thread_safe (~> 0.1)
147
+ websocket-driver (0.7.1)
148
+ websocket-extensions (>= 0.1.0)
149
+ websocket-extensions (0.1.4)
150
+ zeitwerk (2.1.9)
151
+
152
+ PLATFORMS
153
+ ruby
154
+
155
+ DEPENDENCIES
156
+ allages!
157
+ bundler (~> 2.0)
158
+ pry
159
+ rake (~> 10.0)
160
+ rspec (~> 3.0)
161
+
162
+ BUNDLED WITH
163
+ 2.0.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 TODO: Write your name
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,241 @@
1
+ # Allages
2
+
3
+ #### What Allages is?
4
+
5
+ This gem was created to help maintain a changelog in a project.
6
+
7
+ It can be used as a standalone utility for any kind of application or embedded as a gem in a RoR project.
8
+
9
+ Allages generates a markdown changelog based on the keepachangelog.com format.
10
+
11
+ "Allages" translates to "changes" in greek.
12
+
13
+ #### So, why not use a simple markdown file?
14
+
15
+ Keeping a changelog file for an application with many collaborators is hard due to conflicts that often occur. In order to avoid this messy situation, a directory based approach, with changes contained in their own file each, is a better alternative. No conflicts arise when merging feature/hotfix branches. Also, by using a simple script, one can generate a single CHANGELOG.md file by simply parsing the directory structure for entries.
16
+
17
+ The directory tree convention that looks like this (sample):
18
+
19
+ ```
20
+ changelogs
21
+ ├── 1.0.3
22
+ │   └── d4fe5be8-7237-4b40-854a-0e09f38be8ae.yml
23
+ ├── 1.0.4
24
+ │   ├── 531985ac-f3b4-4ba4-a257-31dabfdd9200.yml
25
+ │   └── bf701293-1620-4997-a728-3a50342407b8.yml
26
+ └── Unreleased
27
+ ├── 50267ff1-1047-4302-9843-19eeb79deea2.yml
28
+ └── d4fe5be8-7237-4b40-854a-0e09f38be8ae.yml
29
+ ```
30
+
31
+ each subfolders under the /changelogs folder is considered a version. "Unreleased" is by convention the folder to keep all the new changelog entries that have not yet made it into a version.
32
+
33
+ Each yaml file is a changelog entry. The name of the file has no effect on the entry description. If you use the handy rake task in order to create the entry, then a uuid named file is created which helps with resolving accidental conflicts. But you are free to use any other naming scheme, if you like. What is inside the yaml files is what matters:
34
+
35
+ ```
36
+ date: 2019-08-22
37
+ type: Added
38
+ description: This is a nice addition to our app
39
+ author: Tolis
40
+ issue: 11
41
+ dependencies:
42
+ - ~> backend-1.0.2
43
+ - -> solr-5.5
44
+ ```
45
+
46
+ The above is a typical changelog entry.
47
+
48
+ By using the markdown generator we get something like this:
49
+
50
+ ```
51
+ # Changelog
52
+ All notable changes to this project will be documented in this file.
53
+
54
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
56
+
57
+ ## Unreleased
58
+ ### Added
59
+ - Another nice addition
60
+ ### Fixed
61
+ - This was a bug, it is now fixed, issue: 67
62
+
63
+ ## 1.0.3
64
+ ### Fixed
65
+ - This was a bug, it is now fixed, issue: 67
66
+
67
+ ## 1.0.4
68
+ ### Added
69
+ - This is a nice addition to our app, issue: 11, dependencies: ~> backend-1.0.2, -> solr-5.5
70
+ ### Changed
71
+ - This was wrong, so we changed it, issue: 89
72
+ ```
73
+
74
+
75
+ ## Installation
76
+
77
+ ##### For RoR projects
78
+
79
+ Add this line to your application's Gemfile:
80
+
81
+ ```ruby
82
+ gem 'allages'
83
+ ```
84
+
85
+ And then execute:
86
+
87
+ $ bundle
88
+
89
+ ##### For all other projects
90
+
91
+ $ gem install allages
92
+
93
+
94
+ And generate the default tree structure with:
95
+
96
+ ##### For RoR projects
97
+
98
+ ```
99
+ $ rails generate allages:init
100
+ create config/initializers/allages.rb
101
+ create changelogs
102
+ create changelogs/Unreleased
103
+ ```
104
+
105
+ ##### For all other projects
106
+
107
+ ```
108
+ $ allages init
109
+ create .allages.yml
110
+ create changelogs
111
+ create changelogs/Unreleased
112
+ ```
113
+
114
+ You can change the default allages configuration in your rails app.
115
+
116
+
117
+ ##### For RoR projects
118
+
119
+ ... by using an initializer. Like so:
120
+ ```
121
+ Allages.configure do |config|
122
+ config.input_dir = 'changelogs'
123
+ config.output_file = :stdout
124
+ config.include_unreleased = true
125
+ config.header = <<~END
126
+ # Changelog
127
+ All notable changes to this project will be documented in this file.
128
+
129
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
130
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
131
+
132
+ END
133
+ end
134
+ ```
135
+
136
+ ##### For all other projects
137
+
138
+ by editing the settings in the generated .allages.yml file:
139
+ ```
140
+ input_dir: 'changelogs'
141
+ output_file: 'CHANGELOG.md'
142
+ include_unreleased: false
143
+ header: |+
144
+ # Changelog
145
+ All notable changes to this project will be documented in this file.
146
+
147
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
148
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
149
+
150
+
151
+ ```
152
+
153
+
154
+ ## Usage
155
+
156
+ ### Creating a new (unreleased) entry
157
+
158
+ Just invoke the proper rake task with:
159
+ ##### For RoR projects
160
+
161
+ ```
162
+ $ rake allages:new_entry
163
+ ```
164
+ ##### For all other projects
165
+
166
+ ```
167
+ $ allages new_entry
168
+ ```
169
+ And by giving the proper entry data:
170
+ ```
171
+ Type (a)dded, (c)hanged, (f)ixed, (d)eprecated, (r)emoved, (s)ecurity: a
172
+ Description: This is something new
173
+ Author: Tolis
174
+ Issue: 90
175
+ Dependencies (comma seperated): one dep, then another one
176
+ created new unreleased entry changelogs/Unreleased/f062f1cc-0d97-461f-928f-5c108c406d3f.yml
177
+ ```
178
+ a new yaml file will created in the changelogs/Unreleased directory.
179
+
180
+ ### Creating a new version
181
+
182
+ Creating a new version section for our changelog is as easy as creating a directory with the version name within /changelogs. But you can use a rake task for that:
183
+ ##### For RoR projects
184
+ ```
185
+ $ rake allages:new_version
186
+ ```
187
+ ##### For all other projects
188
+ ```
189
+ $ allages new_version
190
+ ```
191
+ ```
192
+ Version name: 1.0.4
193
+ created directory changelogs/1.0.4
194
+ ```
195
+ By using the rake task you get a aditional hidden .meta.yml file within the created directory. This is for storing extra metadata (date, dependencies) regarding this version. You can edit this file manually. The extra metadata will be included in the version header of the generated markdown file. Leave the yaml values commented out if you don't want any metadata on your version descriptions.
196
+
197
+ ### Generating the CHANGELOG.md
198
+
199
+ As expected, there's a rake task for that:
200
+ ##### For RoR projects
201
+ ```
202
+ $ rake allages:generate
203
+ ```
204
+ ##### For all other projects
205
+ ```
206
+ $ allages generate
207
+ ```
208
+ The markdown will be output on the console if the reserved `:stdout` keyword is used, or in a file if a string was given in the configuration.
209
+
210
+ ### Version metadata
211
+
212
+ By putting a .meta.yml file in the version folder you can add metadata such as date and dependencies in your changelog version/section headers:
213
+
214
+ ```
215
+ date: 2019-08-22
216
+ dependencies:
217
+ - dependency 1
218
+ - dependency 2
219
+ ```
220
+ Then the version header generated will look like this:
221
+ ```
222
+ ## 1.0.4 - 2019-08-22 - dependencies: dependency 1, dependency 2
223
+ ```
224
+
225
+ ## TODO
226
+
227
+ * A rake task to move entries from Unrealased to a new version
228
+ * Write tests
229
+ * Break the rails dependency
230
+
231
+ ## Contributing
232
+
233
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/allages. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
234
+
235
+ ## License
236
+
237
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
238
+
239
+ ## Code of Conduct
240
+
241
+ Everyone interacting in the Allages project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/allages/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,38 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "allages/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "allages"
7
+ spec.version = Allages::VERSION
8
+ spec.authors = ["Apostolos Pantsiopoulos"]
9
+ spec.email = ["apantsiop@yahoo.gr"]
10
+
11
+ spec.summary = %q{A rails gem to help with keeping a changelog for teams while minimizing git conflict issues}
12
+ spec.description = %q{A rails gem to help with keeping a changelog for teams while minimizing git conflict issues}
13
+ spec.homepage = "https://github.com/apantsiop/allages"
14
+ spec.license = "MIT"
15
+
16
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/apantsiop/allages"
20
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.executables = ["allages"]
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "rails"
33
+
34
+ spec.add_development_dependency "bundler", "~> 2.0"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "pry"
38
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "allages"
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(__FILE__)
@@ -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,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rake'
4
+ require 'rails/generators'
5
+ require 'allages'
6
+
7
+ spec = Gem::Specification.find_by_name 'allages'
8
+ rakefile = "#{spec.gem_dir}/lib/allages/Rakefile"
9
+ load rakefile
10
+
11
+ task = ARGV[0]
12
+
13
+ if File.file? ".allages.yml"
14
+ yaml = YAML.load_file ".allages.yml"
15
+ if yaml
16
+ Allages.configure do |config|
17
+ yaml.each do |setting, value|
18
+ config.send(setting + "=", value)
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ unless task
25
+ puts "No task was given"
26
+ else
27
+ Rake::Task["allages:#{task}"].execute
28
+ end
@@ -0,0 +1,162 @@
1
+ require "allages/version"
2
+ require "allages/config"
3
+ require "allages/railtie" if defined?(Rails)
4
+ require 'securerandom'
5
+
6
+ module Allages
7
+ class Error < StandardError; end
8
+
9
+ META_TEMPLATE = <<~META
10
+ # date: #{Time.now.strftime('%F')}
11
+ # dependencies:
12
+ # - dependency 1
13
+ # - dependency 2
14
+ META
15
+
16
+ def generate
17
+ sections = []
18
+
19
+ Dir.glob("#{Allages.config.input_dir}/*").each do |filename|
20
+ if File.directory? filename
21
+ section = {}
22
+ dir = File.basename filename
23
+ next if (dir == "Unreleased" && Allages.config.include_unreleased == false)
24
+ section[:name] = dir
25
+
26
+ if File.file? "#{filename}/.meta.yml"
27
+ section[:meta] = YAML.load_file "#{filename}/.meta.yml"
28
+ end
29
+
30
+ categories = {}
31
+ Dir.glob("#{filename}/*.yml").each do |entry_filename|
32
+ next if entry_filename.match? /\.meta\.yml/
33
+ entry = YAML.load_file entry_filename
34
+ if categories.has_key? entry['type']
35
+ categories[entry['type']] << entry
36
+ else
37
+ categories[entry['type']] = [entry]
38
+ end
39
+ end
40
+
41
+ section[:categories] = categories
42
+ sections << section
43
+ end
44
+ end
45
+
46
+ sections.sort! do |a, b|
47
+ if a[:name] == "Unreleased"
48
+ -1
49
+ elsif b[:name] == "Unreleased"
50
+ 1
51
+ else
52
+ a[:name] <=> b[:name]
53
+ end
54
+ end
55
+
56
+ markdown = "#{Allages.config.header}"
57
+
58
+ had_previous_section = false
59
+ sections.each do |section|
60
+ markdown << "\n" if had_previous_section
61
+ had_previous_section = true
62
+ title = ["## #{section[:name]}"]
63
+ if section[:meta]
64
+ title << section[:meta]['date'] if section[:meta]['date']
65
+ title << "dependencies: #{section[:meta]['dependencies'].to_a.join(', ')}" unless section[:meta]['dependencies'].to_a.empty?
66
+ end
67
+ markdown << "#{title.join(' - ')}" << "\n"
68
+
69
+ section[:categories].each do |category, entries|
70
+ markdown << "### #{category}\n"
71
+
72
+ entries.each do |entry|
73
+ entry_md = [entry['description']]
74
+ entry_md << "issue: #{entry['issue']}" if entry['issue']
75
+ entry_md << "dependencies: #{entry['dependencies'].to_a.join(', ')}" unless entry['dependencies'].to_a.empty?
76
+ markdown << "- #{entry_md.join(', ')}\n"
77
+ end
78
+ end
79
+ end
80
+
81
+ if Allages.config.output_file.to_sym == :stdout
82
+ puts markdown
83
+ else
84
+ open(Allages.config.output_file, 'w') do |f|
85
+ f.puts markdown
86
+ end
87
+ end
88
+ end
89
+
90
+ module_function :generate
91
+
92
+ def new_version
93
+ print "Version name: "
94
+ STDOUT.flush
95
+ version = STDIN.gets.chomp
96
+ dir = "#{Allages.config.input_dir}/#{version}"
97
+ if File.directory?(dir)
98
+ puts "version already exists"
99
+ exit 1
100
+ else
101
+ FileUtils.mkdir_p(dir)
102
+ puts "created directory #{dir} "
103
+ end
104
+
105
+ open("#{dir}/.meta.yml", 'w') do |f|
106
+ f.puts META_TEMPLATE
107
+ end
108
+ end
109
+
110
+ module_function :new_version
111
+
112
+ def new_entry
113
+ types = {
114
+ "a" => "Added",
115
+ "c" => "Changed",
116
+ "f" => "Fixed",
117
+ "d" => "Deprecated",
118
+ "r" => "Removed",
119
+ "s" => "Security"
120
+ }
121
+
122
+ print "Type (a)dded, (c)hanged, (f)ixed, (d)eprecated, (r)emoved, (s)ecurity: "
123
+ STDOUT.flush
124
+ type = types[STDIN.gets.chomp]
125
+
126
+ print "Description: "
127
+ STDOUT.flush
128
+ description = STDIN.gets.chomp
129
+
130
+ print "Author: "
131
+ STDOUT.flush
132
+ author = STDIN.gets.chomp
133
+
134
+ print "Issue: "
135
+ STDOUT.flush
136
+ issue = STDIN.gets.chomp
137
+
138
+ print "Dependencies (comma seperated): "
139
+ STDOUT.flush
140
+ deps = STDIN.gets.chomp.split(',').map{|d| " - #{d.chomp.lstrip}"}.join("\n")
141
+
142
+ yaml = <<~YAML
143
+ date: #{Time.now.strftime('%F')}
144
+ type: #{type}
145
+ description: #{description}
146
+ author: #{author}
147
+ issue: #{issue}
148
+ dependencies:
149
+ #{deps}
150
+ YAML
151
+
152
+ filename = "#{SecureRandom.uuid}.yml"
153
+ path = "#{Allages.config.input_dir}/Unreleased/#{filename}"
154
+
155
+ open("#{path}", 'w') do |f|
156
+ f.puts yaml
157
+ end
158
+ puts "created new unreleased entry #{path}"
159
+ end
160
+
161
+ module_function :new_entry
162
+ end
@@ -0,0 +1,4 @@
1
+ require 'allages'
2
+
3
+ path = File.expand_path(__dir__)
4
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
@@ -0,0 +1,33 @@
1
+ module Allages
2
+
3
+ def self.configure(&block)
4
+ yield @config ||= Allages::Configuration.new
5
+ end
6
+
7
+ def self.config
8
+ @config
9
+ end
10
+
11
+ class Configuration
12
+ attr_accessor :input_dir, :output_file, :include_unreleased, :header
13
+ end
14
+
15
+ def self.reset_config
16
+ self.configure do |config|
17
+ config.input_dir = 'changelogs'
18
+ config.output_file = :stdout
19
+ config.include_unreleased = false
20
+ config.header = <<~END
21
+ # Changelog
22
+ All notable changes to this project will be documented in this file.
23
+
24
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
25
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
26
+
27
+ END
28
+ end
29
+ end
30
+
31
+ reset_config()
32
+
33
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails'
2
+ require 'rails/generators'
3
+ require 'allages'
4
+ require 'generators/init_generator'
5
+ require 'generators/yaml_generator'
6
+
7
+ module Allages
8
+ class Railtie < Rails::Railtie
9
+ railtie_name :allages
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
@@ -0,0 +1,24 @@
1
+ namespace :allages do
2
+
3
+ desc 'Initialize allages'
4
+ task :init => :environment do
5
+ puts defined?(Rails) ? "Rails exists" : "No rails"
6
+ Rails::Generators.invoke 'allages:yaml'
7
+ end
8
+
9
+ desc 'Generate changelog'
10
+ task :generate => :environment do
11
+ Allages.generate
12
+ end
13
+
14
+ desc 'Create new version'
15
+ task :new_version => :environment do
16
+ Allages.new_version
17
+ end
18
+
19
+ desc 'Create new entry'
20
+ task :new_entry => :environment do
21
+ Allages.new_entry
22
+ end
23
+
24
+ end
@@ -0,0 +1,3 @@
1
+ module Allages
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,30 @@
1
+ require 'rails/generators/base'
2
+
3
+ module Allages
4
+ class InitGenerator < Rails::Generators::Base
5
+ desc "This generator creates the nneded files for allages gem"
6
+
7
+ def create_initializer_file
8
+ create_file "config/initializers/allages.rb", <<~CONFIG
9
+ Allages.configure do |config|
10
+ # config.input_dir = 'changelogs'
11
+ # config.output_file = :stdout
12
+ # config.include_unreleased = false
13
+ # config.header = <<~END
14
+ # # Changelog
15
+ # All notable changes to this project will be documented in this file.
16
+
17
+ # The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
18
+ # and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
19
+
20
+ # END
21
+ end
22
+ CONFIG
23
+ end
24
+
25
+ def create_directories_structure
26
+ empty_directory Allages.config.input_dir
27
+ empty_directory "#{Allages.config.input_dir}/Unreleased"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ require 'rails/generators/base'
2
+
3
+ module Allages
4
+ class YamlGenerator < Rails::Generators::Base
5
+ desc "This generator initializes the allages gem with this directory"
6
+
7
+ def create_initializer_file
8
+ create_file ".allages.yml", <<~CONFIG
9
+ # input_dir: 'changelogs'
10
+ # output_file: 'stdout'
11
+ # include_unreleased: false
12
+ # header: |+
13
+ # # Changelog
14
+ # All notable changes to this project will be documented in this file.
15
+ #
16
+ # The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
17
+ # and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
18
+ #
19
+ CONFIG
20
+ end
21
+
22
+ def create_directories_structure
23
+ empty_directory Allages.config.input_dir
24
+ empty_directory "#{Allages.config.input_dir}/Unreleased"
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: allages
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Apostolos Pantsiopoulos
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
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: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
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.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
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
+ description: A rails gem to help with keeping a changelog for teams while minimizing
84
+ git conflict issues
85
+ email:
86
+ - apantsiop@yahoo.gr
87
+ executables:
88
+ - allages
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".travis.yml"
95
+ - CODE_OF_CONDUCT.md
96
+ - Gemfile
97
+ - Gemfile.lock
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - allages.gemspec
102
+ - bin/console
103
+ - bin/setup
104
+ - exe/allages
105
+ - lib/allages.rb
106
+ - lib/allages/Rakefile
107
+ - lib/allages/config.rb
108
+ - lib/allages/railtie.rb
109
+ - lib/allages/tasks/allages.rake
110
+ - lib/allages/version.rb
111
+ - lib/generators/init_generator.rb
112
+ - lib/generators/yaml_generator.rb
113
+ homepage: https://github.com/apantsiop/allages
114
+ licenses:
115
+ - MIT
116
+ metadata:
117
+ homepage_uri: https://github.com/apantsiop/allages
118
+ source_code_uri: https://github.com/apantsiop/allages
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.7.8
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A rails gem to help with keeping a changelog for teams while minimizing git
139
+ conflict issues
140
+ test_files: []