multidiff 0.0.1 → 0.1.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 +4 -4
- data/.travis.yml +5 -0
- data/README.md +18 -4
- data/lib/multidiff/differ.rb +6 -2
- data/lib/multidiff/runner.rb +1 -1
- data/lib/multidiff/version.rb +1 -1
- data/multidiff.gemspec +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d812370c102a82aedd3ae30a6c1102f29391f8bd
|
4
|
+
data.tar.gz: 4120193fd2c2d1bbb844bea137b3225a0579302f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff5c2c6113b1ba3d9f32e97e91f3d30ad4ad5aa2187eec64c9ba489b3fc2606e72fd624d863e41f502f8d1ac01e2b6df4d3aef313b5abee944760c74f7da1ff4
|
7
|
+
data.tar.gz: 5d65cb4cda0747750babc4605b818061c7cfd62241ab614d0ae6514c48237d5ea7bc542354b9eef193ae32ddcb764b1052305f066cadddd5390d4e954c55fe63
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[](https://badge.fury.io/rb/multidiff)
|
1
2
|
[](https://travis-ci.org/mpugach/multidiff)
|
2
3
|
[](https://codeclimate.com/github/mpugach/multidiff)
|
3
4
|
[](https://codeclimate.com/github/mpugach/multidiff/coverage)
|
@@ -12,7 +13,7 @@ A simple wrapper for the [diff-lcs](https://github.com/halostatue/diff-lcs) to c
|
|
12
13
|
Add this line to your application's Gemfile:
|
13
14
|
|
14
15
|
```ruby
|
15
|
-
gem 'multidiff', github: 'mpugach/multidiff', tag: '0.0
|
16
|
+
gem 'multidiff', github: 'mpugach/multidiff', tag: '0.1.0'
|
16
17
|
```
|
17
18
|
|
18
19
|
And then execute:
|
@@ -25,17 +26,30 @@ Or install it yourself as:
|
|
25
26
|
|
26
27
|
## Usage
|
27
28
|
|
28
|
-
|
29
|
+
Run from command line
|
30
|
+
|
31
|
+
$ multidiff path/to/file_1.txt path/to/file_2.txt [path/to/file_3.txt ...]
|
32
|
+
|
33
|
+
Or from your app
|
34
|
+
|
35
|
+
require 'multidiff'
|
36
|
+
|
37
|
+
# To return Diff::LCS objects
|
38
|
+
Multidiff::Differ.diff([array_of_strings_1, array_of_strings_2, ...])
|
39
|
+
|
40
|
+
# To return array of strings
|
41
|
+
Multidiff::Differ.pretty_diff([array_of_strings_1, array_of_strings_2, ...])
|
42
|
+
|
29
43
|
|
30
44
|
## Development
|
31
45
|
|
32
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
46
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
47
|
|
34
48
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
35
49
|
|
36
50
|
## Contributing
|
37
51
|
|
38
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mpugach/multidiff. 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.
|
39
53
|
|
40
54
|
|
41
55
|
## License
|
data/lib/multidiff/differ.rb
CHANGED
@@ -7,8 +7,12 @@ module Multidiff
|
|
7
7
|
def self.diff(files)
|
8
8
|
base = files.shift
|
9
9
|
|
10
|
-
files.map
|
11
|
-
|
10
|
+
files.map { |file| Diff::LCS.sdiff(base, file) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.pretty_diff(files)
|
14
|
+
diff(files).map do |changes|
|
15
|
+
changes.each_with_index.map do |change, line|
|
12
16
|
text = if change.action == '!'
|
13
17
|
"#{change.old_element}|#{change.new_element}"
|
14
18
|
else
|
data/lib/multidiff/runner.rb
CHANGED
data/lib/multidiff/version.rb
CHANGED
data/multidiff.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
+
spec.required_ruby_version = '>= 2.1.0'
|
22
|
+
|
21
23
|
spec.add_dependency 'diff-lcs', '~> 1.2'
|
22
24
|
|
23
25
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multidiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maksym Pugach
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
151
|
+
version: 2.1.0
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
154
|
- - ">="
|