tengine_support 0.3.27 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Gemfile +3 -20
  2. data/lib/tengine/support/core_ext/enumerable/map_to_hash.rb +20 -0
  3. data/lib/tengine/support/mongoid.rb +59 -0
  4. data/lib/tengine/support/null_logger.rb +1 -1
  5. data/lib/tengine/support.rb +4 -3
  6. metadata +80 -76
  7. data/.document +0 -5
  8. data/.rspec +0 -1
  9. data/.travis.yml +0 -11
  10. data/NULL +0 -1
  11. data/Rakefile +0 -43
  12. data/VERSION +0 -1
  13. data/gemfiles/Gemfile.activesupport-3.0.10 +0 -24
  14. data/gemfiles/Gemfile.activesupport-3.1.1 +0 -24
  15. data/gemfiles/Gemfile.activesupport-3.2.3 +0 -24
  16. data/spec/spec_helper.rb +0 -15
  17. data/spec/support/app1.rb +0 -27
  18. data/spec/support/suite.rb +0 -182
  19. data/spec/tengine/support/config/amqp_spec.rb +0 -32
  20. data/spec/tengine/support/config/logger_spec.rb +0 -316
  21. data/spec/tengine/support/config/mongoid_spec.rb +0 -24
  22. data/spec/tengine/support/config_spec/dump_skelton_spec.rb +0 -171
  23. data/spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb +0 -94
  24. data/spec/tengine/support/config_spec/load_spec.rb +0 -239
  25. data/spec/tengine/support/config_spec/load_spec_01.yml.erb +0 -43
  26. data/spec/tengine/support/config_spec/load_spec_01_with_other_settings.yml.erb +0 -48
  27. data/spec/tengine/support/config_spec/load_spec_02.yml.erb +0 -52
  28. data/spec/tengine/support/config_spec/parse_spec.rb +0 -178
  29. data/spec/tengine/support/config_spec.rb +0 -217
  30. data/spec/tengine/support/core_ext/array/deep_dup_spec.rb +0 -69
  31. data/spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb +0 -16
  32. data/spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb +0 -29
  33. data/spec/tengine/support/core_ext/hash/compact_spec.rb +0 -28
  34. data/spec/tengine/support/core_ext/hash/deep_dup_spec.rb +0 -66
  35. data/spec/tengine/support/core_ext/hash/keys_spec.rb +0 -88
  36. data/spec/tengine/support/mongoid_spec.rb +0 -36
  37. data/spec/tengine/support/null_logger_spec.rb +0 -13
  38. data/spec/tengine/support/yaml_with_erb_spec/test1.yml.erb +0 -2
  39. data/spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml +0 -2
  40. data/spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml +0 -2
  41. data/spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml +0 -2
  42. data/spec/tengine/support/yaml_with_erb_spec.rb +0 -76
  43. data/tengine_support.gemspec +0 -125
@@ -1,88 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper')
3
-
4
- require 'active_support'
5
-
6
- require 'tengine/support/core_ext/array/deep_dup'
7
- require 'tengine/support/core_ext/hash/keys'
8
-
9
- describe "tengine/support/core_ext/hash/keys" do
10
-
11
- test_hashs ={
12
- :deep_stringify_keys_result => {
13
- 'a' => 1,
14
- 'b' => {
15
- 'foo' => 2,
16
- 'bar' => {
17
- 'hoge' => "3",
18
- "wake" => {}.freeze,
19
- }.freeze
20
- }.freeze,
21
- 'c' => [
22
- { 'baz' => "4" }.freeze,
23
- { 'blah' => "5" }.freeze,
24
- ]
25
- }.freeze,
26
-
27
- :deep_symbolize_keys_result => {
28
- :a => 1,
29
- :b => {
30
- :foo => 2,
31
- :bar => {
32
- :hoge => "3",
33
- :wake => {}.freeze,
34
- }.freeze
35
- }.freeze,
36
- :c => [
37
- { :baz => "4" }.freeze,
38
- { :blah => "5" }.freeze,
39
- ]
40
- }.freeze,
41
-
42
- :mixed_key_hash => {
43
- 'a' => 1,
44
- :b => {
45
- :foo => 2,
46
- 'bar' => {
47
- 'hoge' => "3",
48
- :wake => {}.freeze,
49
- }.freeze
50
- }.freeze,
51
- :c => [
52
- { 'baz' => "4" }.freeze,
53
- { :blah => "5" }.freeze,
54
- ]
55
- }.freeze
56
- }
57
-
58
- [:deep_stringify_keys, :deep_symbolize_keys].each do |method_name|
59
- test_hashs.keys.each do |target_name|
60
- context target_name do
61
- describe ".#{method_name}" do
62
- it "should returns #{method_name}_result" do
63
- original = test_hashs[target_name]
64
- converted = original.send(method_name)
65
- converted.object_id.should_not == original.object_id # object_id is changed
66
- converted.should == test_hashs[:"#{method_name}_result"]
67
- original.should == test_hashs[target_name]
68
- end
69
- end
70
- end
71
- end
72
-
73
-
74
- test_hashs.keys.each do |target_name|
75
- context target_name do
76
- describe ".#{method_name}!" do
77
- it "should equals :#{method_name}_result" do
78
- original = test_hashs[target_name].deep_dup
79
- result = original.send(:"#{method_name}!")
80
- result.object_id.should == original.object_id
81
- original.should == test_hashs[:"#{method_name}_result"]
82
- end
83
- end
84
- end
85
- end
86
- end
87
-
88
- end
@@ -1,36 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'mongoid'
3
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
4
- require 'tengine/support/mongoid'
5
-
6
- class TestModel1
7
- include Mongoid::Document
8
- end
9
-
10
- describe Mongoid::Document do
11
- describe :human_name do
12
- before do
13
- I18n.backend = I18n::Backend::Simple.new
14
- I18n.backend.store_translations :ja, :mongoid => {:models => {
15
- :test_model1 => "テストモデル1"
16
- } }
17
- end
18
-
19
- context "リソースが登録されていない場合" do
20
- before{ I18n.locale = :en }
21
- subject{ TestModel1 }
22
- it{ TestModel1.human_name.should == 'TestModel1' }
23
- its(:i18n_scope){ should == :mongoid }
24
- end
25
-
26
- context "リソースが登録されている場合" do
27
- before{ I18n.locale = :ja }
28
- subject{ TestModel1 }
29
- it{ TestModel1.human_name.should == 'テストモデル1' }
30
- it{ TestModel1.name.should == "TestModel1" }
31
- it{ TestModel1.name.underscore.should == "test_model1" }
32
- it{ I18n.t(:test_model1, :scope => [:mongoid, :models]).should == "テストモデル1" }
33
- end
34
-
35
- end
36
- end
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
-
4
- describe Tengine::Support::NullLogger do
5
- context "使用可能なメソッド" do
6
- subject{ Tengine::Support::NullLogger.new }
7
- it{ subject.debug("foo") }
8
- it{ subject.info("foo") }
9
- it{ subject.warn("foo") }
10
- it{ subject.error("foo") }
11
- it{ subject.fatal("foo") }
12
- end
13
- end
@@ -1,2 +0,0 @@
1
- ---
2
- foo: <%= 3 * 24 * 60 * 60 %>
@@ -1,2 +0,0 @@
1
- ---
2
- foo: <%= 3 * 24 * 60 * 60 %>
@@ -1,2 +0,0 @@
1
- ---
2
- foo: 259200
@@ -1,2 +0,0 @@
1
- ---
2
- foo: <%= 3 * :foo %>
@@ -1,76 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- require 'yaml'
4
- require 'tengine/support/yaml_with_erb'
5
-
6
- describe "yaml_with_erb" do
7
-
8
- EXPECTATION = {
9
- 'foo' => 259200
10
- }.freeze
11
-
12
- describe :load_file do
13
- describe 'yaml_with_erb_spec/test1.yml.erb' do
14
- it "should load by using ERB + YAML" do
15
- actual = YAML.load_file(File.expand_path(subject, File.dirname(__FILE__)))
16
- actual.should == EXPECTATION
17
- end
18
- end
19
-
20
- describe 'yaml_with_erb_spec/test2_with_erb.yml' do
21
- it "should raise Error when loading by YAML" do
22
- actual = YAML.load_file(File.expand_path(subject, File.dirname(__FILE__)))
23
- actual.should == {"foo"=>"<%= 3 * 24 * 60 * 60 %>"}
24
- end
25
- end
26
-
27
- describe 'yaml_with_erb_spec/test3_without_erb.yml' do
28
- it "should load by using YAML" do
29
- actual = YAML.load_file(File.expand_path(subject, File.dirname(__FILE__)))
30
- actual.should == EXPECTATION
31
- end
32
- end
33
-
34
- describe 'yaml_with_erb_spec/test4_with_invalid_erb.yml' do
35
- it "should raise Error when loading by YAML" do
36
- actual = YAML.load_file(File.expand_path(subject, File.dirname(__FILE__)))
37
- actual.should == {"foo"=>"<%= 3 * :foo %>"}
38
- end
39
- end
40
- end
41
-
42
- describe :load_file_with_erb do
43
- describe 'yaml_with_erb_spec/test1.yml.erb' do
44
- it "should load by using ERB + YAML" do
45
- actual = YAML.load_file_with_erb(File.expand_path(subject, File.dirname(__FILE__)))
46
- actual.should == EXPECTATION
47
- end
48
- end
49
-
50
- describe 'yaml_with_erb_spec/test2_with_erb.yml' do
51
- it "should load by using ERB + YAML" do
52
- actual = YAML.load_file_with_erb(File.expand_path(subject, File.dirname(__FILE__)))
53
- actual.should == EXPECTATION
54
- end
55
- end
56
-
57
- describe 'yaml_with_erb_spec/test3_without_erb.yml' do
58
- it "should load by using ERB + YAML" do
59
- actual = YAML.load_file_with_erb(File.expand_path(subject, File.dirname(__FILE__)))
60
- actual.should == EXPECTATION
61
- end
62
- end
63
-
64
- describe 'yaml_with_erb_spec/test4_with_invalid_erb.yml' do
65
- it "should raise Error which has backtrace with filename" do
66
- filepath = File.expand_path(subject, File.dirname(__FILE__))
67
- begin
68
- YAML.load_file_with_erb(filepath)
69
- rescue TypeError => e
70
- e.backtrace.any?{|line| line.include?(filepath)}.should == true
71
- end
72
- end
73
- end
74
- end
75
-
76
- end
@@ -1,125 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
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 = "tengine_support"
8
- s.version = "0.3.27"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["shyouhei", "akm", "taigou"]
12
- s.date = "2012-05-02"
13
- s.description = "tengine_support provides utility classes/modules which is not included in active_support. It doesn't depend on other tengine gems."
14
- s.email = "tengine-info@groovenauts.jp"
15
- s.extra_rdoc_files = [
16
- "README.md"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".rspec",
21
- ".travis.yml",
22
- "Gemfile",
23
- "NULL",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "gemfiles/Gemfile.activesupport-3.0.10",
28
- "gemfiles/Gemfile.activesupport-3.1.1",
29
- "gemfiles/Gemfile.activesupport-3.2.3",
30
- "lib/tengine/support.rb",
31
- "lib/tengine/support/config.rb",
32
- "lib/tengine/support/config/amqp.rb",
33
- "lib/tengine/support/config/definition.rb",
34
- "lib/tengine/support/config/definition/field.rb",
35
- "lib/tengine/support/config/definition/group.rb",
36
- "lib/tengine/support/config/definition/has_many_children.rb",
37
- "lib/tengine/support/config/definition/optparse_visitor.rb",
38
- "lib/tengine/support/config/definition/suite.rb",
39
- "lib/tengine/support/config/logger.rb",
40
- "lib/tengine/support/config/mongoid.rb",
41
- "lib/tengine/support/core_ext.rb",
42
- "lib/tengine/support/core_ext/array.rb",
43
- "lib/tengine/support/core_ext/array/deep_dup.rb",
44
- "lib/tengine/support/core_ext/enumerable.rb",
45
- "lib/tengine/support/core_ext/enumerable/deep_freeze.rb",
46
- "lib/tengine/support/core_ext/enumerable/each_next_tick.rb",
47
- "lib/tengine/support/core_ext/hash.rb",
48
- "lib/tengine/support/core_ext/hash/compact.rb",
49
- "lib/tengine/support/core_ext/hash/deep_dup.rb",
50
- "lib/tengine/support/core_ext/hash/keys.rb",
51
- "lib/tengine/support/core_ext/module.rb",
52
- "lib/tengine/support/core_ext/module/private_constant.rb",
53
- "lib/tengine/support/mongoid.rb",
54
- "lib/tengine/support/null_logger.rb",
55
- "lib/tengine/support/yaml_with_erb.rb",
56
- "lib/tengine_support.rb",
57
- "spec/spec_helper.rb",
58
- "spec/support/app1.rb",
59
- "spec/support/suite.rb",
60
- "spec/tengine/support/config/amqp_spec.rb",
61
- "spec/tengine/support/config/logger_spec.rb",
62
- "spec/tengine/support/config/mongoid_spec.rb",
63
- "spec/tengine/support/config_spec.rb",
64
- "spec/tengine/support/config_spec/dump_skelton_spec.rb",
65
- "spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb",
66
- "spec/tengine/support/config_spec/load_spec.rb",
67
- "spec/tengine/support/config_spec/load_spec_01.yml.erb",
68
- "spec/tengine/support/config_spec/load_spec_01_with_other_settings.yml.erb",
69
- "spec/tengine/support/config_spec/load_spec_02.yml.erb",
70
- "spec/tengine/support/config_spec/parse_spec.rb",
71
- "spec/tengine/support/core_ext/array/deep_dup_spec.rb",
72
- "spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb",
73
- "spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb",
74
- "spec/tengine/support/core_ext/hash/compact_spec.rb",
75
- "spec/tengine/support/core_ext/hash/deep_dup_spec.rb",
76
- "spec/tengine/support/core_ext/hash/keys_spec.rb",
77
- "spec/tengine/support/mongoid_spec.rb",
78
- "spec/tengine/support/null_logger_spec.rb",
79
- "spec/tengine/support/yaml_with_erb_spec.rb",
80
- "spec/tengine/support/yaml_with_erb_spec/test1.yml.erb",
81
- "spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml",
82
- "spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml",
83
- "spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml",
84
- "tengine_support.gemspec"
85
- ]
86
- s.homepage = "http://github.com/tengine/tengine_support"
87
- s.licenses = ["MPL/LGPL"]
88
- s.require_paths = ["lib"]
89
- s.rubygems_version = "1.8.12"
90
- s.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
91
-
92
- if s.respond_to? :specification_version then
93
- s.specification_version = 3
94
-
95
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
96
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
97
- s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
98
- s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
99
- s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
100
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
101
- s.add_development_dependency(%q<simplecov>, ["~> 0.5.3"])
102
- s.add_development_dependency(%q<autotest>, [">= 0"])
103
- s.add_development_dependency(%q<rdiscount>, [">= 0"])
104
- else
105
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
106
- s.add_dependency(%q<rspec>, ["~> 2.6.0"])
107
- s.add_dependency(%q<yard>, ["~> 0.7.2"])
108
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
109
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
110
- s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
111
- s.add_dependency(%q<autotest>, [">= 0"])
112
- s.add_dependency(%q<rdiscount>, [">= 0"])
113
- end
114
- else
115
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
116
- s.add_dependency(%q<rspec>, ["~> 2.6.0"])
117
- s.add_dependency(%q<yard>, ["~> 0.7.2"])
118
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
119
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
120
- s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
121
- s.add_dependency(%q<autotest>, [">= 0"])
122
- s.add_dependency(%q<rdiscount>, [">= 0"])
123
- end
124
- end
125
-