namxam-carmen 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ doc
2
+ pkg
3
+ tags
4
+ tmp
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2009 Jim Benton
2
+ View helpers based on code (c) 2008 Michael Koziarski (http://github.com/rails/country_select/tree/master)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,59 @@
1
+ = Carmen- A simple collection of geographic names and abbreviations for Ruby
2
+
3
+ This library will work as a drop in replacement for the official Rails country_select and its various forks. The idea is to provide a single library for all geographic naming concerns, and unify them under a consistent API.
4
+
5
+ States are supported for the following countries: Australia, Brazil, Canada, Cuba, Denmark, Germany, Italy, Mexico, Spain, Ukraine, and United States.
6
+
7
+ == Installation
8
+
9
+ gem install carmen
10
+
11
+ If you're in Rails:
12
+
13
+ config.gem 'carmen', :source => 'http://gemcutter.org'
14
+
15
+ Or as a plugin:
16
+
17
+ script/plugin install git://github.com/jim/carmen
18
+
19
+ == State list retrieval
20
+
21
+ Carmen::states('US') => [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ]
22
+ Carmen::states => [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ] # uses default country
23
+ Carmen::state_names('US') => ['Alabama', 'Arkansas', ... ]
24
+ Carmen::state_codes('US') => ['AL', 'AR', ... ]
25
+
26
+ == Abbreviation handling
27
+
28
+ Carmen::country_name('US') => 'United States'
29
+ Carmen::country_code('Canada') => 'CA'
30
+ Carmen::state_code('Illinois') => 'IL'
31
+ Carmen::state_code('Manitoba', 'CA') => 'MB'
32
+ Carmen::state_name('AZ') => 'Arizona'
33
+
34
+ == The Data
35
+
36
+ The raw lists are stored in constants
37
+
38
+ Carmen::COUNTRIES => [['Afghanistan', 'AF'], ['Aland Islands', 'AX'], ]
39
+
40
+ Carmen::STATES => [['US', [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ],
41
+ ['CA', [['Alberta', 'AB'], ['British Columbia', 'BC'], ... ]]
42
+
43
+ == Default Country
44
+
45
+ Methods that take a country code argument will use the default country if none is provided. The default default country is 'US'. You can change it to any country code:
46
+
47
+ Carmen.default_country = 'CA'
48
+
49
+ == Default Localization
50
+
51
+ You can switch between different localizations of the countries list, by setting the locale value (default is :en):
52
+
53
+ Carmen.locale = :de
54
+
55
+ Currently included localizations are: English, German
56
+
57
+ == Documentation
58
+
59
+ Carmen's docs are published to http://jim.github.com/carmen
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'hanna/rdoctask'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "carmen"
9
+ gem.summary = %Q{A collection of geographis country and state names for Ruby}
10
+ gem.description = %Q{A collection of geographis country and state names for Ruby. Also includes replacements for Rails' country_select and state_select plugins}
11
+ gem.email = "jim@autonomousmachine.com"
12
+ gem.homepage = "http://github.com/jim/carmen"
13
+ gem.authors = ["Jim Benton"]
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/*_test.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/*_test.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ desc 'Generate RDoc documentation for the carmen plugin.'
46
+ Rake::RDocTask.new(:rdoc) do |rdoc|
47
+ rdoc.rdoc_files.include('README.rdoc', 'MIT-LICENSE').
48
+ include('lib/**/*.rb')
49
+
50
+ rdoc.main = "README.rdoc" # page to start on
51
+ rdoc.title = "carmen documentation"
52
+
53
+ rdoc.rdoc_dir = 'doc' # rdoc output folder
54
+ rdoc.options << '--webcvs=http://github.com/jim/carmen/tree/master/'
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
data/carmen.gemspec ADDED
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{namxam-carmen}
8
+ s.version = "0.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jim Benton", "Maximilian Schulz"]
12
+ s.date = %q{2010-02-23}
13
+ s.description = %q{A fork of the carmen gem by Jim Benton. This fork allows you to
14
+ switch between different locales (Currently english and german).
15
+ A collection of geographis country and state names for Ruby.
16
+ Also includes replacements for Rails' country_select and state_select plugins.}
17
+ s.email = %q{max@jungeelite.de}
18
+ s.extra_rdoc_files = [
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".gitignore",
23
+ "MIT-LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "carmen.gemspec",
28
+ "data/countries.yml",
29
+ "data/states/au.yml",
30
+ "data/states/br.yml",
31
+ "data/states/ca.yml",
32
+ "data/states/cu.yml",
33
+ "data/states/de.yml",
34
+ "data/states/dk.yml",
35
+ "data/states/it.yml",
36
+ "data/states/mx.yml",
37
+ "data/states/ua.yml",
38
+ "data/states/us.yml",
39
+ "lib/carmen.rb",
40
+ "lib/carmen/action_view_helpers.rb",
41
+ "rails/init.rb",
42
+ "test/carmen_test.rb",
43
+ "test/carmen_view_helper_test.rb"
44
+ ]
45
+ s.homepage = %q{http://github.com/namxam/carmen}
46
+ s.rdoc_options = ["--charset=UTF-8"]
47
+ s.require_paths = ["lib"]
48
+ s.rubygems_version = %q{1.3.5}
49
+ s.summary = %q{A collection of geographis country and state names for Ruby}
50
+ s.test_files = [
51
+ "test/carmen_test.rb",
52
+ "test/carmen_view_helper_test.rb"
53
+ ]
54
+
55
+ if s.respond_to? :specification_version then
56
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
+ s.specification_version = 3
58
+
59
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
+ else
61
+ end
62
+ else
63
+ end
64
+ end
@@ -0,0 +1,487 @@
1
+ ---
2
+ - - Afghanistan
3
+ - AF
4
+ - - Aland Islands
5
+ - AX
6
+ - - Albania
7
+ - AL
8
+ - - Algeria
9
+ - DZ
10
+ - - American Samoa
11
+ - AS
12
+ - - Andorra
13
+ - AD
14
+ - - Angola
15
+ - AO
16
+ - - Anguilla
17
+ - AI
18
+ - - Antarctica
19
+ - AQ
20
+ - - Antigua and Barbuda
21
+ - AG
22
+ - - Argentina
23
+ - AR
24
+ - - Armenia
25
+ - AM
26
+ - - Aruba
27
+ - AW
28
+ - - Australia
29
+ - AU
30
+ - - Austria
31
+ - AT
32
+ - - Azerbaijan
33
+ - AZ
34
+ - - Bahamas
35
+ - BS
36
+ - - Bahrain
37
+ - BH
38
+ - - Bangladesh
39
+ - BD
40
+ - - Barbados
41
+ - BB
42
+ - - Belarus
43
+ - BY
44
+ - - Belgium
45
+ - BE
46
+ - - Belize
47
+ - BZ
48
+ - - Benin
49
+ - BJ
50
+ - - Bermuda
51
+ - BM
52
+ - - Bhutan
53
+ - BT
54
+ - - Bolivia
55
+ - BO
56
+ - - Bosnia and Herzegovina
57
+ - BA
58
+ - - Botswana
59
+ - BW
60
+ - - Bouvet Island
61
+ - BV
62
+ - - Brazil
63
+ - BR
64
+ - - British Indian Ocean Territory
65
+ - IO
66
+ - - Brunei Darussalam
67
+ - BN
68
+ - - Bulgaria
69
+ - BG
70
+ - - Burkina Faso
71
+ - BF
72
+ - - Burundi
73
+ - BI
74
+ - - Cambodia
75
+ - KH
76
+ - - Cameroon
77
+ - CM
78
+ - - Canada
79
+ - CA
80
+ - - Cape Verde
81
+ - CV
82
+ - - Cayman Islands
83
+ - KY
84
+ - - Central African Republic
85
+ - CF
86
+ - - Chad
87
+ - TD
88
+ - - Chile
89
+ - CL
90
+ - - China
91
+ - CN
92
+ - - Christmas Island
93
+ - CX
94
+ - - Cocos (Keeling) Islands
95
+ - CC
96
+ - - Colombia
97
+ - CO
98
+ - - Comoros
99
+ - KM
100
+ - - Congo
101
+ - CG
102
+ - - Congo, the Democratic Republic of the
103
+ - CD
104
+ - - Cook Islands
105
+ - CK
106
+ - - Costa Rica
107
+ - CR
108
+ - - Cote D'ivoire
109
+ - CI
110
+ - - Croatia
111
+ - HR
112
+ - - Cuba
113
+ - CU
114
+ - - Cyprus
115
+ - CY
116
+ - - Czech Republic
117
+ - CZ
118
+ - - Denmark
119
+ - DK
120
+ - - Djibouti
121
+ - DJ
122
+ - - Dominica
123
+ - DM
124
+ - - Dominican Republic
125
+ - DO
126
+ - - Ecuador
127
+ - EC
128
+ - - Egypt
129
+ - EG
130
+ - - El Salvador
131
+ - SV
132
+ - - Equatorial Guinea
133
+ - GQ
134
+ - - Eritrea
135
+ - ER
136
+ - - Estonia
137
+ - EE
138
+ - - Ethiopia
139
+ - ET
140
+ - - Falkland Islands (Malvinas)
141
+ - FK
142
+ - - Faroe Islands
143
+ - FO
144
+ - - Fiji
145
+ - FJ
146
+ - - Finland
147
+ - FI
148
+ - - France
149
+ - FR
150
+ - - French Guiana
151
+ - GF
152
+ - - French Polynesia
153
+ - PF
154
+ - - French Southern Territories
155
+ - TF
156
+ - - Gabon
157
+ - GA
158
+ - - Gambia
159
+ - GM
160
+ - - Georgia
161
+ - GE
162
+ - - Germany
163
+ - DE
164
+ - - Ghana
165
+ - GH
166
+ - - Gibraltar
167
+ - GI
168
+ - - Greece
169
+ - GR
170
+ - - Greenland
171
+ - GL
172
+ - - Grenada
173
+ - GD
174
+ - - Guadeloupe
175
+ - GP
176
+ - - Guam
177
+ - GU
178
+ - - Guatemala
179
+ - GT
180
+ - - Guernsey
181
+ - GG
182
+ - - Guinea
183
+ - GN
184
+ - - Guinea-Bissau
185
+ - GW
186
+ - - Guyana
187
+ - GY
188
+ - - Haiti
189
+ - HT
190
+ - - Heard Island and Mcdonald Islands
191
+ - HM
192
+ - - Holy See (Vatican City State)
193
+ - VA
194
+ - - Honduras
195
+ - HN
196
+ - - Hong Kong
197
+ - HK
198
+ - - Hungary
199
+ - HU
200
+ - - Iceland
201
+ - IS
202
+ - - India
203
+ - IN
204
+ - - Indonesia
205
+ - ID
206
+ - - Iran, Islamic Republic of
207
+ - IR
208
+ - - Iraq
209
+ - IQ
210
+ - - Ireland
211
+ - IE
212
+ - - Isle of Man
213
+ - IM
214
+ - - Israel
215
+ - IL
216
+ - - Italy
217
+ - IT
218
+ - - Jamaica
219
+ - JM
220
+ - - Japan
221
+ - JP
222
+ - - Jersey
223
+ - JE
224
+ - - Jordan
225
+ - JO
226
+ - - Kazakhstan
227
+ - KZ
228
+ - - Kenya
229
+ - KE
230
+ - - Kiribati
231
+ - KI
232
+ - - Korea, Democratic People's Republic of
233
+ - KP
234
+ - - Korea, Republic of
235
+ - KR
236
+ - - Kuwait
237
+ - KW
238
+ - - Kyrgyzstan
239
+ - KG
240
+ - - Lao People's Democratic Republic
241
+ - LA
242
+ - - Latvia
243
+ - LV
244
+ - - Lebanon
245
+ - LB
246
+ - - Lesotho
247
+ - LS
248
+ - - Liberia
249
+ - LR
250
+ - - Libyan Arab Jamahiriya
251
+ - LY
252
+ - - Liechtenstein
253
+ - LI
254
+ - - Lithuania
255
+ - LT
256
+ - - Luxembourg
257
+ - LU
258
+ - - Macao
259
+ - MO
260
+ - - Macedonia, the Former Yugoslav Republic of
261
+ - MK
262
+ - - Madagascar
263
+ - MG
264
+ - - Malawi
265
+ - MW
266
+ - - Malaysia
267
+ - MY
268
+ - - Maldives
269
+ - MV
270
+ - - Mali
271
+ - ML
272
+ - - Malta
273
+ - MT
274
+ - - Marshall Islands
275
+ - MH
276
+ - - Martinique
277
+ - MQ
278
+ - - Mauritania
279
+ - MR
280
+ - - Mauritius
281
+ - MU
282
+ - - Mayotte
283
+ - YT
284
+ - - Mexico
285
+ - MX
286
+ - - Micronesia, Federated States of
287
+ - FM
288
+ - - Moldova, Republic of
289
+ - MD
290
+ - - Monaco
291
+ - MC
292
+ - - Mongolia
293
+ - MN
294
+ - - Montserrat
295
+ - MS
296
+ - - Morocco
297
+ - MA
298
+ - - Mozambique
299
+ - MZ
300
+ - - Myanmar
301
+ - MM
302
+ - - Namibia
303
+ - NA
304
+ - - Nauru
305
+ - NR
306
+ - - Nepal
307
+ - NP
308
+ - - Netherlands
309
+ - NL
310
+ - - Netherlands Antilles
311
+ - AN
312
+ - - New Caledonia
313
+ - NC
314
+ - - New Zealand
315
+ - NZ
316
+ - - Nicaragua
317
+ - NI
318
+ - - Niger
319
+ - NE
320
+ - - Nigeria
321
+ - NG
322
+ - - Niue
323
+ - NU
324
+ - - Norfolk Island
325
+ - NF
326
+ - - Northern Mariana Islands
327
+ - MP
328
+ - - Norway
329
+ - 'NO'
330
+ - - Oman
331
+ - OM
332
+ - - Pakistan
333
+ - PK
334
+ - - Palau
335
+ - PW
336
+ - - Palestinian Territory, Occupied
337
+ - PS
338
+ - - Panama
339
+ - PA
340
+ - - Papua New Guinea
341
+ - PG
342
+ - - Paraguay
343
+ - PY
344
+ - - Peru
345
+ - PE
346
+ - - Philippines
347
+ - PH
348
+ - - Pitcairn
349
+ - PN
350
+ - - Poland
351
+ - PL
352
+ - - Portugal
353
+ - PT
354
+ - - Puerto Rico
355
+ - PR
356
+ - - Qatar
357
+ - QA
358
+ - - Reunion
359
+ - RE
360
+ - - Romania
361
+ - RO
362
+ - - Russian Federation
363
+ - RU
364
+ - - Rwanda
365
+ - RW
366
+ - - Saint Helena
367
+ - SH
368
+ - - Saint Kitts and Nevis
369
+ - KN
370
+ - - Saint Lucia
371
+ - LC
372
+ - - Saint Pierre and Miquelon
373
+ - PM
374
+ - - Saint Vincent and the Grenadines
375
+ - VC
376
+ - - Samoa
377
+ - WS
378
+ - - San Marino
379
+ - SM
380
+ - - Sao Tome and Principe
381
+ - ST
382
+ - - Saudi Arabia
383
+ - SA
384
+ - - Senegal
385
+ - SN
386
+ - - Serbia and Montenegro
387
+ - CS
388
+ - - Seychelles
389
+ - SC
390
+ - - Sierra Leone
391
+ - SL
392
+ - - Singapore
393
+ - SG
394
+ - - Slovakia
395
+ - SK
396
+ - - Slovenia
397
+ - SI
398
+ - - Solomon Islands
399
+ - SB
400
+ - - Somalia
401
+ - SO
402
+ - - South Africa
403
+ - ZA
404
+ - - South Georgia and the South Sandwich Islands
405
+ - GS
406
+ - - Spain
407
+ - ES
408
+ - - Sri Lanka
409
+ - LK
410
+ - - Sudan
411
+ - SD
412
+ - - Suriname
413
+ - SR
414
+ - - Svalbard and Jan Mayen
415
+ - SJ
416
+ - - Swaziland
417
+ - SZ
418
+ - - Sweden
419
+ - SE
420
+ - - Switzerland
421
+ - CH
422
+ - - Syrian Arab Republic
423
+ - SY
424
+ - - Taiwan, Province of China
425
+ - TW
426
+ - - Tajikistan
427
+ - TJ
428
+ - - Tanzania, United Republic of
429
+ - TZ
430
+ - - Thailand
431
+ - TH
432
+ - - Timor-Leste
433
+ - TL
434
+ - - Togo
435
+ - TG
436
+ - - Tokelau
437
+ - TK
438
+ - - Tonga
439
+ - TO
440
+ - - Trinidad and Tobago
441
+ - TT
442
+ - - Tunisia
443
+ - TN
444
+ - - Turkey
445
+ - TR
446
+ - - Turkmenistan
447
+ - TM
448
+ - - Turks and Caicos Islands
449
+ - TC
450
+ - - Tuvalu
451
+ - TV
452
+ - - Uganda
453
+ - UG
454
+ - - Ukraine
455
+ - UA
456
+ - - United Arab Emirates
457
+ - AE
458
+ - - United Kingdom
459
+ - GB
460
+ - - United States
461
+ - US
462
+ - - United States Minor Outlying Islands
463
+ - UM
464
+ - - Uruguay
465
+ - UY
466
+ - - Uzbekistan
467
+ - UZ
468
+ - - Vanuatu
469
+ - VU
470
+ - - Venezuela
471
+ - VE
472
+ - - Viet Nam
473
+ - VN
474
+ - - Virgin Islands, British
475
+ - VG
476
+ - - Virgin Islands, U.S.
477
+ - VI
478
+ - - Wallis and Futuna
479
+ - WF
480
+ - - Western Sahara
481
+ - EH
482
+ - - Yemen
483
+ - YE
484
+ - - Zambia
485
+ - ZM
486
+ - - Zimbabwe
487
+ - ZW