i18n_generators 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.2
2
+
3
+ * bugfixes:
4
+ * Use https to request GH
5
+
1
6
  == 1.0.1
2
7
 
3
8
  * major enhancements:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,3 +1,4 @@
1
+ require 'net/https'
1
2
  require 'rubygems'
2
3
  require 'rails_generator'
3
4
  require 'rails_generator/commands'
@@ -69,10 +70,13 @@ class I18nGenerator < Rails::Generator::NamedBase
69
70
  private
70
71
  def defined_in_rails_i18n_repository?
71
72
  begin
72
- uri = "http://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/#{locale_name}.yml"
73
- OpenURI.open_uri(uri) do |res|
74
- (res.base_uri.to_s == uri) && (res.status == %w[200 OK])
75
- end
73
+ uri = URI.parse "https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/#{locale_name}.yml"
74
+ http = Net::HTTP.new uri.host, uri.port
75
+ http.use_ssl = true
76
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
77
+ req = Net::HTTP::Get.new uri.request_uri
78
+ res = http.request req
79
+ res.code == '200'
76
80
  rescue
77
81
  false
78
82
  end
@@ -1,3 +1,4 @@
1
+ require 'net/https'
1
2
  require 'rubygems'
2
3
  require 'rails_generator'
3
4
  require 'rails_generator/commands'
@@ -26,7 +27,13 @@ module I18nGenerator::Generator
26
27
 
27
28
  def fetch_from_rails_i18n_repository
28
29
  file('i18n:base.yml', "config/locales/#{locale_name}.yml") do |f|
29
- OpenURI.open_uri("http://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/#{locale_name}.yml").read
30
+ uri = URI.parse "https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/#{locale_name}.yml"
31
+ http = Net::HTTP.new uri.host, uri.port
32
+ http.use_ssl = true
33
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
34
+ req = Net::HTTP::Get.new uri.request_uri
35
+ res = http.request req
36
+ res.body
30
37
  end
31
38
  end
32
39
 
@@ -1,86 +1,84 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{i18n_generators}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akira Matsuda"]
12
- s.date = %q{2010-10-31}
12
+ s.date = %q{2010-11-29}
13
13
  s.description = %q{A Rails generator plugin & gem that generates Rails I18n locale files for almost every known locale.}
14
14
  s.email = %q{ronnie@dio.jp}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".gitignore",
20
- "History.txt",
21
- "MIT-LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "generators/i18n/USAGE",
26
- "generators/i18n/i18n_generator.rb",
27
- "generators/i18n/lib/yaml.rb",
28
- "generators/i18n/templates/base.yml",
29
- "generators/i18n/templates/i18n_config.rb",
30
- "generators/i18n/templates/translation.yml",
31
- "generators/i18n_locale/USAGE",
32
- "generators/i18n_locale/i18n_locale_command.rb",
33
- "generators/i18n_locale/i18n_locale_generator.rb",
34
- "generators/i18n_locale/lib/cldr.rb",
35
- "generators/i18n_scaffold/i18n_scaffold_generator.rb",
36
- "generators/i18n_scaffold/templates/controller.rb",
37
- "generators/i18n_scaffold/templates/functional_test.rb",
38
- "generators/i18n_scaffold/templates/helper.rb",
39
- "generators/i18n_scaffold/templates/helper_test.rb",
40
- "generators/i18n_scaffold/templates/layout.html.erb",
41
- "generators/i18n_scaffold/templates/style.css",
42
- "generators/i18n_scaffold/templates/view_edit.html.erb",
43
- "generators/i18n_scaffold/templates/view_index.html.erb",
44
- "generators/i18n_scaffold/templates/view_new.html.erb",
45
- "generators/i18n_scaffold/templates/view_show.html.erb",
46
- "generators/i18n_translation/USAGE",
47
- "generators/i18n_translation/i18n_translation_command.rb",
48
- "generators/i18n_translation/i18n_translation_generator.rb",
49
- "generators/i18n_translation/lib/erb_executer.rb",
50
- "generators/i18n_translation/lib/recording_backend.rb",
51
- "generators/i18n_translation/lib/through_ryoku.rb",
52
- "generators/i18n_translation/lib/translator.rb",
53
- "i18n_generators.gemspec",
54
- "lib/generators/i18n/USAGE",
55
- "lib/generators/i18n/i18n_generator.rb",
56
- "lib/generators/i18n_locale/USAGE",
57
- "lib/generators/i18n_locale/i18n_locale_generator.rb",
58
- "lib/generators/i18n_translation/USAGE",
59
- "lib/generators/i18n_translation/i18n_translation_generator.rb",
60
- "lib/generators/i18n_translation/lib/translator.rb",
61
- "lib/generators/i18n_translation/lib/yaml.rb",
62
- "lib/generators/i18n_translation/lib/yaml_waml.rb",
63
- "spec/cldr_spec.rb",
64
- "spec/data/cldr/ja.html",
65
- "spec/data/yml/active_record/en-US.yml",
66
- "spec/i18n_locale_command_spec.rb",
67
- "spec/i18n_translation_command_spec.rb",
68
- "spec/spec_helper.rb",
69
- "spec/translator_spec.rb",
70
- "spec/yaml_spec.rb"
19
+ "History.txt",
20
+ "MIT-LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "generators/i18n/USAGE",
25
+ "generators/i18n/i18n_generator.rb",
26
+ "generators/i18n/lib/yaml.rb",
27
+ "generators/i18n/templates/base.yml",
28
+ "generators/i18n/templates/i18n_config.rb",
29
+ "generators/i18n/templates/translation.yml",
30
+ "generators/i18n_locale/USAGE",
31
+ "generators/i18n_locale/i18n_locale_command.rb",
32
+ "generators/i18n_locale/i18n_locale_generator.rb",
33
+ "generators/i18n_locale/lib/cldr.rb",
34
+ "generators/i18n_scaffold/i18n_scaffold_generator.rb",
35
+ "generators/i18n_scaffold/templates/controller.rb",
36
+ "generators/i18n_scaffold/templates/functional_test.rb",
37
+ "generators/i18n_scaffold/templates/helper.rb",
38
+ "generators/i18n_scaffold/templates/helper_test.rb",
39
+ "generators/i18n_scaffold/templates/layout.html.erb",
40
+ "generators/i18n_scaffold/templates/style.css",
41
+ "generators/i18n_scaffold/templates/view_edit.html.erb",
42
+ "generators/i18n_scaffold/templates/view_index.html.erb",
43
+ "generators/i18n_scaffold/templates/view_new.html.erb",
44
+ "generators/i18n_scaffold/templates/view_show.html.erb",
45
+ "generators/i18n_translation/USAGE",
46
+ "generators/i18n_translation/i18n_translation_command.rb",
47
+ "generators/i18n_translation/i18n_translation_generator.rb",
48
+ "generators/i18n_translation/lib/erb_executer.rb",
49
+ "generators/i18n_translation/lib/recording_backend.rb",
50
+ "generators/i18n_translation/lib/through_ryoku.rb",
51
+ "generators/i18n_translation/lib/translator.rb",
52
+ "i18n_generators.gemspec",
53
+ "lib/generators/i18n/USAGE",
54
+ "lib/generators/i18n/i18n_generator.rb",
55
+ "lib/generators/i18n_locale/USAGE",
56
+ "lib/generators/i18n_locale/i18n_locale_generator.rb",
57
+ "lib/generators/i18n_translation/USAGE",
58
+ "lib/generators/i18n_translation/i18n_translation_generator.rb",
59
+ "lib/generators/i18n_translation/lib/translator.rb",
60
+ "lib/generators/i18n_translation/lib/yaml.rb",
61
+ "lib/generators/i18n_translation/lib/yaml_waml.rb",
62
+ "spec/cldr_spec.rb",
63
+ "spec/data/cldr/ja.html",
64
+ "spec/data/yml/active_record/en-US.yml",
65
+ "spec/i18n_locale_command_spec.rb",
66
+ "spec/i18n_translation_command_spec.rb",
67
+ "spec/spec_helper.rb",
68
+ "spec/translator_spec.rb",
69
+ "spec/yaml_spec.rb"
71
70
  ]
72
71
  s.homepage = %q{http://github.com/amatsuda/i18n_generators/}
73
- s.rdoc_options = ["--charset=UTF-8"]
74
72
  s.require_paths = ["lib"]
75
73
  s.rubygems_version = %q{1.3.7}
76
74
  s.summary = %q{Generates I18n locale files for Rails 3 and Rails 2}
77
75
  s.test_files = [
78
76
  "spec/cldr_spec.rb",
79
- "spec/i18n_locale_command_spec.rb",
80
- "spec/i18n_translation_command_spec.rb",
81
- "spec/spec_helper.rb",
82
- "spec/translator_spec.rb",
83
- "spec/yaml_spec.rb"
77
+ "spec/i18n_locale_command_spec.rb",
78
+ "spec/i18n_translation_command_spec.rb",
79
+ "spec/spec_helper.rb",
80
+ "spec/translator_spec.rb",
81
+ "spec/yaml_spec.rb"
84
82
  ]
85
83
 
86
84
  if s.respond_to? :specification_version then
@@ -1,3 +1,5 @@
1
+ require 'net/https'
2
+
1
3
  class I18nLocaleGenerator < Rails::Generators::NamedBase
2
4
  def main
3
5
  unless file_name =~ /^[a-zA-Z]{2}([-_][a-zA-Z]+)?$/
@@ -33,8 +35,15 @@ class I18nLocaleGenerator < Rails::Generators::NamedBase
33
35
  def fetch_from_rails_i18n_repository
34
36
  log "fetching #{locale_name}.yml from rails-i18n repository..."
35
37
  begin
36
- yml = OpenURI.open_uri("http://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/#{locale_name}.yml").read
37
- create_file "config/locales/#{locale_name}.yml", yml
38
+ uri = URI.parse "https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/#{locale_name}.yml"
39
+ http = Net::HTTP.new uri.host, uri.port
40
+ http.use_ssl = true
41
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
42
+ req = Net::HTTP::Get.new uri.request_uri
43
+ res = http.request req
44
+ raise unless res.code == '200'
45
+
46
+ create_file "config/locales/#{locale_name}.yml", res.body
38
47
  rescue
39
48
  log "could not find #{locale_name}.yml on rails-i18n repository"
40
49
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_generators
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-31 00:00:00 +09:00
18
+ date: 2010-11-29 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,7 +28,6 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - README.rdoc
30
30
  files:
31
- - .gitignore
32
31
  - History.txt
33
32
  - MIT-LICENSE
34
33
  - README.rdoc
@@ -85,8 +84,8 @@ homepage: http://github.com/amatsuda/i18n_generators/
85
84
  licenses: []
86
85
 
87
86
  post_install_message:
88
- rdoc_options:
89
- - --charset=UTF-8
87
+ rdoc_options: []
88
+
90
89
  require_paths:
91
90
  - lib
92
91
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg