renogen 0.1.0.pre → 1.0.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: 0601d545b81d975fb00732f998a904c07abf2604
4
- data.tar.gz: d635d1c62edc949f38db2b03a42a48098d48fc8d
3
+ metadata.gz: 169e26c4cd97a2fb31a22eada063fca3a25a57cf
4
+ data.tar.gz: 5200eff043775217ae1cc7d5e91ec704570346a7
5
5
  SHA512:
6
- metadata.gz: d0c5ece883782914cdb6bc731cfcc368d63bab3c250396cfa36bbbee7e65b774ef253199579e90fe126fb2fe9e3e669d746281f0e4e0e0b2f6423857d2dd8c0f
7
- data.tar.gz: 8c2f2eb12331c3dd664066202aafe1e60545b37945e7a2ba7130a30109ad0832246f206ebebc3445f194858089e7dc1fecb8c8e27ce4386bf5f52cbf340923d5
6
+ metadata.gz: 3b52c38810a2b055fa83fe9ece7203b3ba9fd9360c0fefd49ca4e7fdd89d7691b899a7bb652367368ff6086974dc0e4b2038405923878a736c9e5b448519c87e
7
+ data.tar.gz: a5e624d7fffa82c23fd4413ae76a1053133034e2c0b837664b71f2c5e3d0ce0972865ada62346885be4c23183050c12fd923d0f5d1228ed3c7a482c56d79037d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Renogen
2
2
 
3
- Renogen or Re(lease) No(tes) Gen(erator) is a tool to separate feature notes from product versions.
3
+ Renogen or Re(lease) No(tes) Gen(erator) is a development tool to separate feature notes from product versions.
4
4
 
5
5
  ### Installation
6
6
 
@@ -12,8 +12,8 @@ or add the following to your Gemfile
12
12
 
13
13
  `gem 'renogen', :require => false, :group => :development`
14
14
 
15
- `$ renogen init # optional creates directory for notes`
16
- `$ renogen --help # list available command options
15
+ `$ renogen init # optional Creates directory for notes`
16
+ `$ renogen --help # List available options
17
17
 
18
18
  ### Usage
19
19
 
@@ -24,51 +24,58 @@ To generate your notes run the following command
24
24
  Unfortunatly renogen cant write documentation for your change.
25
25
  By default renogen uses the yaml file stratagy to extract your notes
26
26
 
27
+ `$ renogen --help # list available command options`
28
+
27
29
  #### Adding YAML feature notes
28
30
 
29
- Create a file within the next version folder(default:'change_log/next/')
31
+ Create a new file within the 'next' version folder(default:'change_log/next/')
30
32
 
31
33
  Example feature note
32
- ```
34
+ ```yaml
33
35
  # change_log/next/example.yml
34
- MyFormattedSingleLine:
36
+ my_formatted_single_line:
35
37
  identifier: bug_1
36
38
  link: example.com/bug_1
37
39
  summary: fixes all issues
38
40
 
39
- MyMultiLineNote: |
41
+ unformatted_single_line: "This is an unformatted single line"
42
+
43
+ my_multiline_note: |
40
44
  Title
41
45
 
42
46
  description
43
47
 
44
48
  Example of usage
45
49
  $ foo bar baz
46
- MyList:
50
+ my_list:
47
51
  - e.g. run this command
48
52
  - e.g. run this as well
49
53
  ```
50
54
 
51
- #### Examples
55
+ #### Usage Examples
52
56
 
53
57
  Prepend your notes to a changelog file(TODO make command simple)
58
+
54
59
  `$ renogen --format markdown v1.2.1 > CHANGELOG.md | cat - CHANGELOG > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG`
55
60
 
56
61
  Writes notes to html file
57
- `$ renogen --format html v1.2.1 > v1_2_1.html
62
+
63
+ `$ renogen --format html v1.2.1 > v1_2_1.html`
58
64
 
59
65
  Print all notes since v1.0.0 as text
60
- `$ renogen --format text -l v1.0.0 v1.2.1
66
+
67
+ `$ renogen --format text -l v1.0.0 v1.2.1`
61
68
 
62
69
  ### Configuration
63
70
 
64
- TODO
65
- `.renogen` file
66
- single line format
67
- change log directory
71
+ TODO
72
+ * How to set configuration with `.renogen` file
73
+ * How to change formatted single line
68
74
 
69
75
  ### License
70
76
 
71
77
  Renogen is a programming tool to generate a log of source code changes
78
+
72
79
  Copyright (C) 2015 David Elliott
73
80
 
74
81
  This program is free software; you can redistribute it and/or modify
@@ -1,3 +1,6 @@
1
+ # Renogen is a development tool.
2
+ # It makes it easier and faster to produce changelogs and release notes
3
+ # It works by stopping merge confics and decouping the change notes from releaes versions
1
4
  module Renogen
2
5
  require 'renogen/version'
3
6
  require 'renogen/exceptions'
@@ -1,9 +1,9 @@
1
1
  module Renogen
2
2
  # Components to represent a change log
3
3
  module ChangeLog
4
- require 'renogen/change_log/item'
5
- require 'renogen/change_log/group'
6
- require 'renogen/change_log/writer'
7
- require 'renogen/change_log/model'
4
+ require_relative 'change_log/item'
5
+ require_relative 'change_log/group'
6
+ require_relative 'change_log/writer'
7
+ require_relative 'change_log/model'
8
8
  end
9
9
  end
@@ -10,6 +10,8 @@ module Renogen
10
10
  @change = change
11
11
  end
12
12
 
13
+ # Coverts the item into its string representation
14
+ #
13
15
  # @return [String]
14
16
  def to_s
15
17
  case change.class.to_s
@@ -18,8 +20,7 @@ module Renogen
18
20
  when Hash.to_s
19
21
  format_oneline(change)
20
22
  when Array.to_s
21
- # TODO should return a string
22
- change
23
+ format_array(change)
23
24
  else
24
25
  raise TypeError
25
26
  end
@@ -30,6 +31,7 @@ module Renogen
30
31
  change.is_a? Array
31
32
  end
32
33
 
34
+ # Iterater for each item within the change
33
35
  def each
34
36
  change.each do |item|
35
37
  yield item.to_s
@@ -42,6 +44,11 @@ module Renogen
42
44
  change.gsub('\n', '\n \n ') + "\n"
43
45
  end
44
46
 
47
+ def format_array(change)
48
+ # TODO should return a string
49
+ change
50
+ end
51
+
45
52
  def format_oneline(change)
46
53
  # TODO Refactor
47
54
  string = config.single_line_format.downcase.gsub('\n', '\n ')
@@ -23,10 +23,11 @@ module Renogen
23
23
  generator.generate!
24
24
  rescue Renogen::Exceptions::Base => e
25
25
  puts e.message
26
+ exit -1
26
27
  end
27
28
  end
28
29
 
29
- # Initialize the current working directory with example change
30
+ # Initialize the current working directory with an example change
30
31
  def self.init
31
32
  Dir.mkdir('./change_log')
32
33
  puts "Created './change_log/'"
@@ -55,12 +55,12 @@ module Renogen
55
55
 
56
56
  new_version = options.shift
57
57
  if new_version.nil?
58
- puts "Missing argument: VERSION"
58
+ puts "Error: Missing argument 'VERSION'"
59
59
  puts
60
60
  puts opt_parser
61
61
  exit 1
62
62
  elsif options.count > 0
63
- puts "Unknown arguments: #{options}"
63
+ puts "Error: Unknown arguments: #{options}"
64
64
  puts
65
65
  puts opt_parser
66
66
  exit 1
@@ -7,7 +7,6 @@ module Renogen
7
7
  include Singleton
8
8
  attr_accessor :single_line_format, :input_source, :output_format, :supported_keys, :changelog_path
9
9
 
10
-
11
10
  def initialize
12
11
  config_file = load_yaml_config
13
12
  self.single_line_format = config_file['single_line_format'] || 'summary (see link)'.freeze
@@ -17,6 +16,9 @@ module Renogen
17
16
  self.changelog_path = config_file['changelog_path']
18
17
  end
19
18
 
19
+
20
+ # Renogen configuration extension
21
+ # a block can be provided to programatily setup configuration values
20
22
  def self.configure
21
23
  yield instance
22
24
  end
@@ -1,8 +1,7 @@
1
1
  module Renogen
2
- # Custom exceptions
2
+ # Custom exceptions throw by the libary
3
3
  module Exceptions
4
- require 'renogen/exceptions/base'
5
- require 'renogen/exceptions/extraction_stratagy_not_found'
6
- require 'renogen/exceptions/formatter_not_found'
4
+ require_relative 'exceptions/base'
5
+ require_relative 'exceptions/stratagy_not_found'
7
6
  end
8
7
  end
@@ -1,7 +1,7 @@
1
1
  module Renogen
2
2
  module Exceptions
3
3
  # Raised when an extraction stratagy for a given key can not be found
4
- class ExtractionStratagyNotFound < Base
4
+ class StratagyNotFound < Base
5
5
  attr_reader :missing_stratagy
6
6
 
7
7
  def initialize(type)
@@ -13,7 +13,7 @@ module Renogen
13
13
  #
14
14
  # @return [String]
15
15
  def message
16
- "Error: Unsupported source type '#{missing_stratagy}'"
16
+ "Error: Stratagy type '#{missing_stratagy}' not found"
17
17
  end
18
18
  end
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module Renogen
2
- # Contains methods for extracting release notes
2
+ # Methods for extracting release notes
3
3
  module ExtractionStratagies
4
4
 
5
5
  class << self
@@ -14,7 +14,7 @@ module Renogen
14
14
  if stratagy
15
15
  stratagy.new(options)
16
16
  else
17
- raise Renogen::Exceptions::ExtractionStratagyNotFound.new(stratagy_type)
17
+ raise Renogen::Exceptions::StratagyNotFound.new(stratagy_type)
18
18
  end
19
19
  end
20
20
 
@@ -34,8 +34,8 @@ module Renogen
34
34
  end
35
35
  end
36
36
 
37
- require'renogen/extraction_stratagies/base'
38
- require'renogen/extraction_stratagies/yaml_file'
37
+ require_relative 'extraction_stratagies/base'
38
+ require_relative 'extraction_stratagies/yaml_file'
39
39
  # require_relative 'extraction_stratagies/github'
40
40
  # require_relative 'extraction_stratagies/gitlog'
41
41
  end
@@ -2,9 +2,10 @@ module Renogen
2
2
  module ExtractionStratagies
3
3
  # module for extracting changes from YAML files
4
4
  module YamlFile
5
- require 'renogen/extraction_stratagies/yaml_file/reader'
6
- require 'renogen/extraction_stratagies/yaml_file/parser'
7
- require 'renogen/extraction_stratagies/yaml_file/provider'
5
+ require_relative 'yaml_file/reader'
6
+ require_relative 'yaml_file/parser'
7
+ require_relative 'yaml_file/provider'
8
+ require_relative 'yaml_file/exceptions'
8
9
  end
9
10
  end
10
11
  end
@@ -0,0 +1,12 @@
1
+
2
+ module Renogen
3
+ module ExtractionStratagies
4
+ module YamlFile
5
+ # Exceptions thrown by YAML file extraction stratagy
6
+ module Exceptions
7
+ require_relative 'exceptions/yaml_file_blank'
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,25 @@
1
+ module Renogen
2
+ module ExtractionStratagies
3
+ module YamlFile
4
+ module Exceptions
5
+ # This is raised when a yaml file change is found but has not contents
6
+ class YamlFileBlank < Renogen::Exceptions::Base
7
+ attr_reader :file_path
8
+
9
+ def initialize(file_path)
10
+ @file_path = file_path
11
+ super
12
+ end
13
+
14
+ # Friendly error message
15
+ #
16
+ # @return [String]
17
+ def message
18
+ "Error: File contents blank '#{file_path}'"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -13,10 +13,16 @@ module Renogen
13
13
  @directory_path ||= './change_log/'
14
14
  end
15
15
 
16
+ # Iterates thorugh each change file and yields the contents.
17
+ #
18
+ # an exception is thrown if the contents are blank
19
+ #
16
20
  # @yield [Hash] yaml_file
17
21
  def each_yaml_file
18
22
  change_directories.each do |file_path|
19
- yield ::YAML.load_file(file_path)
23
+ content = ::YAML.load_file(file_path)
24
+ raise Exceptions::YamlFileBlank.new(file_path) unless content
25
+ yield content
20
26
  end
21
27
  end
22
28
 
@@ -1,5 +1,5 @@
1
1
  module Renogen
2
- # Formatters are used to manipulate how the change is output
2
+ # Formatters to manipulate how the change is output
3
3
  #
4
4
  # Also has methods to retrive and add a formatters
5
5
  module Formatters
@@ -15,7 +15,7 @@ module Renogen
15
15
  if formatter
16
16
  formatter.new(options)
17
17
  else
18
- raise Renogen::Exceptions::FormatterNotFound.new(format_type)
18
+ raise Renogen::Exceptions::StratagyNotFound.new(format_type)
19
19
  end
20
20
  end
21
21
 
@@ -24,7 +24,7 @@ module Renogen
24
24
  # @param identifier [Symbol]
25
25
  # @param klass [Symbol]
26
26
  def add(identifier, klass)
27
- # TODO raise 'name taken' unless formatters[name].nil?
27
+ # raise 'name taken' unless formatters[name].nil?
28
28
  formatters[identifier]=klass
29
29
  end
30
30
 
@@ -36,8 +36,8 @@ module Renogen
36
36
  end
37
37
  end
38
38
 
39
- require 'renogen/formatters/base'
40
- require 'renogen/formatters/plain_text'
41
- require 'renogen/formatters/markdown'
42
- require 'renogen/formatters/html'
39
+ require_relative 'formatters/base'
40
+ require_relative 'formatters/plain_text'
41
+ require_relative 'formatters/markdown'
42
+ require_relative 'formatters/html'
43
43
  end
@@ -1,4 +1,5 @@
1
1
  module Renogen
2
+ # This is the conductor of the application
2
3
  class Generator
3
4
  attr_accessor :source, :version, :output_format, :options
4
5
 
@@ -1,3 +1,3 @@
1
1
  module Renogen
2
- VERSION='0.1.0.pre'.freeze # :nodoc:
2
+ VERSION='1.0.0'.freeze # :nodoc:
3
3
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Renogen::Exceptions::FormatterNotFound do
3
+ describe Renogen::Exceptions::StratagyNotFound do
4
4
  let(:name) { 'foobar' }
5
5
  subject { described_class.new(name) }
6
6
 
7
7
  describe '#message' do
8
8
  it 'returns friendly error message' do
9
- expect(subject.message).to eql "Error: Unsupported format type '#{name}'"
9
+ expect(subject.message).to eql "Error: Stratagy type '#{name}' not found"
10
10
  end
11
11
 
12
12
  end
@@ -1,13 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Renogen::Exceptions::ExtractionStratagyNotFound do
3
+ describe Renogen::ExtractionStratagies::YamlFile::Exceptions::YamlFileBlank do
4
4
  let(:name) { 'foobar' }
5
5
  subject { described_class.new(name) }
6
6
 
7
7
  describe '#message' do
8
8
  it 'returns friendly error message' do
9
- expect(subject.message).to eql "Error: Unsupported source type '#{name}'"
9
+ expect(subject.message).to eql "Error: File contents blank 'foobar'"
10
10
  end
11
-
12
11
  end
13
12
  end
@@ -1,9 +1,6 @@
1
1
  require 'renogen'
2
2
 
3
3
  RSpec.configure do |config|
4
- # rspec-expectations config goes here. You can use an alternate
5
- # assertion/expectation library such as wrong or the stdlib/minitest
6
- # assertions if you prefer.
7
4
  config.expect_with :rspec do |expectations|
8
5
  # This option will default to `true` in RSpec 4. It makes the `description`
9
6
  # and `failure_message` of custom matchers include text for helper methods
@@ -24,25 +21,6 @@ RSpec.configure do |config|
24
21
  mocks.verify_partial_doubles = true
25
22
  end
26
23
 
27
- # These two settings work together to allow you to limit a spec run
28
- # to individual examples or groups you care about by tagging them with
29
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
30
- # get run.
31
- # config.filter_run :focus
32
- # config.run_all_when_everything_filtered = true
33
-
34
- # Allows RSpec to persist some state between runs in order to support
35
- # the `--only-failures` and `--next-failure` CLI options. We recommend
36
- # you configure your source control system to ignore this file.
37
- # config.example_status_persistence_file_path = "spec/examples.txt"
38
-
39
- # Limits the available syntax to the non-monkey patched syntax that is
40
- # recommended. For more details, see:
41
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
42
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
43
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
44
- # config.disable_monkey_patching!
45
-
46
24
  # This setting enables warnings. It's recommended, but in some cases may
47
25
  # be too noisy due to issues in dependencies.
48
26
  config.warnings = true
@@ -57,20 +35,9 @@ RSpec.configure do |config|
57
35
  config.default_formatter = 'doc'
58
36
  end
59
37
 
60
- # Print the 10 slowest examples and example groups at the
61
- # end of the spec run, to help surface which specs are running
62
- # particularly slow.
63
- # config.profile_examples = 1
64
-
65
38
  # Run specs in random order to surface order dependencies. If you find an
66
39
  # order dependency and want to debug it, you can fix the order by providing
67
40
  # the seed, which is printed after each run.
68
41
  # --seed 1234
69
42
  config.order = :random
70
-
71
- # Seed global randomization in this process using the `--seed` CLI option.
72
- # Setting this allows you to use `--seed` to deterministically reproduce
73
- # test failures related to randomization by passing the same `--seed` value
74
- # as the one that triggered the failure.
75
- # Kernel.srand config.seed
76
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renogen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Elliott
@@ -45,11 +45,12 @@ files:
45
45
  - lib/renogen/config.rb
46
46
  - lib/renogen/exceptions.rb
47
47
  - lib/renogen/exceptions/base.rb
48
- - lib/renogen/exceptions/extraction_stratagy_not_found.rb
49
- - lib/renogen/exceptions/formatter_not_found.rb
48
+ - lib/renogen/exceptions/stratagy_not_found.rb
50
49
  - lib/renogen/extraction_stratagies.rb
51
50
  - lib/renogen/extraction_stratagies/base.rb
52
51
  - lib/renogen/extraction_stratagies/yaml_file.rb
52
+ - lib/renogen/extraction_stratagies/yaml_file/exceptions.rb
53
+ - lib/renogen/extraction_stratagies/yaml_file/exceptions/yaml_file_blank.rb
53
54
  - lib/renogen/extraction_stratagies/yaml_file/parser.rb
54
55
  - lib/renogen/extraction_stratagies/yaml_file/provider.rb
55
56
  - lib/renogen/extraction_stratagies/yaml_file/reader.rb
@@ -65,9 +66,9 @@ files:
65
66
  - spec/lib/renogen/change_log/model_spec.rb
66
67
  - spec/lib/renogen/change_log/writer_spec.rb
67
68
  - spec/lib/renogen/config_spec.rb
68
- - spec/lib/renogen/exceptions/extraction_stratagy_not_found_spec.rb
69
- - spec/lib/renogen/exceptions/formatter_not_found_spec.rb
69
+ - spec/lib/renogen/exceptions/stratagy_not_found_spec.rb
70
70
  - spec/lib/renogen/extraction_stratagies/base_spec.rb
71
+ - spec/lib/renogen/extraction_stratagies/yaml_file/exceptions/yaml_file_blank_spec.rb
71
72
  - spec/lib/renogen/extraction_stratagies/yaml_file/parser_spec.rb
72
73
  - spec/lib/renogen/extraction_stratagies/yaml_file/provider_spec.rb
73
74
  - spec/lib/renogen/extraction_stratagies/yaml_file/reader_spec.rb
@@ -92,14 +93,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
93
  version: '2.0'
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
- - - ">"
96
+ - - ">="
96
97
  - !ruby/object:Gem::Version
97
- version: 1.3.1
98
+ version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.4.5
101
+ rubygems_version: 2.4.8
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Release Notes/changelog Generator
104
105
  test_files: []
105
- has_rdoc:
@@ -1,20 +0,0 @@
1
- module Renogen
2
- module Exceptions
3
- # Raised when an extraction stratagy for a given key can not be found
4
- class FormatterNotFound < Base
5
- attr_reader :name
6
-
7
- def initialize(name)
8
- @name = name
9
- super
10
- end
11
-
12
- # Friendly error message
13
- #
14
- # @return [String]
15
- def message
16
- "Error: Unsupported format type '#{name}'"
17
- end
18
- end
19
- end
20
- end