tax_generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.inch.yml +10 -0
  4. data/.reek +10 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +72 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +154 -0
  9. data/LICENSE +20 -0
  10. data/README.md +131 -0
  11. data/Rakefile +26 -0
  12. data/bin/tax_generator +7 -0
  13. data/data/input/.gitignore +25 -0
  14. data/data/input/destinations.xml +1073 -0
  15. data/data/input/taxonomy.xml +78 -0
  16. data/data/output/.gitignore +4 -0
  17. data/init.rb +1 -0
  18. data/lib/tax_generator/all.rb +26 -0
  19. data/lib/tax_generator/application.rb +125 -0
  20. data/lib/tax_generator/classes/destination.rb +103 -0
  21. data/lib/tax_generator/classes/file_creator.rb +100 -0
  22. data/lib/tax_generator/classes/processor.rb +270 -0
  23. data/lib/tax_generator/classes/taxonomy_tree.rb +97 -0
  24. data/lib/tax_generator/cli.rb +14 -0
  25. data/lib/tax_generator/helpers/application_helper.rb +154 -0
  26. data/lib/tax_generator/version.rb +27 -0
  27. data/lib/tax_generator.rb +1 -0
  28. data/spec/lib/tax_generator/application_spec.rb +0 -0
  29. data/spec/lib/tax_generator/classes/destination_spec.rb +62 -0
  30. data/spec/lib/tax_generator/classes/file_creator_spec.rb +96 -0
  31. data/spec/lib/tax_generator/classes/processor_spec.rb +30 -0
  32. data/spec/lib/tax_generator/classes/taxonomy_tree_spec.rb +0 -0
  33. data/spec/lib/tax_generator/cli_spec.rb +0 -0
  34. data/spec/lib/tax_generator/helpers/application_helper_spec.rb +0 -0
  35. data/spec/spec_helper.rb +60 -0
  36. data/tax_generator.gemspec +40 -0
  37. data/templates/static/all.css +586 -0
  38. data/templates/template.html.erb +91 -0
  39. metadata +452 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 28287cd2175ec40ed0182000c8b035057b0e08f1
4
+ data.tar.gz: 344e5878ae0bff235afb82c56df950e6e832fc77
5
+ SHA512:
6
+ metadata.gz: 7fcdd38f4a1f402ab80780d35dc74a25225ef0236ee289975528050d011853ed9e2db577e5edbd68a8bbc32ee6205638f5c2f4569be8340a2d51b1847f796027
7
+ data.tar.gz: a3f2de16a7d7dde4c708119a886f21037d1688d94bb77e310b9539d65c1c5751121c4dcc223cec12b221f84f9a89fdf0211e221f6ccf835b7f1b823892d7e1db
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ s.rbx/
2
+ .bundle/
3
+ *.gem
4
+ .idea/
5
+ .rvmrc
6
+ *.swp
7
+ log/*.log
8
+ pkg/
9
+ spec/dummy/db/*.sqlite3
10
+ spec/dummy/log/*.log
11
+ spec/dummy/tmp/
12
+ coverage
13
+ tags
14
+ /nbproject/
15
+ /.git-rewrite/
16
+ /bin/**/*
17
+ # But not these files...
18
+
19
+
20
+ !.gitignore
21
+ !/bin/tax_generator
data/.inch.yml ADDED
@@ -0,0 +1,10 @@
1
+ files:
2
+ # define files included in the analysis (defaults to ["{app,lib}/**/*.rb"])
3
+ included:
4
+ - config/**/*.rb
5
+ - lib/**/*.rb
6
+ # define files excluded from the analysis (defaults to [])
7
+ excluded:
8
+ # you can use file paths
9
+ - vendor/**/*.*
10
+ - spec/**/*
data/.reek ADDED
@@ -0,0 +1,10 @@
1
+ ---
2
+ Attribute:
3
+ enabled: false
4
+ TooManyInstanceVariables:
5
+ enabled: false
6
+ TooManyMethods:
7
+ enabled: false
8
+ exclude_paths:
9
+ - spec
10
+ - bin
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.rubocop.yml ADDED
@@ -0,0 +1,72 @@
1
+ AllCops:
2
+ Exclude:
3
+ - tax_generator.gemspec
4
+ - bin/**/*
5
+ - vendor/**/*
6
+ - Rakefile
7
+ - spec/**/*
8
+
9
+ ClassLength:
10
+ Max: 500
11
+
12
+ Documentation:
13
+ Enabled: true
14
+
15
+ Encoding:
16
+ Enabled: false
17
+
18
+ LineLength:
19
+ Max: 200
20
+
21
+ AccessModifierIndentation:
22
+ EnforcedStyle: outdent
23
+
24
+ IfUnlessModifier:
25
+ Enabled: false
26
+
27
+ CaseIndentation:
28
+ IndentWhenRelativeTo: case
29
+ IndentOneStep: true
30
+
31
+ MethodLength:
32
+ CountComments: false
33
+ Max: 20
34
+
35
+ SignalException:
36
+ Enabled: false
37
+
38
+ ColonMethodCall:
39
+ Enabled: false
40
+
41
+ AsciiComments:
42
+ Enabled: false
43
+
44
+ RegexpLiteral:
45
+ Enabled: false
46
+
47
+ AssignmentInCondition:
48
+ Enabled: false
49
+
50
+ ParameterLists:
51
+ CountKeywordArgs: false
52
+
53
+ SingleLineBlockParams:
54
+ Methods:
55
+ - reduce:
56
+ - memo
57
+ - item
58
+
59
+ Metrics/AbcSize:
60
+ Enabled: false
61
+
62
+ Style/CollectionMethods:
63
+ Enabled: true
64
+
65
+ Style/SymbolArray:
66
+ Enabled: true
67
+
68
+ Style/ExtraSpacing:
69
+ Enabled: true
70
+
71
+ Style/FileName:
72
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,154 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tax_generator (0.0.1)
5
+ activesupport (~> 4.2, >= 4.2.5)
6
+ celluloid (~> 0.16.0, ~> 0.16)
7
+ celluloid-pmap (~> 0.2.2, ~> 0.2)
8
+ nokogiri (~> 1.6, >= 1.6.7)
9
+ rubytree (~> 0.9, >= 0.9.6)
10
+ slop (~> 4.2, >= 4.2.1)
11
+ tilt (~> 1.4, >= 1.4.1)
12
+
13
+ GEM
14
+ remote: http://rubygems.org/
15
+ specs:
16
+ abstract_type (0.0.7)
17
+ activesupport (4.2.5)
18
+ i18n (~> 0.7)
19
+ json (~> 1.7, >= 1.7.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
+ tzinfo (~> 1.1)
23
+ adamantium (0.2.0)
24
+ ice_nine (~> 0.11.0)
25
+ memoizable (~> 0.4.0)
26
+ ast (2.1.0)
27
+ astrolabe (1.3.1)
28
+ parser (~> 2.2)
29
+ axiom-types (0.1.1)
30
+ descendants_tracker (~> 0.0.4)
31
+ ice_nine (~> 0.11.0)
32
+ thread_safe (~> 0.3, >= 0.3.1)
33
+ celluloid (0.16.0)
34
+ timers (~> 4.0.0)
35
+ celluloid-pmap (0.2.2)
36
+ celluloid (>= 0.16)
37
+ codeclimate-engine-rb (0.1.0)
38
+ virtus (~> 1.0)
39
+ coercible (1.0.0)
40
+ descendants_tracker (~> 0.0.1)
41
+ colored (1.2)
42
+ concord (0.1.5)
43
+ adamantium (~> 0.2.0)
44
+ equalizer (~> 0.0.9)
45
+ descendants_tracker (0.0.4)
46
+ thread_safe (~> 0.3, >= 0.3.1)
47
+ diff-lcs (1.2.5)
48
+ docile (1.1.5)
49
+ equalizer (0.0.11)
50
+ github-markup (1.4.0)
51
+ hitimes (1.2.3)
52
+ i18n (0.7.0)
53
+ ice_nine (0.11.1)
54
+ json (1.8.3)
55
+ memoizable (0.4.2)
56
+ thread_safe (~> 0.3, >= 0.3.1)
57
+ metaclass (0.0.4)
58
+ mini_portile2 (2.0.0)
59
+ minitest (5.8.3)
60
+ mocha (1.1.0)
61
+ metaclass (~> 0.0.1)
62
+ nokogiri (1.6.7)
63
+ mini_portile2 (~> 2.0.0.rc2)
64
+ parser (2.2.3.0)
65
+ ast (>= 1.1, < 3.0)
66
+ powerpack (0.1.1)
67
+ private_attr (1.1.0)
68
+ procto (0.0.2)
69
+ rainbow (2.0.0)
70
+ rake (10.4.2)
71
+ redcarpet (3.3.3)
72
+ reek (3.7.1)
73
+ codeclimate-engine-rb (~> 0.1.0)
74
+ parser (~> 2.2, >= 2.2.2.5)
75
+ private_attr (~> 1.1)
76
+ rainbow (~> 2.0)
77
+ unparser (~> 0.2.2)
78
+ rspec (3.4.0)
79
+ rspec-core (~> 3.4.0)
80
+ rspec-expectations (~> 3.4.0)
81
+ rspec-mocks (~> 3.4.0)
82
+ rspec-core (3.4.1)
83
+ rspec-support (~> 3.4.0)
84
+ rspec-expectations (3.4.0)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.4.0)
87
+ rspec-mocks (3.4.0)
88
+ diff-lcs (>= 1.2.0, < 2.0)
89
+ rspec-support (~> 3.4.0)
90
+ rspec-support (3.4.1)
91
+ rubocop (0.35.1)
92
+ astrolabe (~> 1.3)
93
+ parser (>= 2.2.3.0, < 3.0)
94
+ powerpack (~> 0.1)
95
+ rainbow (>= 1.99.1, < 3.0)
96
+ ruby-progressbar (~> 1.7)
97
+ tins (<= 1.6.0)
98
+ ruby-progressbar (1.7.5)
99
+ rubytree (0.9.6)
100
+ json (~> 1.8)
101
+ structured_warnings (~> 0.2)
102
+ simplecov (0.11.1)
103
+ docile (~> 1.1.0)
104
+ json (~> 1.8)
105
+ simplecov-html (~> 0.10.0)
106
+ simplecov-html (0.10.0)
107
+ simplecov-summary (0.0.4)
108
+ colored
109
+ simplecov
110
+ slop (4.2.1)
111
+ structured_warnings (0.2.0)
112
+ thread_safe (0.3.5)
113
+ tilt (1.4.1)
114
+ timers (4.0.4)
115
+ hitimes
116
+ tins (1.6.0)
117
+ tzinfo (1.2.2)
118
+ thread_safe (~> 0.1)
119
+ unparser (0.2.4)
120
+ abstract_type (~> 0.0.7)
121
+ adamantium (~> 0.2.0)
122
+ concord (~> 0.1.5)
123
+ diff-lcs (~> 1.2.5)
124
+ equalizer (~> 0.0.9)
125
+ parser (~> 2.2.2)
126
+ procto (~> 0.0.2)
127
+ virtus (1.0.5)
128
+ axiom-types (~> 0.1)
129
+ coercible (~> 1.0)
130
+ descendants_tracker (~> 0.0, >= 0.0.3)
131
+ equalizer (~> 0.0, >= 0.0.9)
132
+ yard (0.8.7.6)
133
+ yard-rspec (0.1)
134
+ yard
135
+
136
+ PLATFORMS
137
+ ruby
138
+
139
+ DEPENDENCIES
140
+ github-markup (~> 1.3, >= 1.3.3)
141
+ mocha (~> 1.1, >= 1.1)
142
+ rake (>= 3.3)
143
+ redcarpet (~> 3.3, >= 3.3)
144
+ reek (~> 3.7, >= 3.7)
145
+ rspec (~> 3.3, >= 3.3)
146
+ rubocop (~> 0.33, >= 0.33)
147
+ simplecov (~> 0.10, >= 0.10)
148
+ simplecov-summary (~> 0.0.4, >= 0.0.4)
149
+ tax_generator!
150
+ yard (~> 0.8, >= 0.8.7)
151
+ yard-rspec (~> 0.1, >= 0.1)
152
+
153
+ BUNDLED WITH
154
+ 1.10.6
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 bogdanRada
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,131 @@
1
+ tax_generator
2
+ =============
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/tax_generator.svg)](http://badge.fury.io/rb/tax_generator) [![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/tax_generator?type=total)](https://github.com/bogdanRada/tax_generator)
5
+
6
+ Description
7
+ -----------
8
+
9
+ Simple batch processor that takes 2 xml files as input and generates html files with information from the xml elements.
10
+
11
+ - *taxonomy.xml* holds the information about how elements are related to each other.
12
+
13
+ - *destinations.xml* holds the actual text content for each element.
14
+
15
+ Each generated web page has:
16
+
17
+ - Element text content.
18
+
19
+ - Navigation that allows the user to browse to elements that are higher in the taxonomy
20
+
21
+ - Navigation that allows the user to browse to destinations that are lower in the taxonomy
22
+
23
+ Requirements
24
+ ------------
25
+
26
+ 1. [Ruby 1.9.x or Ruby 2.x.x](http://www.ruby-lang.org)
27
+ 2. [ActiveSuport >= 4.2.0](https://rubygems.org/gems/activesupport)
28
+ 3. [celluloid >= 0.16.0](https://github.com/celluloid/celluloid)
29
+ 4. [celluloid-pmap >= 0.2.2](https://github.com/jwo/celluloid-pmap)
30
+ 5. [nokogiri >= 1.6.7](https://github.com/sparklemotion/nokogiri)
31
+ 6. [slop >= 4.2.1](https://github.com/leejarvis/slop)
32
+ 7. [rubytree >= 0.9.6](https://github.com/evolve75/RubyTree)
33
+
34
+ Compatibility
35
+ -------------
36
+
37
+ Rails >3.0 only. MRI 1.9.x, 2.x
38
+
39
+ Installation Instructions
40
+ -------------------------
41
+
42
+ Add the following to your Gemfile :
43
+
44
+ ```ruby
45
+ gem "tax_generator"
46
+ ```
47
+
48
+ And use it like this in your code:
49
+
50
+ ```ruby
51
+ TaxGenerator::Application.new.run(options)
52
+ ```
53
+
54
+ or like this:
55
+
56
+ ```ruby
57
+ processor = TaxGenerator::Processor.new(options)
58
+ processor.work
59
+ ```
60
+
61
+ where **options** should be a hash that can contain this keys:
62
+
63
+ - input_dir
64
+ - Represents where the taxonomy and the destinations xml files are located ( Default is './data/input')
65
+ - output_dir
66
+ - Represents where the newly created html files will be located ( Default is './data/output')
67
+ - taxonomy_filename
68
+ - Represents the taxonomy file name ( Default is 'taxonomy.xml')
69
+ - destinations_filename
70
+ - Represents the destinations xml file name ( Default is 'destinations.xml')
71
+
72
+ This can also be run from command line using following command:
73
+
74
+ ```ruby
75
+ gem install tax_generator
76
+ tax_generator -i INPUT_DIR -o OUTPUT_DIR -t TAXONOMY_FILENAME -d DESTINATIONS_FILENAME
77
+ ```
78
+
79
+ Available command line options when executing a command
80
+ -------------------------------------------------------
81
+
82
+ - -i or --input_dir
83
+
84
+ - Represents where the taxonomy and the destinations xml files are located ( Default is './data/input')
85
+
86
+ - -o or --output_dir
87
+
88
+ - Represents where the newly created html files will be located ( Default is './data/output')
89
+
90
+ - -t or --taxonomy_filename
91
+
92
+ - Represents the taxonomy file name ( Default is 'taxonomy.xml')
93
+
94
+ - -d or --destinations_filename
95
+
96
+ - Represents the destinations xml file name ( Default is 'destinations.xml')
97
+
98
+ Known Limitations
99
+ -----------------
100
+
101
+ - Currently it works only if Celluloid.cores >= 2
102
+
103
+ Testing
104
+ -------
105
+
106
+ To test, do the following:
107
+
108
+ 1. cd to the gem root.
109
+ 2. bundle install
110
+ 3. bundle exec rake
111
+
112
+ Contributions
113
+ -------------
114
+
115
+ Please log all feedback/issues via [Github Issues](http://github.com/bogdanRada/tax_generator/issues). Thanks.
116
+
117
+ Contributing to tax_generator
118
+ -----------------------------
119
+
120
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
121
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
122
+ - Fork the project.
123
+ - Start a feature/bugfix branch.
124
+ - Commit and push until you are happy with your contribution.
125
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
126
+ - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
127
+ - You can read more details about contributing in the [Contributing](https://github.com/bogdanRada/tax_generator/blob/master/CONTRIBUTING.md) document
128
+
129
+ == Copyright
130
+
131
+ Copyright (c) 2015 bogdanRada. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ require 'yard'
5
+ require 'yard-rspec'
6
+
7
+ RSpec::Core::RakeTask.new(:spec) do |spec|
8
+ spec.rspec_opts = ['--backtrace '] if ENV['DEBUG']
9
+ end
10
+
11
+ YARD::Config.options[:load_plugins] = true
12
+ YARD::Config.load_plugins
13
+
14
+ YARD::Rake::YardocTask.new do |t|
15
+ t.files = ['lib/**/*.rb', 'spec/**/*_spec.rb'] # optional
16
+ t.options = ['--any', '--extra', '--opts', '--markup-provider=redcarpet', '--markup=markdown', '--debug'] # optional
17
+ t.stats_options = ['--list-undoc'] # optional
18
+ end
19
+
20
+ desc 'Default: run the unit tests.'
21
+ task default: [:all]
22
+
23
+ desc 'Test the plugin under all supported Rails versions.'
24
+ task :all do |_t|
25
+ exec('bundle exec rake spec')
26
+ end
data/bin/tax_generator ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ bin_file = Pathname.new(__FILE__).realpath
4
+ # add self to libpath
5
+ $LOAD_PATH.unshift File.expand_path('../../lib', bin_file)
6
+ require 'tax_generator/cli'
7
+ TaxGenerator::CLI.start
@@ -0,0 +1,25 @@
1
+ s.rbx/
2
+ .bundle/
3
+ *.gem
4
+ .idea/
5
+ .rvmrc
6
+ *.swp
7
+ log/*.log
8
+ pkg/
9
+ spec/dummy/db/*.sqlite3
10
+ spec/dummy/log/*.log
11
+ spec/dummy/tmp/
12
+ coverage
13
+ tags
14
+ /nbproject/
15
+ /.git-rewrite/
16
+ /bin/**/*
17
+ /data/output_*
18
+ /data/output/**/*.hss
19
+ /data/output/static/**/*
20
+ # But not these files...
21
+
22
+
23
+ !.gitignore
24
+ !/data/**/*.xml
25
+ !/bin/multi_cap