comparator 0.1.1
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 +11 -0
- data/.idea/workspace.xml +291 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/changelog.md +9 -0
- data/comparator.gemspec +42 -0
- data/lib/comparator.rb +7 -0
- data/lib/comparator/csv.rb +62 -0
- data/lib/comparator/version.rb +3 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2ed87d7d8e8e52bb74b6f715cdcb1b5d873eea49d38ecb3c7bfaf454207c606d
|
4
|
+
data.tar.gz: dd8dc1c5599dd6f475e0b907df34060124c955f3ef8f56f9de8007614bac708c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 139ea9f493dba34f1ecbc0a9a8daed9e007c7003dc54cea5d9e2958f28dd60c6dd57f8044a7f1ccdcd0690b552b3b3f671f7608c7c75c63f13f4c7c781f475d6
|
7
|
+
data.tar.gz: c4593fd8605cb6d217954c9039f87b5712dea0228570f33ab8c936e8f53298fddcc21d8df10803c12351def7d26e1d8b34b6a51e3db87af42d28d07e6a958566
|
data/.gitignore
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="4eafc6cf-fbbf-4975-aecc-e1777eae00d6" name="Default Changelist" comment="">
|
5
|
+
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6
|
+
<change beforePath="$PROJECT_DIR$/Gemfile.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Gemfile.lock" afterDir="false" />
|
7
|
+
<change beforePath="$PROJECT_DIR$/comparator.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/comparator.gemspec" afterDir="false" />
|
8
|
+
</list>
|
9
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
10
|
+
<option name="SHOW_DIALOG" value="false" />
|
11
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
12
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
13
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
14
|
+
</component>
|
15
|
+
<component name="FileEditorManager">
|
16
|
+
<leaf>
|
17
|
+
<file pinned="false" current-in-tab="false">
|
18
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator/csv.rb">
|
19
|
+
<provider selected="true" editor-type-id="text-editor">
|
20
|
+
<state relative-caret-position="-501">
|
21
|
+
<caret line="24" selection-start-line="24" selection-end-line="24" />
|
22
|
+
</state>
|
23
|
+
</provider>
|
24
|
+
</entry>
|
25
|
+
</file>
|
26
|
+
<file pinned="false" current-in-tab="false">
|
27
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator/version.rb">
|
28
|
+
<provider selected="true" editor-type-id="text-editor">
|
29
|
+
<state relative-caret-position="78">
|
30
|
+
<caret line="3" selection-start-line="3" selection-end-line="3" />
|
31
|
+
</state>
|
32
|
+
</provider>
|
33
|
+
</entry>
|
34
|
+
</file>
|
35
|
+
<file pinned="false" current-in-tab="true">
|
36
|
+
<entry file="file://$PROJECT_DIR$/comparator.gemspec">
|
37
|
+
<provider selected="true" editor-type-id="text-editor">
|
38
|
+
<state relative-caret-position="176">
|
39
|
+
<caret line="12" column="25" selection-start-line="12" selection-start-column="25" selection-end-line="12" selection-end-column="25" />
|
40
|
+
</state>
|
41
|
+
</provider>
|
42
|
+
</entry>
|
43
|
+
</file>
|
44
|
+
<file pinned="false" current-in-tab="false">
|
45
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
46
|
+
<provider selected="true" editor-type-id="text-editor">
|
47
|
+
<state relative-caret-position="104">
|
48
|
+
<caret line="4" column="9" selection-start-line="4" selection-start-column="9" selection-end-line="4" selection-end-column="9" />
|
49
|
+
</state>
|
50
|
+
</provider>
|
51
|
+
</entry>
|
52
|
+
</file>
|
53
|
+
<file pinned="false" current-in-tab="false">
|
54
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator.rb">
|
55
|
+
<provider selected="true" editor-type-id="text-editor">
|
56
|
+
<state relative-caret-position="26">
|
57
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
58
|
+
</state>
|
59
|
+
</provider>
|
60
|
+
</entry>
|
61
|
+
</file>
|
62
|
+
</leaf>
|
63
|
+
</component>
|
64
|
+
<component name="FindInProjectRecents">
|
65
|
+
<findStrings>
|
66
|
+
<find>test.</find>
|
67
|
+
<find>comparator-0.1.0.gem</find>
|
68
|
+
</findStrings>
|
69
|
+
</component>
|
70
|
+
<component name="Git.Settings">
|
71
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
72
|
+
</component>
|
73
|
+
<component name="IdeDocumentHistory">
|
74
|
+
<option name="CHANGED_PATHS">
|
75
|
+
<list>
|
76
|
+
<option value="$PROJECT_DIR$/lib/comparator.rb" />
|
77
|
+
<option value="$PROJECT_DIR$/Gemfile" />
|
78
|
+
<option value="$PROJECT_DIR$/changelog.md" />
|
79
|
+
<option value="$PROJECT_DIR$/.idea/workspace.xml" />
|
80
|
+
<option value="$PROJECT_DIR$/test.rb" />
|
81
|
+
<option value="$PROJECT_DIR$/lib/comparator/csv.rb" />
|
82
|
+
<option value="$PROJECT_DIR$/lib/comparator/version.rb" />
|
83
|
+
<option value="$PROJECT_DIR$/comparator.gemspec" />
|
84
|
+
</list>
|
85
|
+
</option>
|
86
|
+
</component>
|
87
|
+
<component name="ProjectConfigurationFiles">
|
88
|
+
<option name="files">
|
89
|
+
<list>
|
90
|
+
<option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
91
|
+
<option value="$PROJECT_DIR$/.idea/comparator.iml" />
|
92
|
+
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
93
|
+
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
94
|
+
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
95
|
+
</list>
|
96
|
+
</option>
|
97
|
+
</component>
|
98
|
+
<component name="ProjectFrameBounds">
|
99
|
+
<option name="y" value="23" />
|
100
|
+
<option name="width" value="1440" />
|
101
|
+
<option name="height" value="831" />
|
102
|
+
</component>
|
103
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
104
|
+
<component name="ProjectView">
|
105
|
+
<navigator proportions="" version="1">
|
106
|
+
<foldersAlwaysOnTop value="true" />
|
107
|
+
</navigator>
|
108
|
+
<panes>
|
109
|
+
<pane id="Scope" />
|
110
|
+
<pane id="ProjectPane">
|
111
|
+
<subPane>
|
112
|
+
<expand>
|
113
|
+
<path>
|
114
|
+
<item name="comparator" type="b2602c69:ProjectViewProjectNode" />
|
115
|
+
<item name="comparator" type="462c0819:PsiDirectoryNode" />
|
116
|
+
</path>
|
117
|
+
</expand>
|
118
|
+
<select />
|
119
|
+
</subPane>
|
120
|
+
</pane>
|
121
|
+
</panes>
|
122
|
+
</component>
|
123
|
+
<component name="PropertiesComponent">
|
124
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
125
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
126
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
127
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
128
|
+
</component>
|
129
|
+
<component name="RecentsManager">
|
130
|
+
<key name="CopyFile.RECENT_KEYS">
|
131
|
+
<recent name="$PROJECT_DIR$" />
|
132
|
+
</key>
|
133
|
+
<key name="MoveFile.RECENT_KEYS">
|
134
|
+
<recent name="$PROJECT_DIR$" />
|
135
|
+
</key>
|
136
|
+
</component>
|
137
|
+
<component name="RunDashboard">
|
138
|
+
<option name="ruleStates">
|
139
|
+
<list>
|
140
|
+
<RuleState>
|
141
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
142
|
+
</RuleState>
|
143
|
+
<RuleState>
|
144
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
145
|
+
</RuleState>
|
146
|
+
</list>
|
147
|
+
</option>
|
148
|
+
</component>
|
149
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
150
|
+
<component name="SvnConfiguration">
|
151
|
+
<configuration />
|
152
|
+
</component>
|
153
|
+
<component name="TaskManager">
|
154
|
+
<task active="true" id="Default" summary="Default task">
|
155
|
+
<changelist id="4eafc6cf-fbbf-4975-aecc-e1777eae00d6" name="Default Changelist" comment="" />
|
156
|
+
<created>1571576493007</created>
|
157
|
+
<option name="number" value="Default" />
|
158
|
+
<option name="presentableId" value="Default" />
|
159
|
+
<updated>1571576493007</updated>
|
160
|
+
<workItem from="1571576494480" duration="13656000" />
|
161
|
+
</task>
|
162
|
+
<servers />
|
163
|
+
</component>
|
164
|
+
<component name="TimeTrackingManager">
|
165
|
+
<option name="totallyTimeSpent" value="13656000" />
|
166
|
+
</component>
|
167
|
+
<component name="ToolWindowManager">
|
168
|
+
<frame x="0" y="23" width="1440" height="831" extended-state="0" />
|
169
|
+
<editor active="true" />
|
170
|
+
<layout>
|
171
|
+
<window_info id="Favorites" side_tool="true" />
|
172
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24964234" />
|
173
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
174
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
175
|
+
<window_info anchor="bottom" id="Database Changes" />
|
176
|
+
<window_info anchor="bottom" id="Version Control" />
|
177
|
+
<window_info anchor="bottom" id="Terminal" visible="true" weight="0.38312587" />
|
178
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
179
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
180
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
181
|
+
<window_info anchor="bottom" id="Run" order="2" weight="0.32918397" />
|
182
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
183
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
184
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
185
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
186
|
+
<window_info anchor="right" id="Database" />
|
187
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
188
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
189
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
190
|
+
</layout>
|
191
|
+
</component>
|
192
|
+
<component name="TypeScriptGeneratedFilesManager">
|
193
|
+
<option name="version" value="1" />
|
194
|
+
</component>
|
195
|
+
<component name="editorHistoryManager">
|
196
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/comparator-0.1.0/lib/comparator/csv.rb">
|
197
|
+
<provider selected="true" editor-type-id="text-editor">
|
198
|
+
<state relative-caret-position="156">
|
199
|
+
<caret line="6" column="10" lean-forward="true" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" />
|
200
|
+
</state>
|
201
|
+
</provider>
|
202
|
+
</entry>
|
203
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.6.3/lib/ruby/2.6.0/csv/fields_converter.rb">
|
204
|
+
<provider selected="true" editor-type-id="text-editor">
|
205
|
+
<state relative-caret-position="52">
|
206
|
+
<caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" />
|
207
|
+
</state>
|
208
|
+
</provider>
|
209
|
+
</entry>
|
210
|
+
<entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
|
211
|
+
<provider selected="true" editor-type-id="text-editor">
|
212
|
+
<state relative-caret-position="169">
|
213
|
+
<caret line="79" column="42" selection-start-line="79" selection-start-column="42" selection-end-line="79" selection-end-column="42" />
|
214
|
+
</state>
|
215
|
+
</provider>
|
216
|
+
</entry>
|
217
|
+
<entry file="file://$PROJECT_DIR$/changelog.md">
|
218
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
219
|
+
<state split_layout="SPLIT">
|
220
|
+
<first_editor relative-caret-position="130">
|
221
|
+
<caret line="5" column="11" selection-start-line="5" selection-start-column="11" selection-end-line="5" selection-end-column="11" />
|
222
|
+
</first_editor>
|
223
|
+
<second_editor />
|
224
|
+
</state>
|
225
|
+
</provider>
|
226
|
+
</entry>
|
227
|
+
<entry file="file://$PROJECT_DIR$/CODE_OF_CONDUCT.md">
|
228
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
229
|
+
<state split_layout="SPLIT">
|
230
|
+
<first_editor relative-caret-position="-1014" />
|
231
|
+
<second_editor />
|
232
|
+
</state>
|
233
|
+
</provider>
|
234
|
+
</entry>
|
235
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
236
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
237
|
+
<state split_layout="SPLIT">
|
238
|
+
<first_editor relative-caret-position="-726" />
|
239
|
+
<second_editor />
|
240
|
+
</state>
|
241
|
+
</provider>
|
242
|
+
</entry>
|
243
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
244
|
+
<provider selected="true" editor-type-id="text-editor">
|
245
|
+
<state relative-caret-position="104">
|
246
|
+
<caret line="4" column="9" selection-start-line="4" selection-start-column="9" selection-end-line="4" selection-end-column="9" />
|
247
|
+
</state>
|
248
|
+
</provider>
|
249
|
+
</entry>
|
250
|
+
<entry file="file://$PROJECT_DIR$/test.rb">
|
251
|
+
<provider selected="true" editor-type-id="text-editor">
|
252
|
+
<state relative-caret-position="130">
|
253
|
+
<caret line="5" column="13" lean-forward="true" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
254
|
+
</state>
|
255
|
+
</provider>
|
256
|
+
</entry>
|
257
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator.rb">
|
258
|
+
<provider selected="true" editor-type-id="text-editor">
|
259
|
+
<state relative-caret-position="26">
|
260
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
261
|
+
</state>
|
262
|
+
</provider>
|
263
|
+
</entry>
|
264
|
+
<entry file="file://$PROJECT_DIR$/comparator-0.1.0.gem">
|
265
|
+
<provider selected="true" editor-type-id="text-editor">
|
266
|
+
<state relative-caret-position="-1341" />
|
267
|
+
</provider>
|
268
|
+
</entry>
|
269
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator/csv.rb">
|
270
|
+
<provider selected="true" editor-type-id="text-editor">
|
271
|
+
<state relative-caret-position="-501">
|
272
|
+
<caret line="24" selection-start-line="24" selection-end-line="24" />
|
273
|
+
</state>
|
274
|
+
</provider>
|
275
|
+
</entry>
|
276
|
+
<entry file="file://$PROJECT_DIR$/lib/comparator/version.rb">
|
277
|
+
<provider selected="true" editor-type-id="text-editor">
|
278
|
+
<state relative-caret-position="78">
|
279
|
+
<caret line="3" selection-start-line="3" selection-end-line="3" />
|
280
|
+
</state>
|
281
|
+
</provider>
|
282
|
+
</entry>
|
283
|
+
<entry file="file://$PROJECT_DIR$/comparator.gemspec">
|
284
|
+
<provider selected="true" editor-type-id="text-editor">
|
285
|
+
<state relative-caret-position="176">
|
286
|
+
<caret line="12" column="25" selection-start-line="12" selection-start-column="25" selection-end-line="12" selection-end-column="25" />
|
287
|
+
</state>
|
288
|
+
</provider>
|
289
|
+
</entry>
|
290
|
+
</component>
|
291
|
+
</project>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
comparator (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
csv (3.1.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
rake (10.5.0)
|
12
|
+
rspec (3.9.0)
|
13
|
+
rspec-core (~> 3.9.0)
|
14
|
+
rspec-expectations (~> 3.9.0)
|
15
|
+
rspec-mocks (~> 3.9.0)
|
16
|
+
rspec-core (3.9.0)
|
17
|
+
rspec-support (~> 3.9.0)
|
18
|
+
rspec-expectations (3.9.0)
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
+
rspec-support (~> 3.9.0)
|
21
|
+
rspec-mocks (3.9.0)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.9.0)
|
24
|
+
rspec-support (3.9.0)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
bundler (~> 1.17)
|
31
|
+
comparator!
|
32
|
+
csv
|
33
|
+
rake (~> 10.0)
|
34
|
+
rspec (~> 3.0)
|
35
|
+
|
36
|
+
RUBY VERSION
|
37
|
+
ruby 2.6.3p62
|
38
|
+
|
39
|
+
BUNDLED WITH
|
40
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Gowsik
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Comparator
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/comparator`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'comparator'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install comparator
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/comparator. 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.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Comparator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/comparator/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "comparator"
|
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__)
|
data/bin/setup
ADDED
data/changelog.md
ADDED
data/comparator.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "comparator/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "comparator"
|
8
|
+
spec.version = Comparator::VERSION
|
9
|
+
spec.authors = ["Gowsik"]
|
10
|
+
spec.email = ["v.gowsik@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "It a csv comparator for now"
|
13
|
+
spec.description = "A gem that helps you to compare two csv files"
|
14
|
+
spec.homepage = "https://github.com/gowsik-ragunath/data_comparator"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#
|
22
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
# spec.metadata["source_code_uri"] = "https://github.com/gowsik-ragunath/data_comparator"
|
24
|
+
# spec.metadata["changelog_uri"] = "https://github.com/gowsik-ragunath/data_comparator/blob/master/changelog.md"
|
25
|
+
# else
|
26
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
# "public gem pushes."
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ["lib"]
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
+
end
|
data/lib/comparator.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Comparator
|
4
|
+
class CompareCSV
|
5
|
+
|
6
|
+
class CSVInitializeError < StandardError
|
7
|
+
def message
|
8
|
+
"For now you can only compare 2 files"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class CSVHeaderMissMatchError < StandardError
|
13
|
+
def message
|
14
|
+
"Header of two csv files doesn't match"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(*args)
|
19
|
+
if args.length == 2
|
20
|
+
@file_name = args
|
21
|
+
else
|
22
|
+
raise CSVInitializeError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def does_it_work?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def file_encoder(file_path)
|
31
|
+
# reference: https://stackoverflow.com/questions/5163339/write-and-read-a-file-with-utf-8-encoding
|
32
|
+
options = { headers: true }.freeze
|
33
|
+
encode_file = File.open(file_path, "r:UTF-8")
|
34
|
+
CSV.parse(encode_file, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def csv_file_comparator
|
38
|
+
fixed_file = file_encoder(@file_name[0])
|
39
|
+
comparing_file = file_encoder(@file_name[1])
|
40
|
+
difference_hash = {}
|
41
|
+
|
42
|
+
fixed_file_header = fixed_file.headers
|
43
|
+
comparing_file_header = comparing_file.headers
|
44
|
+
|
45
|
+
fixed_file_column = fixed_file.by_col
|
46
|
+
comparing_file_column = comparing_file.by_col
|
47
|
+
|
48
|
+
# check if both file has the same header
|
49
|
+
if fixed_file_header.sort == comparing_file_header.sort
|
50
|
+
# ensure header and column of both file are not swapped
|
51
|
+
zip_index = 0
|
52
|
+
fixed_file_column.zip(comparing_file_column).each do |fixed_column_data, compare_column_data|
|
53
|
+
difference_hash[fixed_file_header[zip_index]] = fixed_column_data[1].difference(compare_column_data[1])
|
54
|
+
zip_index += 1
|
55
|
+
end
|
56
|
+
else
|
57
|
+
raise CSVHeaderMissMatchError
|
58
|
+
end
|
59
|
+
difference_hash
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: comparator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gowsik
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: A gem that helps you to compare two csv files
|
56
|
+
email:
|
57
|
+
- v.gowsik@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".idea/workspace.xml"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- changelog.md
|
74
|
+
- comparator.gemspec
|
75
|
+
- lib/comparator.rb
|
76
|
+
- lib/comparator/csv.rb
|
77
|
+
- lib/comparator/version.rb
|
78
|
+
homepage: https://github.com/gowsik-ragunath/data_comparator
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.0.3
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: It a csv comparator for now
|
101
|
+
test_files: []
|