locabulary 0.6.2 → 0.7.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 +4 -4
- data/.started-issues +1 -0
- data/.travis.yml +3 -0
- data/LICENSE +201 -14
- data/data/administrative_units.json +7 -0
- data/data/affiliation.json +26 -20
- data/data/award_category.json +27 -21
- data/data/citation_style.json +17 -13
- data/data/collaborator.json +402 -301
- data/data/college.json +32 -25
- data/data/copyright.json +127 -37
- data/data/degree.json +74 -52
- data/data/organization.json +130 -97
- data/data/program_name.json +146 -94
- data/data/resource_consulted.json +211 -155
- data/data/spec.json +8 -8
- data/data/underclass_level.json +27 -21
- data/data/work_patent_strategy.json +34 -27
- data/data/work_publication_strategy.json +22 -17
- data/lib/locabulary.rb +15 -1
- data/lib/locabulary/item.rb +1 -1
- data/lib/locabulary/services.rb +4 -2
- data/lib/locabulary/services/active_items_for_service.rb +1 -1
- data/lib/locabulary/services/all_items_for_service.rb +56 -0
- data/lib/locabulary/version.rb +1 -1
- data/locabulary.gemspec +10 -9
- data/script/close-issue +22 -11
- data/script/sort_json.rb +25 -0
- data/script/start-issue +79 -27
- metadata +54 -38
data/data/spec.json
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
"predicate_name": "spec",
|
|
3
3
|
"values": [
|
|
4
4
|
{
|
|
5
|
-
"predicate_name": "spec",
|
|
6
|
-
"term_label": "Active Item",
|
|
7
|
-
"default_presentation_sequence": 3,
|
|
8
|
-
"activated_on": "2015-07-22"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"predicate_name": "spec",
|
|
12
5
|
"term_label": "Deactive Item",
|
|
6
|
+
"term_uri": "item:deactive",
|
|
13
7
|
"default_presentation_sequence": 1,
|
|
14
8
|
"activated_on": "2015-07-22",
|
|
15
9
|
"deactivated_on": "2016-07-01"
|
|
16
10
|
},
|
|
17
11
|
{
|
|
18
|
-
"predicate_name": "spec",
|
|
19
12
|
"term_label": "Alternate Item",
|
|
13
|
+
"term_uri": "item:alternate",
|
|
20
14
|
"default_presentation_sequence": 2,
|
|
21
15
|
"activated_on": "2015-07-22"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"term_label": "Active Item",
|
|
19
|
+
"term_uri": "item:active",
|
|
20
|
+
"default_presentation_sequence": 3,
|
|
21
|
+
"activated_on": "2015-07-22"
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
}
|
data/data/underclass_level.json
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"predicate_name": "underclass_level",
|
|
3
|
-
"values": [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
"values": [
|
|
4
|
+
{
|
|
5
|
+
"term_label": "First Year",
|
|
6
|
+
"default_presentation_sequence": 1,
|
|
7
|
+
"activated_on": "2015-01-01"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"term_label": "Sophomore",
|
|
11
|
+
"default_presentation_sequence": 2,
|
|
12
|
+
"activated_on": "2015-01-01"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"term_label": "Junior",
|
|
16
|
+
"default_presentation_sequence": 3,
|
|
17
|
+
"activated_on": "2015-01-01"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"term_label": "Senior",
|
|
21
|
+
"default_presentation_sequence": 4,
|
|
22
|
+
"activated_on": "2015-01-01"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"term_label": "5th Year",
|
|
26
|
+
"default_presentation_sequence": 5,
|
|
27
|
+
"activated_on": "2015-01-01"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
24
30
|
}
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"predicate_name": "work_patent_strategy",
|
|
3
|
-
"values": [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
3
|
+
"values": [
|
|
4
|
+
{
|
|
5
|
+
"term_label": "going_to_patent",
|
|
6
|
+
"default_presentation_sequence": 1,
|
|
7
|
+
"activated_on": "2015-01-01"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"term_label": "will_not_patent",
|
|
11
|
+
"default_presentation_sequence": 2,
|
|
12
|
+
"activated_on": "2015-01-01"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"term_label": "already_patented",
|
|
16
|
+
"default_presentation_sequence": 3,
|
|
17
|
+
"activated_on": "2015-01-01",
|
|
18
|
+
"deactivated_on": "2015-07-06"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"term_label": "do_not_know",
|
|
22
|
+
"default_presentation_sequence": 4,
|
|
23
|
+
"activated_on": "2015-01-01",
|
|
24
|
+
"deactivated_on": "2015-07-06"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"term_label": "non_provisional_patent_filed",
|
|
28
|
+
"default_presentation_sequence": 5,
|
|
29
|
+
"activated_on": "2015-07-06"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"term_label": "material_already_published",
|
|
33
|
+
"default_presentation_sequence": 6,
|
|
34
|
+
"activated_on": "2015-07-06"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
30
37
|
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"predicate_name": "work_publication_strategy",
|
|
3
|
-
"values": [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
"values": [
|
|
4
|
+
{
|
|
5
|
+
"term_label": "going_to_publish",
|
|
6
|
+
"default_presentation_sequence": 1,
|
|
7
|
+
"activated_on": "2015-01-01"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"term_label": "will_not_publish",
|
|
11
|
+
"default_presentation_sequence": 2,
|
|
12
|
+
"activated_on": "2015-01-01"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"term_label": "already_published",
|
|
16
|
+
"default_presentation_sequence": 3,
|
|
17
|
+
"activated_on": "2015-01-01"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"term_label": "do_not_know",
|
|
21
|
+
"default_presentation_sequence": 4,
|
|
22
|
+
"activated_on": "2015-01-01"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
20
25
|
}
|
data/lib/locabulary.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Locabulary
|
|
|
29
29
|
# @api public
|
|
30
30
|
# @since 0.1.0
|
|
31
31
|
#
|
|
32
|
-
# Responsible for extracting a non-hierarchical sorted array of Locabulary::Items::Base objects for the given predicate_name.
|
|
32
|
+
# Responsible for extracting a non-hierarchical sorted array of active Locabulary::Items::Base objects for the given predicate_name.
|
|
33
33
|
#
|
|
34
34
|
# @param [Hash] options
|
|
35
35
|
# @option options [String] :predicate_name
|
|
@@ -41,6 +41,20 @@ module Locabulary
|
|
|
41
41
|
Services.call(:active_items_for, options)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
# @api public
|
|
45
|
+
# @since 0.7.0
|
|
46
|
+
#
|
|
47
|
+
# Responsible for extracting a non-hierarchical sorted array of Locabulary::Items::Base objects for the given predicate_name.
|
|
48
|
+
#
|
|
49
|
+
# @param [Hash] options
|
|
50
|
+
# @option options [String] :predicate_name
|
|
51
|
+
# @return [Array<Locabulary::Items::Base>]
|
|
52
|
+
#
|
|
53
|
+
# @see Locabulary::Services
|
|
54
|
+
def self.all_items_for(options = {})
|
|
55
|
+
Services.call(:all_items_for, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
44
58
|
# @api public
|
|
45
59
|
# @since 0.4.0
|
|
46
60
|
#
|
data/lib/locabulary/item.rb
CHANGED
|
@@ -43,7 +43,7 @@ module Locabulary
|
|
|
43
43
|
predicate_name = options.fetch(:predicate_name)
|
|
44
44
|
possible_class_name_for_predicate_name = predicate_name.singularize.classify
|
|
45
45
|
begin
|
|
46
|
-
Items.
|
|
46
|
+
"Locabulary::Items::#{possible_class_name_for_predicate_name}".constantize
|
|
47
47
|
rescue NameError
|
|
48
48
|
Items::Base
|
|
49
49
|
end
|
data/lib/locabulary/services.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'locabulary/services/build_ordered_hierarchical_tree_service'
|
|
|
3
3
|
require 'locabulary/services/active_items_for_service'
|
|
4
4
|
require 'locabulary/services/active_hierarchical_roots_service'
|
|
5
5
|
require 'locabulary/services/item_for_service'
|
|
6
|
+
require 'locabulary/services/all_items_for_service'
|
|
6
7
|
|
|
7
8
|
# :nodoc:
|
|
8
9
|
module Locabulary
|
|
@@ -22,8 +23,9 @@ module Locabulary
|
|
|
22
23
|
# @param command_name [Symbol]
|
|
23
24
|
# @param options [Hash]
|
|
24
25
|
def self.call(command_name, options = {})
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
command_class_name = "#{command_name}_service".classify
|
|
27
|
+
klass = "Locabulary::Services::#{command_class_name}".constantize
|
|
28
|
+
klass.call(options)
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
private_constant :Services
|
|
@@ -7,7 +7,7 @@ module Locabulary
|
|
|
7
7
|
module Services
|
|
8
8
|
# @api private
|
|
9
9
|
#
|
|
10
|
-
# Responsible for extracting a non-hierarchical sorted array of Locabulary::Item for the given predicate_name
|
|
10
|
+
# Responsible for extracting a non-hierarchical sorted array of active Locabulary::Item for the given predicate_name
|
|
11
11
|
#
|
|
12
12
|
# @see Locabulary::Item
|
|
13
13
|
class ActiveItemsForService
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
require 'locabulary/item'
|
|
3
|
+
require 'locabulary/utility'
|
|
4
|
+
|
|
5
|
+
module Locabulary
|
|
6
|
+
# :nodoc:
|
|
7
|
+
module Services
|
|
8
|
+
# @api private
|
|
9
|
+
#
|
|
10
|
+
# Responsible for extracting a non-hierarchical sorted array of Locabulary::Item for the given predicate_name
|
|
11
|
+
#
|
|
12
|
+
# @see Locabulary::Item
|
|
13
|
+
class AllItemsForService
|
|
14
|
+
def self.cache
|
|
15
|
+
@cache ||= {}
|
|
16
|
+
end
|
|
17
|
+
private_class_method :cache
|
|
18
|
+
|
|
19
|
+
# @api private
|
|
20
|
+
# @since 0.7.0
|
|
21
|
+
def self.reset_cache!
|
|
22
|
+
@cache = {}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @api private
|
|
26
|
+
# @since 0.7.0
|
|
27
|
+
#
|
|
28
|
+
# @param options [Hash]
|
|
29
|
+
# @option options [String] :predicate_name
|
|
30
|
+
def self.call(options = {})
|
|
31
|
+
predicate_name = options.fetch(:predicate_name)
|
|
32
|
+
cache[predicate_name] ||= new(options).call
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private_class_method :new
|
|
36
|
+
|
|
37
|
+
def initialize(options = {})
|
|
38
|
+
@predicate_name = options.fetch(:predicate_name)
|
|
39
|
+
@builder = Item.builder_for(predicate_name: predicate_name)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def call
|
|
43
|
+
collector = []
|
|
44
|
+
Utility.with_extraction_for(predicate_name) do |data|
|
|
45
|
+
collector << builder.call(data.merge('predicate_name' => predicate_name))
|
|
46
|
+
end
|
|
47
|
+
collector.sort
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
attr_reader :predicate_name, :as_of, :builder
|
|
53
|
+
end
|
|
54
|
+
private_constant :ActiveItemsForService
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/locabulary/version.rb
CHANGED
data/locabulary.gemspec
CHANGED
|
@@ -31,14 +31,15 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_development_dependency "dry-monads", "~> 0.1.1"
|
|
32
32
|
|
|
33
33
|
spec.add_development_dependency "bundler"
|
|
34
|
-
spec.add_development_dependency "rspec"
|
|
35
|
-
spec.add_development_dependency "rspec-its"
|
|
34
|
+
spec.add_development_dependency "rspec", '3.5.0'
|
|
35
|
+
spec.add_development_dependency "rspec-its", '1.2.0'
|
|
36
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
37
|
-
spec.add_development_dependency 'google_drive'
|
|
38
|
-
spec.add_development_dependency 'highline'
|
|
39
|
-
spec.add_development_dependency "rubocop"
|
|
40
|
-
spec.add_development_dependency "simplecov"
|
|
41
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
|
42
|
-
spec.add_development_dependency "fasterer"
|
|
43
|
-
spec.add_development_dependency "shoulda-matchers"
|
|
37
|
+
spec.add_development_dependency 'google_drive', "2.1.2"
|
|
38
|
+
spec.add_development_dependency 'highline', '1.7.8'
|
|
39
|
+
spec.add_development_dependency "rubocop", '~> 0.46.0'
|
|
40
|
+
spec.add_development_dependency "simplecov", '0.12.0'
|
|
41
|
+
spec.add_development_dependency "codeclimate-test-reporter", '1.0.3'
|
|
42
|
+
spec.add_development_dependency "fasterer", '0.3.2'
|
|
43
|
+
spec.add_development_dependency "shoulda-matchers", '3.1.1'
|
|
44
|
+
spec.add_development_dependency "nokogiri", '~> 1.6.8.1'
|
|
44
45
|
end
|
data/script/close-issue
CHANGED
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
#
|
|
7
7
|
#*******************************************************************************
|
|
8
8
|
|
|
9
|
-
CONFIG_KEYS = [:
|
|
9
|
+
CONFIG_KEYS = [:REPOSITORY_PATH, :STARTED_ISSUES_FILE].freeze
|
|
10
10
|
|
|
11
11
|
REPOSITORY_PATH = ENV.fetch('REPOSITORY_PATH') { File.expand_path(File.join(File.dirname(__FILE__), '../')) }
|
|
12
|
-
REMOTE = ENV.fetch('REMOTE', 'origin')
|
|
13
12
|
|
|
14
|
-
# TODO: Retrieve the dasherized issue from Github's API
|
|
15
13
|
STARTED_ISSUES_FILE = ENV.fetch('STARTED_ISSUES_FILE', '.started-issues')
|
|
16
14
|
|
|
17
15
|
#*******************************************************************************
|
|
@@ -41,7 +39,7 @@ if ARGV.grep(/-h/i).size == 1
|
|
|
41
39
|
$stdout.puts "ENV variable."
|
|
42
40
|
$stdout.puts ""
|
|
43
41
|
$stdout.puts "Example:"
|
|
44
|
-
$stdout.puts "$
|
|
42
|
+
$stdout.puts "$ REPOSITORY_PATH=.. ./scripts/#{File.basename(__FILE__)}"
|
|
45
43
|
exit(0)
|
|
46
44
|
end
|
|
47
45
|
|
|
@@ -63,10 +61,15 @@ end
|
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
# Guard that I know what the issue number is
|
|
66
|
-
current_branch = `cd #{REPOSITORY_PATH} && git branch | grep '
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
current_branch = `cd #{REPOSITORY_PATH} && git branch | grep '^[*]'`.sub(/^\*\s*/, '').strip
|
|
65
|
+
|
|
66
|
+
issue_source = :unknown
|
|
67
|
+
if current_branch =~ /^(\w+-\d+)\D/ # jira issue
|
|
68
|
+
ISSUE_NUMBER = $1
|
|
69
|
+
issue_source = :jira
|
|
70
|
+
elsif current_branch =~ /^(\d+)\D/ # github issue
|
|
71
|
+
ISSUE_NUMBER = $1
|
|
72
|
+
issue_source = :github
|
|
70
73
|
else
|
|
71
74
|
$stderr.puts "Expected to be able to determine issue number from branch #{current_branch} name @ #{REPOSITORY_PATH}.\n\n"
|
|
72
75
|
$stderr.puts "See help for more information.\n\n"
|
|
@@ -96,7 +99,7 @@ started_issues_file_lines = File.read(File.join(REPOSITORY_PATH, STARTED_ISSUES_
|
|
|
96
99
|
|
|
97
100
|
File.open(STARTED_ISSUES_FILE, 'w+') do |file|
|
|
98
101
|
started_issues_file_lines.each do |line|
|
|
99
|
-
file.puts line unless line.
|
|
102
|
+
file.puts line unless line.strip.downcase == ISSUE_NUMBER.downcase
|
|
100
103
|
end
|
|
101
104
|
end
|
|
102
105
|
|
|
@@ -107,8 +110,10 @@ begin
|
|
|
107
110
|
File.open(path_to_commit_message, 'w+') do |file|
|
|
108
111
|
file.puts "Closing issue #{ISSUE_NUMBER}"
|
|
109
112
|
file.puts ""
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
if issue_source == :github
|
|
114
|
+
file.puts "Closes ##{ISSUE_NUMBER}"
|
|
115
|
+
file.puts ""
|
|
116
|
+
end
|
|
112
117
|
|
|
113
118
|
message = "$ ./script/#{File.basename(__FILE__)} #{ISSUE_NUMBER}"
|
|
114
119
|
CONFIG_KEYS.each_with_object(message) do |key, mem|
|
|
@@ -123,3 +128,9 @@ begin
|
|
|
123
128
|
ensure
|
|
124
129
|
File.unlink(path_to_commit_message) rescue true
|
|
125
130
|
end
|
|
131
|
+
|
|
132
|
+
# update jira and mark this issue as finished
|
|
133
|
+
if issue_source == :jira
|
|
134
|
+
system("jira transition qa #{ISSUE_NUMBER} --noedit")
|
|
135
|
+
exit!(5) unless $?.success?
|
|
136
|
+
end
|
data/script/sort_json.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
GEM_ROOT = File.expand_path('../../', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift File.join(GEM_ROOT, 'lib')
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'locabulary'
|
|
5
|
+
|
|
6
|
+
Dir.glob(File.join(GEM_ROOT, 'data/*.json')).each do |filename|
|
|
7
|
+
predicate_name = File.basename(filename, '.json')
|
|
8
|
+
next if predicate_name == 'administrative_units'
|
|
9
|
+
|
|
10
|
+
sorted_values = []
|
|
11
|
+
Locabulary.all_items_for(predicate_name: predicate_name).each do |sorted_item|
|
|
12
|
+
hash = sorted_item.to_h
|
|
13
|
+
hash.delete('predicate_name')
|
|
14
|
+
sorted_values << hash
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
json_doc = JSON.pretty_generate(
|
|
18
|
+
{
|
|
19
|
+
"predicate_name" => predicate_name,
|
|
20
|
+
"values" => sorted_values
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
File.open(filename, 'w+') { |file| file.puts(json_doc) }
|
|
25
|
+
end
|