tengine_support 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.6.0"
10
+ gem "yard", "~> 0.7.2"
11
+ gem "bundler", "~> 1.0.18"
12
+ gem "jeweler", "~> 1.6.4"
13
+ # gem "rcov", ">= 0"
14
+ gem "simplecov", "~> 0.5.3"
15
+ gem "autotest"
16
+
17
+ gem 'rdiscount'
18
+ end
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # tengine_support [![Build Status](https://secure.travis-ci.org/tengine/tengine_support.png)](http://travis-ci.org/tengine/tengine_support)
2
+
3
+ tengine_support provides utility classes/modules which is not included in active_support.
4
+ It doesn't depend on other tengine gems.
5
+
6
+ ## Contributing to tengine_support
7
+
8
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
9
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
10
+ * Fork the project
11
+ * Start a feature/bugfix branch
12
+ * Commit and push until you are happy with your contribution
13
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
14
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
15
+
16
+ ## License
17
+ tengine_event is distributed under the LGPL and MPL
18
+
19
+ ## Copyright
20
+
21
+ Copyright (c) 2011 nautilus-technologies.com
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "tengine_support"
18
+ gem.homepage = "http://github.com/tengine/tengine_support"
19
+ gem.license = "MPL/LGPL"
20
+ gem.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
21
+ gem.description = "tengine_support provides utility classes/modules which is not included in active_support. It doesn't depend on other tengine gems."
22
+ gem.email = "tengine@nautilus-technologies.com"
23
+ gem.authors = %w[saishu w-irie taigou totty hiroshinakao g-morita guemon aoetk hattori-at-nt t-yamada y-karashima akm]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+ task :test => :spec # for rubygems-test
41
+
42
+ require 'yard'
43
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,36 @@
1
+ require 'tengine/support'
2
+
3
+ require 'yaml'
4
+ require 'erb'
5
+
6
+ module Tengine::Support::YamlWithErb
7
+
8
+ ERB_EXTNAME = ".erb".freeze
9
+
10
+ class << self
11
+ def extended(klass)
12
+ return if klass.respond_to?(:load_file_without_erb)
13
+ klass.instance_eval do
14
+ alias :load_file_without_erb :load_file
15
+
16
+ def load_file(filepath)
17
+ if File.extname(filepath) == ERB_EXTNAME
18
+ load_file_with_erb(filepath)
19
+ else
20
+ load_file_without_erb(filepath)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+
28
+ def load_file_with_erb(filepath)
29
+ erb = ERB.new(IO.read(filepath))
30
+ erb.filename = filepath
31
+ text = erb.result
32
+ YAML.load(text)
33
+ end
34
+ end
35
+
36
+ YAML.extend(Tengine::Support::YamlWithErb)
@@ -0,0 +1,5 @@
1
+ require 'tengine_support'
2
+
3
+ module Tengine::Support
4
+ autoload :YamlWithErb, 'tengine/support/yaml_with_erb'
5
+ end
@@ -0,0 +1,3 @@
1
+ module Tengine
2
+ autoload :Support, 'tengine/support'
3
+ end
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'tengine_support'
5
+
6
+ require 'simplecov'
7
+ SimpleCov.start if ENV["COVERAGE"]
8
+
9
+ # Requires supporting files with custom matchers and macros, etc,
10
+ # in ./support/ and its subdirectories.
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
12
+
13
+ RSpec.configure do |config|
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+ ---
2
+ foo: <%= 3 * 24 * 60 * 60 %>
@@ -0,0 +1,2 @@
1
+ ---
2
+ foo: <%= 3 * 24 * 60 * 60 %>
@@ -0,0 +1,2 @@
1
+ ---
2
+ foo: 259200
@@ -0,0 +1,2 @@
1
+ ---
2
+ foo: <%= 3 * :foo %>
@@ -0,0 +1,76 @@
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
@@ -0,0 +1,72 @@
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.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["saishu", "w-irie", "taigou", "totty", "hiroshinakao", "g-morita", "guemon", "aoetk", "hattori-at-nt", "t-yamada", "y-karashima", "akm"]
12
+ s.date = "2011-11-15"
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@nautilus-technologies.com"
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".rspec",
21
+ "Gemfile",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/tengine/support.rb",
26
+ "lib/tengine/support/yaml_with_erb.rb",
27
+ "lib/tengine_support.rb",
28
+ "spec/spec_helper.rb",
29
+ "spec/tengine_support/yaml_with_erb_spec.rb",
30
+ "spec/tengine_support/yaml_with_erb_spec/test1.yml.erb",
31
+ "spec/tengine_support/yaml_with_erb_spec/test2_with_erb.yml",
32
+ "spec/tengine_support/yaml_with_erb_spec/test3_without_erb.yml",
33
+ "spec/tengine_support/yaml_with_erb_spec/test4_with_invalid_erb.yml",
34
+ "tengine_support.gemspec"
35
+ ]
36
+ s.homepage = "http://github.com/tengine/tengine_support"
37
+ s.licenses = ["MPL/LGPL"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = "1.8.11"
40
+ s.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
41
+
42
+ if s.respond_to? :specification_version then
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
47
+ s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
48
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.18"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
50
+ s.add_development_dependency(%q<simplecov>, ["~> 0.5.3"])
51
+ s.add_development_dependency(%q<autotest>, [">= 0"])
52
+ s.add_development_dependency(%q<rdiscount>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
55
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
58
+ s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
59
+ s.add_dependency(%q<autotest>, [">= 0"])
60
+ s.add_dependency(%q<rdiscount>, [">= 0"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
64
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
66
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
67
+ s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
68
+ s.add_dependency(%q<autotest>, [">= 0"])
69
+ s.add_dependency(%q<rdiscount>, [">= 0"])
70
+ end
71
+ end
72
+
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tengine_support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - saishu
9
+ - w-irie
10
+ - taigou
11
+ - totty
12
+ - hiroshinakao
13
+ - g-morita
14
+ - guemon
15
+ - aoetk
16
+ - hattori-at-nt
17
+ - t-yamada
18
+ - y-karashima
19
+ - akm
20
+ autorequire:
21
+ bindir: bin
22
+ cert_chain: []
23
+ date: 2011-11-15 00:00:00.000000000Z
24
+ dependencies:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2155482500 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.6.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2155482500
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ requirement: &2155482020 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.7.2
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2155482020
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &2155481540 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.18
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2155481540
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &2155481060 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.6.4
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2155481060
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: &2155480580 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 0.5.3
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2155480580
80
+ - !ruby/object:Gem::Dependency
81
+ name: autotest
82
+ requirement: &2155401860 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2155401860
91
+ - !ruby/object:Gem::Dependency
92
+ name: rdiscount
93
+ requirement: &2155401300 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2155401300
102
+ description: tengine_support provides utility classes/modules which is not included
103
+ in active_support. It doesn't depend on other tengine gems.
104
+ email: tengine@nautilus-technologies.com
105
+ executables: []
106
+ extensions: []
107
+ extra_rdoc_files:
108
+ - README.md
109
+ files:
110
+ - .document
111
+ - .rspec
112
+ - Gemfile
113
+ - README.md
114
+ - Rakefile
115
+ - VERSION
116
+ - lib/tengine/support.rb
117
+ - lib/tengine/support/yaml_with_erb.rb
118
+ - lib/tengine_support.rb
119
+ - spec/spec_helper.rb
120
+ - spec/tengine_support/yaml_with_erb_spec.rb
121
+ - spec/tengine_support/yaml_with_erb_spec/test1.yml.erb
122
+ - spec/tengine_support/yaml_with_erb_spec/test2_with_erb.yml
123
+ - spec/tengine_support/yaml_with_erb_spec/test3_without_erb.yml
124
+ - spec/tengine_support/yaml_with_erb_spec/test4_with_invalid_erb.yml
125
+ - tengine_support.gemspec
126
+ homepage: http://github.com/tengine/tengine_support
127
+ licenses:
128
+ - MPL/LGPL
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ segments:
140
+ - 0
141
+ hash: -1048497208083411906
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 1.8.11
151
+ signing_key:
152
+ specification_version: 3
153
+ summary: tengine_support provides utility classes/modules which isn't included in
154
+ active_support.
155
+ test_files: []