language_list 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f694a7105df99148d7a9f8a7d2a8bfceceac7a1
4
+ data.tar.gz: 7d45966d267cee5b931269a4e97e68533cf5e437
5
+ SHA512:
6
+ metadata.gz: e76121fbd53e3317ca32d4e65a39670589f115dbea52923bc9f4d9e11d912e87faa227aeb386bc3b592e01a0ada009405c8039e24a480b58ce671a5880b4527e
7
+ data.tar.gz: b2566e64c6bda74ce1f308e3113a5d11fade539a1eecbb5f84092ecbfb8fbcdb9751e3ede3df44a595e1f85ed268dea66d9d636742e4f85c35f2bf5e89b443b0
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - 2.2
4
+ - 2.1
4
5
  - 1.9.3
5
6
  - jruby-18mode
6
7
  - jruby-19mode
@@ -8,4 +9,4 @@ rvm:
8
9
  - rbx-19mode
9
10
  - 1.8.7
10
11
 
11
- script: bundle exec ./test/language_list_test.rb
12
+ script: bundle exec rake test
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in language_list.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Language List
2
2
  A list of languages based upon ISO-639-1 and ISO-639-3 with functions to retrieve only common languages.
3
3
 
4
+ [![Build Status](https://travis-ci.org/scsmith/language_list.svg?branch=master)](https://travis-ci.org/scsmith/language_list)
5
+
4
6
  ## Examples
5
7
  # Get an array of LanguageList::LanguageInfo classes
6
8
  all_languages = LanguageList::ALL_LANGUAGES
@@ -15,6 +17,10 @@ A list of languages based upon ISO-639-1 and ISO-639-3 with functions to retriev
15
17
  english.iso_639_3.inspect #=> "eng"
16
18
  english.common? #=> true
17
19
 
20
+ ## Testing
21
+
22
+ rake
23
+
18
24
  ## Thanks
19
25
  Thanks goes to Steve Hardie for his work on creating a list of common languages (http://stevehardie.com/2009/10/list-of-common-languages/).
20
26
 
data/Rakefile CHANGED
@@ -1,2 +1,19 @@
1
- require 'bundler'
1
+ require 'bundler/setup'
2
+ require 'language_list'
2
3
  Bundler::GemHelper.install_tasks
4
+
5
+ require 'rake/testtask'
6
+ Rake::TestTask.new do |t|
7
+ t.test_files = FileList['test/language_list_test.rb']
8
+ t.verbose = true
9
+ end
10
+
11
+ task :dump do
12
+ path = File.expand_path(File.join('..', 'data', 'languages.yml'), __FILE__)
13
+ data = YAML.load_file(path)
14
+ entries = data.map { |entry| LanguageList::LanguageInfo.new(entry) }
15
+ output_path = File.expand_path(File.join('..', 'data', 'dump'), __FILE__)
16
+ File.write(output_path, Marshal.dump(entries))
17
+ end
18
+
19
+ task :default => :test
data/data/dump CHANGED
Binary file
@@ -14224,6 +14224,7 @@
14224
14224
  :type: :living
14225
14225
  :scope: :individual
14226
14226
  - :name: Modern Greek (1453-)
14227
+ :common_name: Greek
14227
14228
  :iso_639_1: el
14228
14229
  :iso_639_3: ell
14229
14230
  :iso_639_2b: gre
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
+ s.add_development_dependency 'minitest', '> 5.0.0'
22
+ s.add_development_dependency 'rake'
21
23
  end
@@ -6,12 +6,17 @@ module LanguageList
6
6
 
7
7
  def initialize(options)
8
8
  @name = options[:name]
9
+ @common_name = options[:common_name]
9
10
  @iso_639_3 = options[:iso_639_3]
10
11
  @iso_639_1 = options[:iso_639_1]
11
12
  @common = options[:common]
12
13
  @type = options[:type]
13
14
  end
14
15
 
16
+ def common_name
17
+ @common_name || @name
18
+ end
19
+
15
20
  def common?
16
21
  @common
17
22
  end
@@ -1,3 +1,3 @@
1
1
  module LanguageList
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,10 +1,7 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
4
- require 'test/unit'
1
+ require 'minitest/autorun'
5
2
  require 'language_list'
6
3
 
7
- class LanguageListTest < Test::Unit::TestCase
4
+ class LanguageListTest < Minitest::Test
8
5
  def test_all_languages
9
6
  assert_equal 7707, LanguageList::ALL_LANGUAGES.length
10
7
  end
@@ -69,4 +66,14 @@ class LanguageListTest < Test::Unit::TestCase
69
66
 
70
67
  assert_equal expected, sorted.map(&:name)
71
68
  end
69
+
70
+ def test_common_name_when_present
71
+ greek = LanguageList::LanguageInfo.find('el')
72
+ assert_equal 'Greek', greek.common_name
73
+ end
74
+
75
+ def test_common_name_when_not_present
76
+ english = LanguageList::LanguageInfo.find('en')
77
+ assert_equal english.name, english.common_name
78
+ end
72
79
  end
metadata CHANGED
@@ -1,16 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: language_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steve Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-08 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
14
41
  description: A list of languages based upon ISO-639-1 and ISO-639-3 with functions
15
42
  to retrieve only common languages.
16
43
  email:
@@ -19,8 +46,8 @@ executables: []
19
46
  extensions: []
20
47
  extra_rdoc_files: []
21
48
  files:
22
- - .gitignore
23
- - .travis.yml
49
+ - ".gitignore"
50
+ - ".travis.yml"
24
51
  - Gemfile
25
52
  - README.md
26
53
  - Rakefile
@@ -34,33 +61,26 @@ files:
34
61
  - test/language_list_test.rb
35
62
  homepage: https://github.com/scsmith/language_list
36
63
  licenses: []
64
+ metadata: {}
37
65
  post_install_message:
38
66
  rdoc_options: []
39
67
  require_paths:
40
68
  - lib
41
69
  required_ruby_version: !ruby/object:Gem::Requirement
42
- none: false
43
70
  requirements:
44
- - - ! '>='
71
+ - - ">="
45
72
  - !ruby/object:Gem::Version
46
73
  version: '0'
47
- segments:
48
- - 0
49
- hash: 4409535527429711707
50
74
  required_rubygems_version: !ruby/object:Gem::Requirement
51
- none: false
52
75
  requirements:
53
- - - ! '>='
76
+ - - ">="
54
77
  - !ruby/object:Gem::Version
55
78
  version: '0'
56
- segments:
57
- - 0
58
- hash: 4409535527429711707
59
79
  requirements: []
60
80
  rubyforge_project: language_list
61
- rubygems_version: 1.8.23
81
+ rubygems_version: 2.2.2
62
82
  signing_key:
63
- specification_version: 3
83
+ specification_version: 4
64
84
  summary: A list of languages and methods to find and work with these languages.
65
85
  test_files:
66
86
  - test/benchmark.rb