sinatra-initializers 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,26 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ doc
21
+
22
+ ## PROJECT::SPECIFIC
23
+ spec/fixtures/
24
+
25
+ # Gemfile.lock should stay out of the .gitignore
26
+ # http://gembundler.com/#getting-started
data/CHANGES ADDED
@@ -0,0 +1,15 @@
1
+ rel 0.1.0 (2011-09-29)
2
+
3
+ * intial release of gem / code
4
+
5
+ rel 0.1.1 (2011-12-02)
6
+
7
+ * pull request added (thanks David Czarnecki)
8
+ - reference gemspec in bundler Gemfile
9
+ - add rspec
10
+ - add rakefile
11
+ * move version to separate file
12
+ * add gemfile.lock back to project for heroku
13
+ * move test initializer to spec/config/initializer
14
+ * re-register when config_directory is changed
15
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Chad W Pry
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ 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
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,85 @@
1
+ = Sinatra::Initializers
2
+
3
+ A Sinatra Extension that sets up rails like initializers
4
+
5
+ == Installation
6
+
7
+ $ gem install sinatra-initializers
8
+
9
+ == Dependencies
10
+
11
+ This Gem depends upon the following:
12
+
13
+ === Runtime:
14
+
15
+ * sinatra ( >= 1.0 )
16
+
17
+
18
+ === Development & Tests:
19
+
20
+ * bundle install
21
+ * Execute rake or rspec
22
+
23
+ == Getting Started
24
+
25
+ To view the settings in your app, just require and register the extension
26
+ in your sub-classed Sinatra app:
27
+
28
+ require 'sinatra/initializers'
29
+
30
+ class YourApp < Sinatra::Base
31
+
32
+ register Sinatra::Initializers
33
+
34
+ end
35
+
36
+
37
+ In your "classic" Sinatra app, you just require the extension like this:
38
+
39
+ require 'rubygems'
40
+ require 'sinatra'
41
+ require 'sinatra/initializers'
42
+
43
+
44
+ == Configuration Options
45
+
46
+ The configuration directory may be defined by setting
47
+ the "config_directory" app variable. Unless it is setup
48
+ it will default to "config/initializers"
49
+
50
+ Add initializer scripts in config/initializers. Naming
51
+ follows a strict pattern of number then name for order priority
52
+
53
+ 00-first_initializer.rb
54
+ 01-second_initializer.rb
55
+
56
+
57
+ == More detail needed?
58
+
59
+ Contact me via email!
60
+
61
+
62
+ == Errors / Bugs
63
+
64
+ If something is not behaving intuitively, it is a bug, and should be reported.
65
+ Report it here: http://github.com/chadwpry/sinatra-initializers/issues
66
+
67
+
68
+ == TODOs
69
+
70
+ * TBD
71
+
72
+
73
+ == Note on Patches/Pull Requests
74
+
75
+ * Fork the project.
76
+ * Make your feature addition or bug fix.
77
+ * Commit, do not mess with rakefile, version, or history.
78
+ * (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
79
+ * Send me a pull request. Bonus points for topic branches.
80
+
81
+ == Copyright
82
+
83
+ Copyright (c) 2011 Chad W Pry. Released under the MIT License.
84
+
85
+ See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core'
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = FileList['spec/**/*_spec.rb']
8
+ spec.rspec_opts = ['--backtrace']
9
+ # spec.ruby_opts = ['-w']
10
+ end
11
+
12
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,10 @@
1
+ module Sinatra
2
+ module Initializers
3
+ VERSION = '0.1.1' unless const_defined?(:VERSION)
4
+
5
+ def self.version
6
+ VERSION
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,22 @@
1
+ require 'sinatra/base'
2
+ require 'sinatra-initializers/version'
3
+
4
+ module Sinatra
5
+ class Base
6
+ set(:config_directory, "config/initializers")
7
+ end
8
+
9
+ module Initializers
10
+ def config_directory= path
11
+ super
12
+ register Sinatra::Initializers
13
+ end
14
+
15
+ def self.registered app
16
+ Dir["#{app.config_directory}/**/*.rb"].each do |file_path|
17
+ require File.join(Dir.pwd, file_path)
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,43 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{sinatra-initializers}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chad W Pry"]
12
+ s.date = %q{2011-09-29}
13
+ s.description = %q{Rails like initialization}
14
+ s.email = %q{chad.pry@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "CHANGES",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "VERSION",
26
+ "lib/sinatra-initializers.rb",
27
+ "lib/sinatra-initializers/version.rb",
28
+ "sinatra-initializers.gemspec",
29
+ "Gemfile",
30
+ "Rakefile"
31
+ ]
32
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
33
+ s.homepage = %q{http://github.com/chadwpry/sinatra-initializers}
34
+ s.rdoc_options = ["--charset=UTF-8"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.3.7}
37
+ s.summary = %q{A Sinatra Extension that follows a pattern of rails initializers}
38
+
39
+ s.add_development_dependency('sinatra')
40
+ s.add_development_dependency('rake')
41
+ s.add_development_dependency('rspec')
42
+ end
43
+
@@ -0,0 +1,3 @@
1
+ module Test
2
+ THAT_I_EXIST = true
3
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Sinatra::Initializers do
4
+ class TestSinatraApplication < Sinatra::Base
5
+ register Sinatra::Initializers
6
+ end
7
+
8
+ describe "using base settings" do
9
+ it "defaults the setting config_directory to config/initializers" do
10
+ Sinatra::Base.config_directory.should == "config/initializers"
11
+ end
12
+ end
13
+
14
+ describe "using an example initializer" do
15
+ it "allows you to override config_directory" do
16
+ TestSinatraApplication.config_directory = "spec/config/initializers"
17
+ TestSinatraApplication.config_directory.should == "spec/config/initializers"
18
+ end
19
+
20
+ it "registers an initializer for the test sinatra application" do
21
+ TestSinatraApplication.config_directory = "spec/config/initializers"
22
+ Test::THAT_I_EXIST.should == true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Sinatra::Initializers do
4
+ it 'is the latest version' do
5
+ Sinatra::Initializers.version.should == '0.1.1'
6
+ end
7
+ end
8
+
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'rspec'
4
+ require 'sinatra-initializers'
5
+
6
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
7
+
8
+ RSpec.configure do |config|
9
+ end
10
+
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-initializers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chad W Pry
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-29 00:00:00.000000000 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ requirement: &2161631900 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *2161631900
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: &2161631440 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *2161631440
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ requirement: &2161631020 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *2161631020
48
+ description: Rails like initialization
49
+ email: chad.pry@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.rdoc
55
+ files:
56
+ - .document
57
+ - .gitignore
58
+ - CHANGES
59
+ - LICENSE
60
+ - README.rdoc
61
+ - VERSION
62
+ - lib/sinatra-initializers.rb
63
+ - lib/sinatra-initializers/version.rb
64
+ - sinatra-initializers.gemspec
65
+ - Gemfile
66
+ - Rakefile
67
+ - spec/config/initializers/test.rb
68
+ - spec/sinatra-initializers/sinatra-initializers_spec.rb
69
+ - spec/sinatra-initializers/version_spec.rb
70
+ - spec/spec_helper.rb
71
+ has_rdoc: true
72
+ homepage: http://github.com/chadwpry/sinatra-initializers
73
+ licenses: []
74
+ post_install_message:
75
+ rdoc_options:
76
+ - --charset=UTF-8
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 1.6.2
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: A Sinatra Extension that follows a pattern of rails initializers
97
+ test_files:
98
+ - spec/config/initializers/test.rb
99
+ - spec/sinatra-initializers/sinatra-initializers_spec.rb
100
+ - spec/sinatra-initializers/version_spec.rb
101
+ - spec/spec_helper.rb