onoma 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +11 -9
- data/bin/console +3 -3
- data/config/locales/arb.yml +6455 -4930
- data/config/locales/cmn.yml +7227 -0
- data/config/locales/deu.yml +7227 -0
- data/config/locales/eng.yml +2073 -534
- data/config/locales/fra.yml +2093 -452
- data/config/locales/ita.yml +7227 -0
- data/config/locales/jpn.yml +6412 -4887
- data/config/locales/por.yml +6261 -4736
- data/config/locales/spa.yml +6076 -4551
- data/db/migrate/20151211114316_add_beta_varieties.xml +1 -1
- data/db/migrate/20151211124757_add_allium_schoenoprasum_varieties.xml +2 -2
- data/db/migrate/20151211153218_add_zea_mays_varieties.xml +1 -1
- data/db/migrate/20151216100708_add_lifter_equipment_variants.xml +1 -1
- data/db/migrate/20151223164501_update_organic_fertilizer.xml +4 -0
- data/db/migrate/20151223171801_update_indicators.xml +4 -0
- data/db/migrate/20160104145418_add_matters.xml +14 -0
- data/db/migrate/20160104160843_change_product_nature_variants_drain.xml +4 -0
- data/db/migrate/20160105095120_add_plugin_cap_varieties.xml +261 -0
- data/db/migrate/20160106095232_add_orchard_plugin_cap_varieties.xml +405 -0
- data/db/migrate/20160108142009_add_product_nature_variants_nematicide.xml +6 -0
- data/db/migrate/20160113144856_update_prunus_avium_parent.xml +32 -0
- data/db/migrate/20160115090243_change_plant_varieties.xml +7 -0
- data/db/migrate/20160119115401_add_shipping_note_document.xml +4 -0
- data/db/migrate/20160128093149_fixes_invalid_parent.xml +102 -0
- data/db/migrate/20160128154202_add_product_natures_protective_canvas.xml +6 -0
- data/db/migrate/20160204115942_change_protective_net_nature.xml +4 -0
- data/db/migrate/20160204122030_change_cover_implanter_abilities.xml +6 -0
- data/db/migrate/20160206163031_simplifies_activity_families.xml +135 -0
- data/db/migrate/20160207142352_fix_spelling_mistakes_on_associate_accounts.xml +7 -0
- data/db/migrate/20160210124624_fix_invalid_abilities_on_product_natures.xml +5 -0
- data/db/migrate/20160224234901_add_seedling_sorting.xml +4 -0
- data/db/migrate/20160310145038_add_rhodes_grass.xml +5 -0
- data/db/migrate/20160315152217_remove_exchange_natures.xml +4 -0
- data/db/migrate/20160402125244_add_some_heavy_equipment.xml +14 -0
- data/db/migrate/20160408223901_change_zea_variety.xml +14 -0
- data/db/migrate/20160410082230_add_chemical_classifications.xml +486 -0
- data/db/migrate/20160425100840_add_product_nature_corn_topper.xml +6 -0
- data/db/migrate/20160427115742_add_production_systems.xml +9 -0
- data/db/migrate/20160428085808_add_rows_count_indicator.xml +4 -0
- data/db/migrate/20160503131928_add_equipment_indicators.xml +34 -0
- data/db/migrate/20160503155351_fix_taxes.xml +15 -0
- data/db/migrate/20160504143733_add_units.xml +6 -0
- data/db/migrate/20160509100749_change_item_corn_topper.xml +4 -0
- data/db/migrate/20160516075201_add_plant_analysis.xml +4 -0
- data/db/migrate/20160520144901_update_plant_analysis.xml +5 -0
- data/db/migrate/20160525073342_update_spreader_trailer_product_nature.xml +4 -0
- data/db/migrate/20160526075245_update_spreader_trailer_abilities.xml +4 -0
- data/db/migrate/20160526092246_update_product_natures_and_variants_for_vegetables.xml +37 -0
- data/db/migrate/20160527090330_update_product_natures_seed.xml +5 -0
- data/db/migrate/20160531071525_add_procedure_actions.xml +6 -0
- data/db/migrate/20160531094927_add_items_for_pollination_pocedure.xml +9 -0
- data/db/migrate/20160605122001_add_worker_register.xml +4 -0
- data/db/migrate/20160608075549_update_spatial_reference_systems.xml +5437 -0
- data/db/migrate/20160608202134_add_missing_procedure_actions.xml +6 -0
- data/db/migrate/20160613154204_add_product_nature_variants_hoe_weeder.xml +6 -0
- data/db/migrate/20160615121350_add_pivots_in_nomenclature.xml +11 -0
- data/db/migrate/20160615122805_add_daily_average_working_time_indicator_and_lifespan_indicators.xml +6 -0
- data/db/migrate/20160617142409_add_items_for_hay_bales.xml +8 -0
- data/db/migrate/20160622121241_add_procedure_action_conservation_plowing.xml +4 -0
- data/db/migrate/20160624073237_add_musca_varieties.xml +5 -0
- data/db/migrate/20160627095008_add_weeding_kit.xml +5 -0
- data/db/migrate/20160630075849_update_product_nature_additive.xml +4 -0
- data/db/migrate/20160630124401_fix_coop_variants.xml +9 -0
- data/db/migrate/20160719094049_add_new_procedure_actions.xml +6 -0
- data/db/migrate/20160719100836_add_issue_nature.xml +4 -0
- data/db/migrate/20160720144130_update_equipment_varieties.xml +33 -0
- data/db/migrate/20160721124220_update_product_natures_varieties.xml +58 -0
- data/db/migrate/20160725182008_fix_abilities_on_old_equipment.xml +4 -0
- data/db/migrate/20160726173309_rename_equipments_to_equipment.xml +6 -0
- data/db/migrate/20160727092830_update_malus_pumila_variety_name.xml +4 -0
- data/db/migrate/20160802123639_update_unit_name_for_equipment_product_nature_variants.xml +39 -0
- data/db/migrate/20160816083232_add_issue_natures.xml +6 -0
- data/db/migrate/20160819082951_Add_plant_varieties.xml +10 -0
- data/db/migrate/20160829072846_add_procedure_action.xml +4 -0
- data/db/migrate/20160830153251_add_new_varieties.xml +6 -0
- data/db/migrate/20160909225801_add_missing_stock_variation_accounts.xml +17 -0
- data/db/migrate/20160911091901_update_product_nature_categories.xml +53 -0
- data/db/migrate/20160912182501_fix_product_nature_categories.xml +5 -0
- data/db/migrate/20160914114043_add_tool_maintaining_support.xml +7 -0
- data/db/migrate/20160915143142_add_pest_related_indicators.xml +5 -0
- data/db/migrate/20160919210501_add_transportation_actions.xml +4 -0
- data/db/migrate/20160928113101_add_missing_general_accounts.xml +108 -0
- data/db/migrate/20160930091201_add_missing_tax_natures.xml +17 -0
- data/db/migrate/20161017090516_fix_product_nature_categories_stock_movement_account.xml +5 -0
- data/db/migrate/20161019133613_add_ednotif_eu_country_code.xml +33 -0
- data/db/migrate/20161019145441_add_ednotif_animal_indicators.xml +22 -0
- data/db/migrate/20161022103401_add_portuguese_chart_of_account.xml +34 -0
- data/db/migrate/20161024115013_add_ednotif_indicators_to_cow_product_natures.xml +7 -0
- data/db/migrate/20161030174001_add_missing_cap_2016_varieties.xml +13 -0
- data/db/migrate/20161103111303_add_plants_sorting_action.xml +4 -0
- data/db/migrate/20161202083820_add_new_plant_varieties.xml +13 -0
- data/db/migrate/20161212181852_add_procedure_categories.xml +5 -0
- data/db/migrate/20161214093347_add_procedure_actions.xml +10 -0
- data/db/migrate/20161219171601_add_missing_vat_accounts.xml +4 -0
- data/db/migrate/20161219231801_add_outgoing_payment_report.xml +4 -0
- data/db/migrate/20170104161824_add_indicators_for_plant_analysis.xml +6 -0
- data/db/migrate/20170201180806_set_animal_group_population_counting_to_unitary.xml +23 -0
- data/db/migrate/20170203132125_update_momenclature_for_animal_housing_mulching_procedure.xml +7 -0
- data/db/migrate/20170206125311_update_nomenclature_for_animal_housing_disinfection_procedure.xml +5 -0
- data/db/migrate/20170206163322_update_disinfectant_product_variant.xml +4 -0
- data/db/migrate/20170214125925_clean_cow_indicators.xml +8 -0
- data/db/migrate/20170216100144_add_algerian_vat.xml +10 -0
- data/db/migrate/20170219210901_add_fixed_asset_registry.xml +4 -0
- data/db/migrate/20170220211447_add_procedure_category.xml +4 -0
- data/db/migrate/20170220222412_add_procedure_action.xml +4 -0
- data/db/migrate/20170221102405_add_milking_robot_in_nomenclature.xml +6 -0
- data/db/migrate/20170222113119_add_animal_varieties.xml +29 -0
- data/db/migrate/20170306154901_add_missing_outstanding_account.xml +4 -0
- data/db/migrate/20170308232701_add_fr_pcga_profit_and_loss.xml +4 -0
- data/db/migrate/20170312112401_add_fr_pcga_balance_sheet.xml +4 -0
- data/db/migrate/20170312172301_add_fr_pcg82_balance_sheet.xml +5 -0
- data/db/migrate/20170320073301_add_journal_entry_sheet.xml +8 -0
- data/db/migrate/20170320144338_add_sundry_debtors_and_creditors_usage.xml +4 -0
- data/db/migrate/20170322223101_add_loan_registry.xml +4 -0
- data/db/migrate/20170324084701_add_fixed_asset_sheet.xml +4 -0
- data/db/migrate/20170328144501_add_pnt_loan_accounts.xml +5 -0
- data/db/migrate/20170328165900_update_foliar_spray_product_nature.xml +4 -0
- data/db/migrate/20170328170000_add_indicator.xml +4 -0
- data/db/migrate/20170328170100_update_product_nature_seedling.xml +6 -0
- data/db/migrate/20170328170200_add_indicators.xml +4 -0
- data/db/migrate/20170328170300_add_indicators2.xml +4 -0
- data/db/migrate/20170328170400_update_seedling_product_natures.xml +4 -0
- data/db/migrate/20170405135101_add_account_journal_entry_sheet.xml +4 -0
- data/db/migrate/20170407214236_add_portuguese_account_config.xml +4 -0
- data/db/migrate/20170524094443_add_urtica_variety.xml +5 -0
- data/db/migrate/20170614130921_add_varieties.xml +117 -0
- data/db/migrate/20170627075545_add_varieties2.xml +37 -0
- data/db/migrate/20170627081533_add_pending_deposit_payments_account_number_for_pt_accounting_system.xml +4 -0
- data/db/migrate/20170718131724_add_issue_natures.xml +54 -0
- data/db/migrate/20170803164344_add_procedure_nature_and_category.xml +5 -0
- data/db/reference.xml +7904 -939
- data/lib/onoma/database.rb +77 -32
- data/lib/onoma/item.rb +74 -24
- data/lib/onoma/migration/actions/base.rb +1 -1
- data/lib/onoma/migration/actions/item_change.rb +5 -5
- data/lib/onoma/migration/actions/item_creation.rb +4 -4
- data/lib/onoma/migration/actions/item_merging.rb +5 -1
- data/lib/onoma/migration/actions/item_removal.rb +1 -1
- data/lib/onoma/migration/actions/nomenclature_change.rb +3 -3
- data/lib/onoma/migration/actions/nomenclature_creation.rb +4 -4
- data/lib/onoma/migration/actions/nomenclature_removal.rb +3 -3
- data/lib/onoma/migration/actions/property_creation.rb +2 -2
- data/lib/onoma/migration.rb +114 -3
- data/lib/onoma/nomenclature.rb +79 -49
- data/lib/onoma/property.rb +14 -14
- data/lib/onoma/reference.rb +1 -1
- data/lib/onoma/reflection.rb +8 -3
- data/lib/onoma/relation.rb +25 -3
- data/lib/onoma/version.rb +1 -1
- data/lib/onoma.rb +31 -62
- data/onoma.gemspec +15 -15
- metadata +123 -7
- data/lib/onoma/migration/base.rb +0 -45
- data/lib/onoma/migrator/reference.rb +0 -77
- data/lib/onoma/migrator/translation.rb +0 -30
- data/lib/onoma/migrator.rb +0 -3
data/lib/onoma.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'onoma/version'
|
2
2
|
require 'nokogiri'
|
3
3
|
require 'active_support/hash_with_indifferent_access'
|
4
4
|
|
5
5
|
require 'onoma/item'
|
6
6
|
require 'onoma/migration'
|
7
|
-
require 'onoma/migrator'
|
8
7
|
require 'onoma/nomenclature'
|
9
8
|
require 'onoma/database'
|
10
9
|
require 'onoma/property'
|
@@ -14,7 +13,8 @@ require 'onoma/reflection'
|
|
14
13
|
|
15
14
|
module Onoma
|
16
15
|
XMLNS = 'http://www.ekylibre.org/XML/2013/nomenclatures'.freeze
|
17
|
-
NS_SEPARATOR = '-'
|
16
|
+
NS_SEPARATOR = '-'.freeze
|
17
|
+
PROPERTY_TYPES = %i[boolean item item_list choice choice_list string_list date decimal integer nomenclature string symbol].freeze
|
18
18
|
|
19
19
|
class MissingNomenclature < StandardError
|
20
20
|
end
|
@@ -26,11 +26,10 @@ module Onoma
|
|
26
26
|
end
|
27
27
|
|
28
28
|
class << self
|
29
|
-
|
30
29
|
def root
|
31
30
|
Pathname.new(__FILE__).dirname.dirname
|
32
31
|
end
|
33
|
-
|
32
|
+
|
34
33
|
def database_path
|
35
34
|
root.join('db')
|
36
35
|
end
|
@@ -43,91 +42,61 @@ module Onoma
|
|
43
42
|
database_path.join('reference.xml')
|
44
43
|
end
|
45
44
|
|
46
|
-
# Returns version of DB
|
47
|
-
def reference_version
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
def reference_document
|
53
|
-
f = File.open(reference_path, 'rb')
|
54
|
-
document = Nokogiri::XML(f) do |config|
|
55
|
-
config.strict.nonet.noblanks.noent
|
56
|
-
end
|
57
|
-
f.close
|
58
|
-
document
|
59
|
-
end
|
45
|
+
# # Returns version of DB
|
46
|
+
# def reference_version
|
47
|
+
# return 0 unless reference_path.exist?
|
48
|
+
# reference_document.root['version'].to_i
|
49
|
+
# end
|
60
50
|
|
61
|
-
#
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
51
|
+
# def reference_document
|
52
|
+
# f = File.open(reference_path, 'rb')
|
53
|
+
# document = Nokogiri::XML(f) do |config|
|
54
|
+
# config.strict.nonet.noblanks.noent
|
55
|
+
# end
|
56
|
+
# f.close
|
57
|
+
# document
|
58
|
+
# end
|
67
59
|
|
68
|
-
|
69
|
-
def missing_migrations
|
60
|
+
def connection
|
70
61
|
load_database unless database_loaded?
|
71
|
-
|
72
|
-
migrations.select do |m|
|
73
|
-
m.number > last_version
|
74
|
-
end
|
62
|
+
@@set
|
75
63
|
end
|
76
64
|
|
77
65
|
# Returns the names of the nomenclatures
|
78
66
|
def names
|
79
|
-
|
67
|
+
set.nomenclature_names
|
80
68
|
end
|
81
69
|
|
82
70
|
def all
|
83
|
-
|
71
|
+
set.nomenclatures
|
84
72
|
end
|
85
73
|
|
86
74
|
# Give access to named nomenclatures
|
87
|
-
|
88
|
-
@@set[name]
|
89
|
-
end
|
75
|
+
delegate :[], to: :set
|
90
76
|
|
91
77
|
# Give access to named nomenclatures
|
92
78
|
def find(*args)
|
93
79
|
options = args.extract_options!
|
94
80
|
name = args.shift
|
95
|
-
if args.
|
96
|
-
return
|
81
|
+
if args.empty?
|
82
|
+
return set[name]
|
97
83
|
elsif args.size == 1
|
98
|
-
return
|
84
|
+
return set[name].find(args.shift) if set[name]
|
99
85
|
end
|
100
|
-
|
86
|
+
nil
|
101
87
|
end
|
102
88
|
|
103
89
|
def find_or_initialize(name)
|
104
|
-
|
90
|
+
set[name] || set.load_data_from_xml(name)
|
105
91
|
end
|
106
|
-
|
92
|
+
|
107
93
|
# Browse all nomenclatures
|
108
94
|
def each(&block)
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
def load_database
|
113
|
-
if reference_path.exist?
|
114
|
-
@@set = Database.load_file(reference_path)
|
115
|
-
else
|
116
|
-
@@set = Database.new
|
117
|
-
end
|
118
|
-
@database_loaded = true
|
119
|
-
# Rails.logger.info 'Loaded nomenclatures: ' + Onoma.names.to_sentence
|
120
|
-
end
|
121
|
-
|
122
|
-
def database_loaded?
|
123
|
-
@database_loaded
|
95
|
+
set.each(&block)
|
124
96
|
end
|
125
97
|
|
126
|
-
|
127
|
-
|
128
|
-
n = name.to_s.underscore.pluralize
|
129
|
-
return self[n] if @@set.exist?(n)
|
130
|
-
super
|
98
|
+
def set
|
99
|
+
@@set ||= NomenclatureSet.new
|
131
100
|
end
|
132
101
|
end
|
133
102
|
end
|
data/onoma.gemspec
CHANGED
@@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'onoma/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'onoma'
|
8
8
|
spec.version = Onoma::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Brice TEXIER']
|
10
|
+
spec.email = ['brice@ekylibre.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'Provides open nomenclature data in a gem'
|
13
|
+
spec.description = 'Actual support Open-Nomenclature data and gem for use'
|
14
|
+
spec.homepage = 'https://github.com/ekylibre/onoma'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
spec.add_development_dependency 'colored'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'minitest'
|
26
|
+
spec.add_dependency 'activesupport'
|
27
|
+
spec.add_dependency 'nokogiri'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onoma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice TEXIER
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,8 +111,11 @@ files:
|
|
111
111
|
- bin/console
|
112
112
|
- bin/setup
|
113
113
|
- config/locales/arb.yml
|
114
|
+
- config/locales/cmn.yml
|
115
|
+
- config/locales/deu.yml
|
114
116
|
- config/locales/eng.yml
|
115
117
|
- config/locales/fra.yml
|
118
|
+
- config/locales/ita.yml
|
116
119
|
- config/locales/jpn.yml
|
117
120
|
- config/locales/por.yml
|
118
121
|
- config/locales/spa.yml
|
@@ -184,6 +187,123 @@ files:
|
|
184
187
|
- db/migrate/20151218081701_add_crops_issue_natures.xml
|
185
188
|
- db/migrate/20151222162657_add_varieties.xml
|
186
189
|
- db/migrate/20151222180021_remove_population.xml
|
190
|
+
- db/migrate/20151223164501_update_organic_fertilizer.xml
|
191
|
+
- db/migrate/20151223171801_update_indicators.xml
|
192
|
+
- db/migrate/20160104145418_add_matters.xml
|
193
|
+
- db/migrate/20160104160843_change_product_nature_variants_drain.xml
|
194
|
+
- db/migrate/20160105095120_add_plugin_cap_varieties.xml
|
195
|
+
- db/migrate/20160106095232_add_orchard_plugin_cap_varieties.xml
|
196
|
+
- db/migrate/20160108142009_add_product_nature_variants_nematicide.xml
|
197
|
+
- db/migrate/20160113144856_update_prunus_avium_parent.xml
|
198
|
+
- db/migrate/20160115090243_change_plant_varieties.xml
|
199
|
+
- db/migrate/20160119115401_add_shipping_note_document.xml
|
200
|
+
- db/migrate/20160128093149_fixes_invalid_parent.xml
|
201
|
+
- db/migrate/20160128154202_add_product_natures_protective_canvas.xml
|
202
|
+
- db/migrate/20160204115942_change_protective_net_nature.xml
|
203
|
+
- db/migrate/20160204122030_change_cover_implanter_abilities.xml
|
204
|
+
- db/migrate/20160206163031_simplifies_activity_families.xml
|
205
|
+
- db/migrate/20160207142352_fix_spelling_mistakes_on_associate_accounts.xml
|
206
|
+
- db/migrate/20160210124624_fix_invalid_abilities_on_product_natures.xml
|
207
|
+
- db/migrate/20160224234901_add_seedling_sorting.xml
|
208
|
+
- db/migrate/20160310145038_add_rhodes_grass.xml
|
209
|
+
- db/migrate/20160315152217_remove_exchange_natures.xml
|
210
|
+
- db/migrate/20160402125244_add_some_heavy_equipment.xml
|
211
|
+
- db/migrate/20160408223901_change_zea_variety.xml
|
212
|
+
- db/migrate/20160410082230_add_chemical_classifications.xml
|
213
|
+
- db/migrate/20160425100840_add_product_nature_corn_topper.xml
|
214
|
+
- db/migrate/20160427115742_add_production_systems.xml
|
215
|
+
- db/migrate/20160428085808_add_rows_count_indicator.xml
|
216
|
+
- db/migrate/20160503131928_add_equipment_indicators.xml
|
217
|
+
- db/migrate/20160503155351_fix_taxes.xml
|
218
|
+
- db/migrate/20160504143733_add_units.xml
|
219
|
+
- db/migrate/20160509100749_change_item_corn_topper.xml
|
220
|
+
- db/migrate/20160516075201_add_plant_analysis.xml
|
221
|
+
- db/migrate/20160520144901_update_plant_analysis.xml
|
222
|
+
- db/migrate/20160525073342_update_spreader_trailer_product_nature.xml
|
223
|
+
- db/migrate/20160526075245_update_spreader_trailer_abilities.xml
|
224
|
+
- db/migrate/20160526092246_update_product_natures_and_variants_for_vegetables.xml
|
225
|
+
- db/migrate/20160527090330_update_product_natures_seed.xml
|
226
|
+
- db/migrate/20160531071525_add_procedure_actions.xml
|
227
|
+
- db/migrate/20160531094927_add_items_for_pollination_pocedure.xml
|
228
|
+
- db/migrate/20160605122001_add_worker_register.xml
|
229
|
+
- db/migrate/20160608075549_update_spatial_reference_systems.xml
|
230
|
+
- db/migrate/20160608202134_add_missing_procedure_actions.xml
|
231
|
+
- db/migrate/20160613154204_add_product_nature_variants_hoe_weeder.xml
|
232
|
+
- db/migrate/20160615121350_add_pivots_in_nomenclature.xml
|
233
|
+
- db/migrate/20160615122805_add_daily_average_working_time_indicator_and_lifespan_indicators.xml
|
234
|
+
- db/migrate/20160617142409_add_items_for_hay_bales.xml
|
235
|
+
- db/migrate/20160622121241_add_procedure_action_conservation_plowing.xml
|
236
|
+
- db/migrate/20160624073237_add_musca_varieties.xml
|
237
|
+
- db/migrate/20160627095008_add_weeding_kit.xml
|
238
|
+
- db/migrate/20160630075849_update_product_nature_additive.xml
|
239
|
+
- db/migrate/20160630124401_fix_coop_variants.xml
|
240
|
+
- db/migrate/20160719094049_add_new_procedure_actions.xml
|
241
|
+
- db/migrate/20160719100836_add_issue_nature.xml
|
242
|
+
- db/migrate/20160720144130_update_equipment_varieties.xml
|
243
|
+
- db/migrate/20160721124220_update_product_natures_varieties.xml
|
244
|
+
- db/migrate/20160725182008_fix_abilities_on_old_equipment.xml
|
245
|
+
- db/migrate/20160726173309_rename_equipments_to_equipment.xml
|
246
|
+
- db/migrate/20160727092830_update_malus_pumila_variety_name.xml
|
247
|
+
- db/migrate/20160802123639_update_unit_name_for_equipment_product_nature_variants.xml
|
248
|
+
- db/migrate/20160816083232_add_issue_natures.xml
|
249
|
+
- db/migrate/20160819082951_Add_plant_varieties.xml
|
250
|
+
- db/migrate/20160829072846_add_procedure_action.xml
|
251
|
+
- db/migrate/20160830153251_add_new_varieties.xml
|
252
|
+
- db/migrate/20160909225801_add_missing_stock_variation_accounts.xml
|
253
|
+
- db/migrate/20160911091901_update_product_nature_categories.xml
|
254
|
+
- db/migrate/20160912182501_fix_product_nature_categories.xml
|
255
|
+
- db/migrate/20160914114043_add_tool_maintaining_support.xml
|
256
|
+
- db/migrate/20160915143142_add_pest_related_indicators.xml
|
257
|
+
- db/migrate/20160919210501_add_transportation_actions.xml
|
258
|
+
- db/migrate/20160928113101_add_missing_general_accounts.xml
|
259
|
+
- db/migrate/20160930091201_add_missing_tax_natures.xml
|
260
|
+
- db/migrate/20161017090516_fix_product_nature_categories_stock_movement_account.xml
|
261
|
+
- db/migrate/20161019133613_add_ednotif_eu_country_code.xml
|
262
|
+
- db/migrate/20161019145441_add_ednotif_animal_indicators.xml
|
263
|
+
- db/migrate/20161022103401_add_portuguese_chart_of_account.xml
|
264
|
+
- db/migrate/20161024115013_add_ednotif_indicators_to_cow_product_natures.xml
|
265
|
+
- db/migrate/20161030174001_add_missing_cap_2016_varieties.xml
|
266
|
+
- db/migrate/20161103111303_add_plants_sorting_action.xml
|
267
|
+
- db/migrate/20161202083820_add_new_plant_varieties.xml
|
268
|
+
- db/migrate/20161212181852_add_procedure_categories.xml
|
269
|
+
- db/migrate/20161214093347_add_procedure_actions.xml
|
270
|
+
- db/migrate/20161219171601_add_missing_vat_accounts.xml
|
271
|
+
- db/migrate/20161219231801_add_outgoing_payment_report.xml
|
272
|
+
- db/migrate/20170104161824_add_indicators_for_plant_analysis.xml
|
273
|
+
- db/migrate/20170201180806_set_animal_group_population_counting_to_unitary.xml
|
274
|
+
- db/migrate/20170203132125_update_momenclature_for_animal_housing_mulching_procedure.xml
|
275
|
+
- db/migrate/20170206125311_update_nomenclature_for_animal_housing_disinfection_procedure.xml
|
276
|
+
- db/migrate/20170206163322_update_disinfectant_product_variant.xml
|
277
|
+
- db/migrate/20170214125925_clean_cow_indicators.xml
|
278
|
+
- db/migrate/20170216100144_add_algerian_vat.xml
|
279
|
+
- db/migrate/20170219210901_add_fixed_asset_registry.xml
|
280
|
+
- db/migrate/20170220211447_add_procedure_category.xml
|
281
|
+
- db/migrate/20170220222412_add_procedure_action.xml
|
282
|
+
- db/migrate/20170221102405_add_milking_robot_in_nomenclature.xml
|
283
|
+
- db/migrate/20170222113119_add_animal_varieties.xml
|
284
|
+
- db/migrate/20170306154901_add_missing_outstanding_account.xml
|
285
|
+
- db/migrate/20170308232701_add_fr_pcga_profit_and_loss.xml
|
286
|
+
- db/migrate/20170312112401_add_fr_pcga_balance_sheet.xml
|
287
|
+
- db/migrate/20170312172301_add_fr_pcg82_balance_sheet.xml
|
288
|
+
- db/migrate/20170320073301_add_journal_entry_sheet.xml
|
289
|
+
- db/migrate/20170320144338_add_sundry_debtors_and_creditors_usage.xml
|
290
|
+
- db/migrate/20170322223101_add_loan_registry.xml
|
291
|
+
- db/migrate/20170324084701_add_fixed_asset_sheet.xml
|
292
|
+
- db/migrate/20170328144501_add_pnt_loan_accounts.xml
|
293
|
+
- db/migrate/20170328165900_update_foliar_spray_product_nature.xml
|
294
|
+
- db/migrate/20170328170000_add_indicator.xml
|
295
|
+
- db/migrate/20170328170100_update_product_nature_seedling.xml
|
296
|
+
- db/migrate/20170328170200_add_indicators.xml
|
297
|
+
- db/migrate/20170328170300_add_indicators2.xml
|
298
|
+
- db/migrate/20170328170400_update_seedling_product_natures.xml
|
299
|
+
- db/migrate/20170405135101_add_account_journal_entry_sheet.xml
|
300
|
+
- db/migrate/20170407214236_add_portuguese_account_config.xml
|
301
|
+
- db/migrate/20170524094443_add_urtica_variety.xml
|
302
|
+
- db/migrate/20170614130921_add_varieties.xml
|
303
|
+
- db/migrate/20170627075545_add_varieties2.xml
|
304
|
+
- db/migrate/20170627081533_add_pending_deposit_payments_account_number_for_pt_accounting_system.xml
|
305
|
+
- db/migrate/20170718131724_add_issue_natures.xml
|
306
|
+
- db/migrate/20170803164344_add_procedure_nature_and_category.xml
|
187
307
|
- db/reference.xml
|
188
308
|
- lib/onoma.rb
|
189
309
|
- lib/onoma/database.rb
|
@@ -199,10 +319,6 @@ files:
|
|
199
319
|
- lib/onoma/migration/actions/nomenclature_creation.rb
|
200
320
|
- lib/onoma/migration/actions/nomenclature_removal.rb
|
201
321
|
- lib/onoma/migration/actions/property_creation.rb
|
202
|
-
- lib/onoma/migration/base.rb
|
203
|
-
- lib/onoma/migrator.rb
|
204
|
-
- lib/onoma/migrator/reference.rb
|
205
|
-
- lib/onoma/migrator/translation.rb
|
206
322
|
- lib/onoma/nomenclature.rb
|
207
323
|
- lib/onoma/property.rb
|
208
324
|
- lib/onoma/reference.rb
|
@@ -230,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
346
|
version: '0'
|
231
347
|
requirements: []
|
232
348
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.
|
349
|
+
rubygems_version: 2.5.2
|
234
350
|
signing_key:
|
235
351
|
specification_version: 4
|
236
352
|
summary: Provides open nomenclature data in a gem
|
data/lib/onoma/migration/base.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
require 'active_support/core_ext/array'
|
3
|
-
|
4
|
-
module Onoma
|
5
|
-
module Migration
|
6
|
-
class Base
|
7
|
-
def self.parse(file)
|
8
|
-
f = File.open(file, 'rb')
|
9
|
-
document = Nokogiri::XML(f) do |config|
|
10
|
-
config.strict.nonet.noblanks.noent
|
11
|
-
end
|
12
|
-
f.close
|
13
|
-
root = document.root
|
14
|
-
number = file.basename.to_s.split('_').first.to_i
|
15
|
-
new(number, root['name'], root)
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :number, :name
|
19
|
-
|
20
|
-
def initialize(number, name, element = nil)
|
21
|
-
@number = number
|
22
|
-
@name = name
|
23
|
-
@actions = []
|
24
|
-
if element
|
25
|
-
element.children.each do |child|
|
26
|
-
next unless child.is_a? Nokogiri::XML::Element
|
27
|
-
@actions << "Onoma::Migration::Actions::#{child.name.underscore.classify}".constantize.new(child)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def label
|
33
|
-
"#{number} #{name}"
|
34
|
-
end
|
35
|
-
|
36
|
-
def each_action(&block)
|
37
|
-
@actions.each(&block)
|
38
|
-
end
|
39
|
-
|
40
|
-
def inspect
|
41
|
-
"#<#{self.class.name}:#{sprintf('%#x', object_id)} ##{number} #{name.inspect} (#{@actions.size} actions)>"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
module Onoma
|
2
|
-
module Migrator
|
3
|
-
class Reference
|
4
|
-
def self.run(migration)
|
5
|
-
puts ""
|
6
|
-
puts "== #{migration.label}: migrating ".ljust(80, "=")
|
7
|
-
start = Time.now
|
8
|
-
ref = new
|
9
|
-
migration.each_action do |action|
|
10
|
-
puts "-- #{action.label}"
|
11
|
-
ref.send(action.action_name, action)
|
12
|
-
end
|
13
|
-
ref.version = migration.number
|
14
|
-
ref.write
|
15
|
-
duration = (Time.now - start).round(4)
|
16
|
-
puts "== #{migration.label}: migrated (#{duration}s)".ljust(80, "=")
|
17
|
-
# puts "Write DB in #{Onoma.reference_path.relative_path_from(Onoma.root)}".yellow
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
if Onoma.reference_path.exist?
|
22
|
-
@set = Onoma::Database.load_file(Onoma.reference_path)
|
23
|
-
else
|
24
|
-
@set = Onoma::Database.new
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def version
|
29
|
-
@set.version
|
30
|
-
end
|
31
|
-
|
32
|
-
def version=(number)
|
33
|
-
@set.version = number
|
34
|
-
end
|
35
|
-
|
36
|
-
def write
|
37
|
-
File.write(Onoma.reference_path, @set.to_xml)
|
38
|
-
end
|
39
|
-
|
40
|
-
def nomenclature_creation(action)
|
41
|
-
@set.add_nomenclature(action.name, action.options)
|
42
|
-
end
|
43
|
-
|
44
|
-
def nomenclature_change(action)
|
45
|
-
@set.change_nomenclature(action.nomenclature, action.changes)
|
46
|
-
end
|
47
|
-
|
48
|
-
def nomenclature_removal(action)
|
49
|
-
@set.remove_nomenclature(action.nomenclature)
|
50
|
-
end
|
51
|
-
|
52
|
-
def property_creation(action)
|
53
|
-
@set.add_property(action.nomenclature, action.name, action.type, action.options)
|
54
|
-
end
|
55
|
-
|
56
|
-
def property_change(action)
|
57
|
-
@set.add_property(action.nomenclature, action.name, action.changes)
|
58
|
-
end
|
59
|
-
|
60
|
-
def item_creation(action)
|
61
|
-
@set.add_item(action.nomenclature, action.name, action.options)
|
62
|
-
end
|
63
|
-
|
64
|
-
def item_change(action)
|
65
|
-
@set.change_item(action.nomenclature, action.name, action.changes)
|
66
|
-
end
|
67
|
-
|
68
|
-
def item_merging(action)
|
69
|
-
@set.merge_item(action.nomenclature, action.name, action.into)
|
70
|
-
end
|
71
|
-
|
72
|
-
def item_removal(action)
|
73
|
-
@set.remove_item(action.nomenclature, action.name)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Onoma
|
2
|
-
module Migrator
|
3
|
-
class Translation
|
4
|
-
def self.run(migration)
|
5
|
-
puts "Migration #{migration.name}"
|
6
|
-
I18n.available_locales.each do |locale|
|
7
|
-
file = Onoma.root.join('config', 'locales', "#{locale}.yml")
|
8
|
-
hash = Clean::Support.yaml_to_hash(file)
|
9
|
-
migration.each_action do |action|
|
10
|
-
ref = hash[locale.to_sym][:nomenclatures]
|
11
|
-
ref[action.nomenclature.to_sym] ||= {}
|
12
|
-
ref[action.nomenclature.to_sym][:items] ||= {}
|
13
|
-
if action.is_a?(Onoma::Migration::Actions::ItemChange) && action.new_name?
|
14
|
-
ref[action.nomenclature.to_sym][:items][action.new_name.to_sym] ||= ref[action.nomenclature.to_sym][:items].delete(action.name.to_sym)
|
15
|
-
elsif action.is_a?(Onoma::Migration::Actions::ItemMerging)
|
16
|
-
ref[action.nomenclature.to_sym][:items][action.into.to_sym] ||= ref[action.nomenclature.to_sym][:items].delete(action.name.to_sym)
|
17
|
-
elsif action.is_a?(Onoma::Migration::Actions::NomenclatureChange) && action.changes[:name]
|
18
|
-
ref[action.changes[:name].to_sym] = ref.delete(action.nomenclature.to_sym)
|
19
|
-
elsif action.is_a?(Onoma::Migration::Actions::NomenclatureRemoval)
|
20
|
-
ref.delete(action.nomenclature.to_sym)
|
21
|
-
elsif !action.is_a?(Onoma::Migration::Actions::Base)
|
22
|
-
fail "Cannot handle: #{action.inspect}"
|
23
|
-
end
|
24
|
-
File.write(file, Clean::Support.hash_to_yaml(hash))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/lib/onoma/migrator.rb
DELETED