Skip to content

Commit 1aaddb3

Browse files
committed
v0.3.0 demonstration link, readme examples
1 parent ab34a02 commit 1aaddb3

File tree

4 files changed

+212
-18
lines changed

4 files changed

+212
-18
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: ruby
22
rvm:
33
- 2.2.3
4+
- 2.5.0
45
before_install:
56
- gem install bundler -v 1.10.6
67
- export TZ=Europe/Berlin

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## [0.2.0] - 2017-10-25
7+
## [v0.3.0] - 2018-03-12
8+
### Added
9+
- `meta_commit init` command
10+
- `meta_commit version` command
11+
- Column where diff starts
12+
- `whole_file_changed` flag
13+
### Changed
14+
- Configuration file is required to run command
15+
- Diff now expects changes using `ChangeContext` DTO
16+
### Removed
17+
- Default config usage from `MetaCommit::ConfigurationStore`
18+
19+
## [v0.2.0] - 2017-10-25
820
### Added
921
- Code documentation
1022
- Contribution guide

README.md

Lines changed: 197 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,42 @@
1010

1111
## Description
1212

13-
[![v0.2 demonstration](https://asciinema.org/a/svV2TBICPgp7pOWneRI30WDel.png)](https://asciinema.org/a/svV2TBICPgp7pOWneRI30WDel?autoplay=1)
13+
[![v0.3 demonstration](https://asciinema.org/a/P6kWCq2S4eOpMzEjOAKSHYmyv.png)](https://asciinema.org/a/P6kWCq2S4eOpMzEjOAKSHYmyv?autoplay=1)
1414

15-
meta commit - is set of commands for git repository, which extracts useful information from commits and allows to get more insights from usual actions with repository.
15+
[meta commit](https://usernam3.github.io/meta_commit/) - is set of commands for git repository, which extracts useful information from commits and allows to get more insights from usual actions with repository.
1616

17-
Git is universal distributed version control system and works with minimal common units which exist in any file - strings. Meta commit is utility which gives git information about content of files in repo and changes between commits on level of programming language.
17+
Git is universal distributed version control system and works with minimal common units which exist in any file - strings. Meta commit is utility which gives git information about content of repository files and changes between commits on level of programming language.
1818

19+
## What does meta_commit do ?
1920

20-
## Installing meta_commit
21+
After you read the 'Description section' you may still have question 'What does meta_commit do ?'
2122

22-
You can install gem with the following command in a terminal:
23+
The answer is - it takes diff of each commit in the repository, parse diff content using programming language parser (taken from list of extensions) and try to understand what changes commit introduced on programming language level (not lines level as git does it).
24+
25+
26+
## Installation
27+
28+
To install gem you need to run:
2329

2430
$ gem install meta_commit
2531

32+
> You may need to additionally install the cmake to install rugged (ruby bindings to libgit). It is [known issue](https://github.com/usernam3/meta_commit/issues/19).
33+
2634

2735
## Setup
2836

29-
To setup ```meta_commit``` gem for your repository you need to add configuration file to root of repo.
30-
Currently meta commit expects configuration file with name `.meta_commit.yml` of this format :
37+
To start using meta_commit, first need to add configuration file to the root of the repository.
38+
To add it, you need to run init command.
39+
40+
meta_commit init
41+
42+
Or
43+
44+
meta_commit init --extensions=ruby_support markdown_support
45+
46+
(*If you want to use [ruby](https://github.com/meta-commit/ruby_support) and [markdown](https://github.com/meta-commit/markdown_support) extensions you will need also to install them by running `gem install meta_commit_ruby_support meta_commit_markdown_support`*)
47+
48+
This command will add `.meta_commit.yml` configuration file with this contents to the repository
3149

3250
```YAML
3351
commands :
@@ -41,32 +59,195 @@ commands :
4159

4260
extensions:
4361
- ruby_support
44-
- extension2
45-
- extension3
46-
- extension4
62+
- markdown_support
4763
```
4864
49-
This config can be used to change gem behavior, currently it supports only `extensions` key.
50-
Elements of `extensions` list are gem names (without `meta_commit_` prefix) that will be loaded.
51-
[Here](https://github.com/usernam3/meta_commit/blob/master/CONTRIBUTING.md) you can get more information about how to create new extension.
65+
This config can be used to customize gem behavior, currently only `extensions` key is used.
66+
Items of `extensions` list are gem names (without `meta_commit_` prefix) that will be loaded.
67+
[Here](https://github.com/usernam3/meta_commit/blob/master/CONTRIBUTING.md#creating-new-extension) you can get more information about how to create the new extension.
5268

5369

5470
## Usage
5571

72+
Here you can see usage examples of main meta_commit commands
73+
5674
### Message
5775

5876
meta_commit message [--directory=$(pwd)]
5977

60-
Prints description of current changes in repository index
78+
Message command prints description of repository working tree staged changes.
79+
Result of execution of this command is string, that is printed to the console and which represents summary of staged changes.
80+
81+
Example :
82+
83+
```zsh
84+
> /repository_folder git diff --cached
85+
86+
diff --git a/lib/meta_commit/changelog/commands/commit_diff_examiner.rb b/lib/meta_commit/changelog/commands/commit_diff_examiner.rb
87+
index 49a8ae1..e8a2bc3 100644
88+
--- a/lib/meta_commit/changelog/commands/commit_diff_examiner.rb
89+
+++ b/lib/meta_commit/changelog/commands/commit_diff_examiner.rb
90+
@@ -8,6 +8,7 @@ module MetaCommit::Changelog
91+
@parse_command = parse_command
92+
@ast_path_factory = ast_path_factory
93+
@diff_factory = diff_factory
94+
+ @some_property = 2 + 2
95+
end
96+
97+
98+
@@ -16,7 +17,7 @@ module MetaCommit::Changelog
99+
# @param [String] left_commit commit id
100+
# @param [String] right_commit commit id
101+
# @return [Array<MetaCommit::Contracts::Diff>]
102+
- def meta(repo, left_commit, right_commit)
103+
+ def examine_meta(repo, left_commit, right_commit)
104+
diffs = []
105+
commit_id_old = left_commit.oid
106+
+ def examine_meta(repo, left_commit, right_commit)
107+
diffs = []
108+
commit_id_old = left_commit.oid
109+
commit_id_new = right_commit.oid
110+
@@ -53,6 +54,10 @@ module MetaCommit::Changelog
111+
end
112+
diffs
113+
end
114+
+
115+
+ def examine
116+
+ 'method to test'
117+
+ end
118+
end
119+
end
120+
end
121+
122+
123+
> dev/my_projects/meta_commit meta_commit message
124+
- changes in method initialize
125+
- changes in CommitDiffExaminer#examine_meta
126+
- changes in method examine
127+
```
61128

62129
### Index
63130

64131
meta_commit index [--directory=$(pwd)]
65132

66-
Walks over repository commits and writes meta information to git notes
133+
Index command walks over the repository commits and writes meta information to storage.
134+
Currently the only supported storage adapter is git notes.
135+
So after execution of index command the new git notes will be added to your repository, you will be able to see them using standard `git log` command.
136+
137+
Example :
138+
139+
```zsh
140+
> /repository_folder git log
141+
142+
commit 1a8ba80e79e7c96fc06d3daf35bbad31cdaab5a4
143+
Author: Stanislav Dobrovolskiy <[email protected]>
144+
Date: Sat Mar 3 02:44:12 2018 +0100
145+
146+
`init` command implementation #9
147+
- remove default config usage #9
148+
149+
commit 352b0b3734cc8a940f2133ac73720fc7728e59e7
150+
Author: Stanislav Dobrovolskiy <[email protected]>
151+
Date: Sun Feb 25 22:15:52 2018 +0100
152+
153+
replace double quotes from note body
154+
155+
156+
> /repository_folder meta_commit index
157+
repository successfully indexed
158+
> /repository_folder git log
159+
160+
commit 1a8ba80e79e7c96fc06d3daf35bbad31cdaab5a4
161+
Author: Stanislav Dobrovolskiy <[email protected]>
162+
Date: Sat Mar 3 02:44:12 2018 +0100
163+
164+
`init` command implementation #9
165+
- remove default config usage #9
166+
167+
Notes:
168+
- changes in method fixture_configuration_file
169+
- changes in method init
170+
- changes in method boot_container_with_config
171+
- change initialization of Errors::MissingConfigError
172+
173+
commit 352b0b3734cc8a940f2133ac73720fc7728e59e7
174+
Author: Stanislav Dobrovolskiy <[email protected]>
175+
Date: Sun Feb 25 22:15:52 2018 +0100
176+
177+
replace double quotes from note body
178+
179+
Notes:
180+
- changes in GitNotes#write_to_notes
181+
- changes in method write_to_notes
182+
```
67183
68184
### Changelog
69185
70186
meta_commit changelog [--from-tag] [--to-tag] [--directory=$(pwd)] [--filename='CHANGELOG.md']
71187
72-
Walks over commits between tags ``` from ``` and ``` to ``` and writes changes to changelog file
188+
This command walks over commits between ``` from ``` tag and ``` to ``` tag, examine changes and write them to changelog file
189+
190+
Example :
191+
192+
```zsh
193+
194+
> /repository_folder meta_commit changelog v0.2.0 v0.3.0
195+
added version [v0.3.0] to CHANGELOG.md
196+
197+
> /repository_folder cat CHANGELOG.md
198+
...
199+
200+
## [v0.3.0] - 2018-03-03
201+
### Added
202+
- add Maintainability
203+
- create class SomeServiceNEWNAME
204+
- Configuration,DataObject added to SomeModule
205+
- changes in method meta
206+
- changes in method init
207+
- changes in method version
208+
- changes in method boot_container_with_config
209+
- changes in method load_builtin_extension
210+
- changes in method create_contextual_node
211+
- changes in method collect_path_to_ast_at_line
212+
- changes in method lines?
213+
- changes in method covers_line?
214+
- changes in method create_diff
215+
- changes in method change_context
216+
- changes in method organize_lines
217+
- changes in method write_to_notes
218+
- changes in method examine_diff
219+
- changes in method index_meta
220+
- changes in method compute_column
221+
### Changed
222+
- change README.md
223+
- change Inline docs
224+
- changes in CommitDiffExaminer#meta
225+
- change initialization of Errors::MissingConfigError
226+
- changes in ContextualAstNodeFactory#create_contextual_node
227+
- changes in ContextualAstNodeFactory#covers_line?
228+
- changes in DiffFactory#create_diff
229+
- changes in GitNotes#write_to_notes
230+
- changes in DiffExaminer#examine_diff
231+
- changes in DiffIndexExaminer#index_meta
232+
### Removed
233+
- changes in method meta
234+
- changes in method boot_container_with_config
235+
- changes in method create_ast_path
236+
- changes in method get_ast_at_line
237+
- changes in method covers_line
238+
- changes in method examine_diff
239+
- changes in method index_meta
240+
- remove module Models
241+
242+
...
243+
244+
```
245+
246+
247+
## Extensions
248+
249+
Extensions are very important part of meta_commit utility, they are used to parse source files and see difference between commits.
250+
Idea is that each extension should add new capabilities and knowledge on how to work with the new file extensions.
251+
Without extensions the meta_commit is just a script which traverses git repository and read files.
252+
253+
[Here](https://github.com/usernam3/meta_commit/blob/master/CONTRIBUTING.md#creating-new-extension) you can get more information about how to create new extension.

lib/meta_commit/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MetaCommit
2-
VERSION = "0.2.0"
2+
VERSION = "0.3.0"
33
end

0 commit comments

Comments
 (0)