xml_file_renamer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +54 -0
- data/example_building_589989.xml +61 -0
- data/lib/xml_file_renamer.rb +0 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc84a1211218226b1296e9bd872939eb716ed83
|
4
|
+
data.tar.gz: 4133687863c2c5615e0f1854992dd33e6fa72e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992281d1f7ab5c08828af39ccc981b5331f7fe98a80a12f7a3c6b82741eeac263eff42d252260a4871ab631e93a2ee193d1e90ca84c6bcd8f23f357a000b3568
|
7
|
+
data.tar.gz: 77333eac047b795b1f7173be3478cd1f5dfd469bdee3de587c027d1d06c59ddbcd536ca2832d149c725f9da5e5d9965800bb82634477c5fcf460d19200d58743
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Mike Taylor
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#xml_file_renamer
|
2
|
+
|
3
|
+
This is a Ruby class that allows you to rename your XML files based on content inside the file.
|
4
|
+
|
5
|
+
|
6
|
+
##Use Case Scenario:
|
7
|
+
|
8
|
+
####You have multiple files named like:
|
9
|
+
|
10
|
+
building_589989.xml, building_589990.xml, building_589991.xml
|
11
|
+
|
12
|
+
####You want the files to be named:
|
13
|
+
|
14
|
+
Columbia Tower.xml, Space Needle.xml, Premiere on Pine.xml
|
15
|
+
|
16
|
+
####Where `"Columbia Tower"` is a text node, that you can locate with a CSS selector:
|
17
|
+
|
18
|
+
'building Contact alt_building_name'
|
19
|
+
|
20
|
+
|
21
|
+
##Solution:
|
22
|
+
|
23
|
+
###Run the script:
|
24
|
+
|
25
|
+
$ xml_file_renamer '<source_data>' '<css_selector>'
|
26
|
+
|
27
|
+
###Example:
|
28
|
+
|
29
|
+
$ xml_file_renamer
|
30
|
+
'/Users/sealocal/Documents/world_buildings/building_589989.xml' \
|
31
|
+
'building Contact alt_building_name'
|
32
|
+
|
33
|
+
###Output:
|
34
|
+
|
35
|
+
**** Origin Directory: /Users/sealocal/Documents/world_buildings
|
36
|
+
**** Export Directory: /Users/sealocal/Documents/world_buildings/export_folder
|
37
|
+
**** CSS selector: building Contact alt_building_name
|
38
|
+
**** Source File: example_building_589989.xml
|
39
|
+
**** New File Name: Columbia Tower
|
40
|
+
|
41
|
+
|
42
|
+
####Notes:
|
43
|
+
|
44
|
+
1. <source_data> must contain an XML tree.
|
45
|
+
|
46
|
+
2. <source_data> can have ANY file extension, as long as it HAS a file extension.
|
47
|
+
|
48
|
+
3. <source_data> can be a relative or absolute path to an XML file.
|
49
|
+
|
50
|
+
4. The output will be saved to an `export_folder`, until this project is otherwise updated.
|
51
|
+
|
52
|
+
|
53
|
+
##Contribute:
|
54
|
+
Please STAR, [FORK](https://github.com/sealocal/xml_file_renamer/fork), or create a new [ISSUE](https://github.com/sealocal/xml_file_renamer/issues/new) if you would like to see this project developed further. We can even rename the project when appropriate!
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
2
|
+
<building>
|
3
|
+
<mls_id>589989</mls_id>
|
4
|
+
<Contact>
|
5
|
+
<location>
|
6
|
+
<street>701 5th Ave # 7500</street>
|
7
|
+
<city>Seattle</city>
|
8
|
+
<county>King</countY>
|
9
|
+
<state>WA</state>
|
10
|
+
<ZIP>98104</ZIP>
|
11
|
+
<country>United States</country>
|
12
|
+
</location>
|
13
|
+
<building_name>
|
14
|
+
Columbia Center
|
15
|
+
</building_name>
|
16
|
+
<alt_building_name>
|
17
|
+
Columbia Tower<
|
18
|
+
</alt_building_name>
|
19
|
+
<phone_number>206-622-2010</phone_number>
|
20
|
+
</Contact>
|
21
|
+
<Type>Commercial offices</Type>
|
22
|
+
<Coordinates>
|
23
|
+
<lat>47.60453°N</lat>
|
24
|
+
<long>122.33069°W</long>
|
25
|
+
</Coordinates>
|
26
|
+
<Construction>
|
27
|
+
<start>1971</start>
|
28
|
+
<complete>January 12, 1980</complete>
|
29
|
+
</Construction>
|
30
|
+
<Opening>March 2, 1982</Opening>
|
31
|
+
<Cost>US$ 76 million</Cost>
|
32
|
+
<Owner>Beacon Capital</Owner>
|
33
|
+
<Height>
|
34
|
+
<architectural>
|
35
|
+
<metric>294.8m</metric>
|
36
|
+
<english>(967 ft)</english>
|
37
|
+
</architectural>
|
38
|
+
<architectural>
|
39
|
+
<metric>294.8m</metric>
|
40
|
+
<english>967 ft</english>
|
41
|
+
</architectural>
|
42
|
+
<roof>
|
43
|
+
<metric>284.2m</metric>
|
44
|
+
<english>932 ft</english>
|
45
|
+
</roof>
|
46
|
+
<observatory>
|
47
|
+
<metric>275m</metric>
|
48
|
+
<english>902 ft</english>
|
49
|
+
</observatory>
|
50
|
+
<floor_count>70</floor_count>
|
51
|
+
</Height>
|
52
|
+
<Design_and_Construction>
|
53
|
+
<architect>Chester Lindsey Architects</architect>
|
54
|
+
<developer>Martin Selig</developer>
|
55
|
+
<structural_engineer>
|
56
|
+
Magnusson Klemencic Associates (formerly Skilling Helle Christiansen Robertson)
|
57
|
+
</structural_engineer>
|
58
|
+
<main_contractor>Howard S. Wright Construction</main_contractor>
|
59
|
+
</Design_and_Construction>
|
60
|
+
<source>http://en.wikipedia.org/wiki/Columbia_Center</source>
|
61
|
+
</building>
|
data/lib/xml_file_renamer.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_file_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Taylor
|
@@ -31,7 +31,10 @@ executables:
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
34
36
|
- bin/xml_file_renamer
|
37
|
+
- example_building_589989.xml
|
35
38
|
- lib/xml_file_renamer.rb
|
36
39
|
homepage: https://github.com/sealocal/xml_file_renamer
|
37
40
|
licenses:
|