onoma 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/reference.xml +12937 -0
- data/lib/onoma/nomenclature_set.rb +2 -5
- data/lib/onoma/version.rb +1 -1
- data/onoma.gemspec +1 -1
- metadata +3 -6
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -4
- data/README.md +0 -53
- data/Rakefile +0 -92
@@ -9,12 +9,9 @@ module Onoma
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def load_data_from_xml(nomenclature_name)
|
12
|
-
Rails.logger.info "Loading #{nomenclature_name}..."
|
13
|
-
start = Time.now
|
14
12
|
element = Onoma.reference_document.xpath("/xmlns:nomenclatures/xmlns:nomenclature[@name='#{nomenclature_name}']")
|
15
|
-
|
16
|
-
|
17
|
-
nomenclature
|
13
|
+
|
14
|
+
harvest_nomenclature(element)
|
18
15
|
end
|
19
16
|
|
20
17
|
def self.load_file(file)
|
data/lib/onoma/version.rb
CHANGED
data/onoma.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'https://gitlab.com/ekylibre/onoma'
|
15
15
|
spec.license = 'AGPL-3.0-only'
|
16
16
|
|
17
|
-
spec.files = Dir.glob(%w[{bin,config,lib}/**/* *.gemspec
|
17
|
+
spec.files = Dir.glob(%w[{bin,config,lib}/**/* db/reference.xml *.gemspec LICENSE.md])
|
18
18
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ekylibre developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -129,11 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- CODE_OF_CONDUCT.md
|
133
|
-
- Gemfile
|
134
132
|
- LICENSE.md
|
135
|
-
- README.md
|
136
|
-
- Rakefile
|
137
133
|
- bin/console
|
138
134
|
- bin/rake
|
139
135
|
- bin/setup
|
@@ -146,6 +142,7 @@ files:
|
|
146
142
|
- config/locales/jpn.yml
|
147
143
|
- config/locales/por.yml
|
148
144
|
- config/locales/spa.yml
|
145
|
+
- db/reference.xml
|
149
146
|
- lib/onoma.rb
|
150
147
|
- lib/onoma/item.rb
|
151
148
|
- lib/onoma/migration/actions/base.rb
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Onoma
|
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/onoma`. 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 'onoma'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install onoma
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
In your project adds the gem in your `Gemfile` and use it like example:
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
Onoma.nomenclature_names # Returns an array of all nomenclature names
|
29
|
-
n = Onoma.find(:molecules) # Returns an Onoma::Nomenclature object
|
30
|
-
n.human_name # Returns translation in current locale of the nomenclature
|
31
|
-
n.properties # Returns the array of properties of the nomenclature
|
32
|
-
|
33
|
-
n.find(:dinitrogen) # Returns an Onoma::Item object
|
34
|
-
n.human_name # Returns translation in current locale of the item
|
35
|
-
n.formula # Returns property 'formula' defined in nomenclatures for given item
|
36
|
-
|
37
|
-
```
|
38
|
-
|
39
|
-
## Development
|
40
|
-
|
41
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
42
|
-
|
43
|
-
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).
|
44
|
-
|
45
|
-
## Contributing
|
46
|
-
|
47
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/ekylibre/onoma. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
48
|
-
|
49
|
-
|
50
|
-
## License
|
51
|
-
|
52
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
53
|
-
|
data/Rakefile
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'onoma'
|
4
|
-
|
5
|
-
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs << 'test'
|
7
|
-
t.libs << 'lib'
|
8
|
-
t.test_files = FileList['test/**/*_test.rb']
|
9
|
-
end
|
10
|
-
|
11
|
-
task default: :test
|
12
|
-
|
13
|
-
namespace :db do
|
14
|
-
task :list do
|
15
|
-
Onoma.all.each do |n|
|
16
|
-
if n.name.to_s.classify.tableize != n.name.to_s
|
17
|
-
puts n.name.to_s.red
|
18
|
-
else
|
19
|
-
puts n.name
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
namespace :export do
|
25
|
-
desc 'Export nomenclatures as CSV in tmp/nomenclatures'
|
26
|
-
task :csv do
|
27
|
-
output = Onoma.root.join('tmp', 'nomenclatures')
|
28
|
-
FileUtils.rm_rf(output)
|
29
|
-
FileUtils.mkdir_p(output)
|
30
|
-
Onoma.all.each do |n|
|
31
|
-
n.to_csv(output.join("#{n.name}.csv"))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
task export: 'export:csv'
|
37
|
-
|
38
|
-
namespace :migrate do
|
39
|
-
task :generate do
|
40
|
-
unless name = ENV['NAME']
|
41
|
-
puts 'Use command with NAME: rake onoma:migrate:generate NAME=add_some_stuff'
|
42
|
-
exit 1
|
43
|
-
end
|
44
|
-
name = name.downcase.gsub(/[\s\-\_]+/, '_')
|
45
|
-
full_name = Time.zone.now.l(format: '%Y%m%d%H%M%S') + "_#{name}"
|
46
|
-
file = Onoma.root.join('db', 'migrate', "#{full_name}.xml")
|
47
|
-
found = Dir.glob(Onoma.migrations_path.join('*.xml')).detect do |file|
|
48
|
-
File.basename(file).to_s =~ /^\d+\_#{name}\.xml/
|
49
|
-
end
|
50
|
-
if found
|
51
|
-
puts "A migration with same name #{name} already exists: #{Pathname.new(found).relative_path_from(Onoma.root)}"
|
52
|
-
exit 2
|
53
|
-
end
|
54
|
-
xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
55
|
-
xml << "<migration name=\"#{name.humanize}\">\n"
|
56
|
-
xml << " <!-- Add your changes here -->\n"
|
57
|
-
xml << "</migration>\n"
|
58
|
-
File.write(file, xml)
|
59
|
-
puts "Create #{file.relative_path_from(Onoma.root).to_s.yellow}"
|
60
|
-
end
|
61
|
-
|
62
|
-
task :translation do
|
63
|
-
Onoma.missing_migrations.each do |migration|
|
64
|
-
Onoma::Migrator::Translation.run(migration)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
task :reference do
|
69
|
-
Onoma.missing_migrations.each do |migration|
|
70
|
-
Onoma::Migrator::Reference.run(migration)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
desc 'Migrates data'
|
76
|
-
task :migrate do
|
77
|
-
I18n.available_locales = %i[arb cmn deu eng fra ita jpn por spa]
|
78
|
-
|
79
|
-
Onoma::load_locales
|
80
|
-
Onoma::Migrator.migrate
|
81
|
-
end
|
82
|
-
|
83
|
-
# task migrate: 'migrate:reference'
|
84
|
-
# task :migrate do
|
85
|
-
# Onoma.missing_migrations.each do |migration|
|
86
|
-
# puts migration.name.yellow
|
87
|
-
# Onoma::Migrator::Reference.run(migration)
|
88
|
-
# Onoma::Migrator::Model.run(migration)
|
89
|
-
# Onoma::Migrator::Translation.run(migration)
|
90
|
-
# end
|
91
|
-
# end
|
92
|
-
end
|