sinatra-environments 0.0.1

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
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,25 @@
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
+ Gemfile.lock
22
+ *.gem
23
+
24
+ ## PROJECT::SPECIFIC
25
+ spec/fixtures/
data/CHANGES ADDED
@@ -0,0 +1,3 @@
1
+ rel 0.1.0 (2013-07-11)
2
+
3
+ * intial release of gem / code
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2011 Chad W Pry
2
+ Copyright (c) 2013 Christopher H. Laco
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,85 @@
1
+ = Sinatra::Environments
2
+
3
+ A Sinatra Extension that sets up rails like environments
4
+
5
+ == Installation
6
+
7
+ $ gem install sinatra-environments
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-environments'
29
+
30
+ class YourApp < Sinatra::Base
31
+
32
+ register Sinatra::Environments
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-environments'
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/environments"
49
+
50
+ Add environment scripts in config/environments. If config/environment.rb exists,
51
+ it will be loaded before any specific environment file.
52
+
53
+ config/environment.rb
54
+ config/environments/development.rb
55
+
56
+ == More detail needed?
57
+
58
+ Contact me via email!
59
+
60
+
61
+ == Errors / Bugs
62
+
63
+ If something is not behaving intuitively, it is a bug, and should be reported.
64
+ Report it here: http://github.com/claco/sinatra-environments/issues
65
+
66
+
67
+ == TODOs
68
+
69
+ * TBD
70
+
71
+
72
+ == Note on Patches/Pull Requests
73
+
74
+ * Fork the project.
75
+ * Make your feature addition or bug fix.
76
+ * Commit, do not mess with rakefile, version, or history.
77
+ * (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)
78
+ * Send me a pull request. Bonus points for topic branches.
79
+
80
+ == Copyright
81
+
82
+ Copyright (c) 2011 Chad W Pry. Released under the MIT License.
83
+ Copyright (c) 2013 Christopher H. Laco. 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.0.1
@@ -0,0 +1,10 @@
1
+ module Sinatra
2
+ module Environments
3
+ VERSION = '0.0.1' unless const_defined?(:VERSION)
4
+
5
+ def self.version
6
+ VERSION
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,28 @@
1
+ require 'sinatra/base'
2
+ require 'sinatra-environments/version'
3
+
4
+ module Sinatra
5
+ class Base
6
+ set(:config_directory, "config/environments")
7
+ end
8
+
9
+ module Environments
10
+ def config_directory= path
11
+ super
12
+ register Sinatra::Environments
13
+ end
14
+
15
+ def self.registered app
16
+ environment_file = File.join(app.config_directory, "../environment.rb")
17
+
18
+ if File.exists?(environment_file)
19
+ require File.join(Dir.pwd, environment_file)
20
+ end
21
+
22
+ Dir["#{app.config_directory}/**/*.rb"].each do |file_path|
23
+ require File.join(Dir.pwd, file_path)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -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-environments}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Christopher H. Laco", "Chad W Pry"]
12
+ s.date = %q{2013-07-11}
13
+ s.description = %q{Rails like environments}
14
+ s.email = %q{claco@chrislaco.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-environments.rb",
27
+ "lib/sinatra-environments/version.rb",
28
+ "sinatra-environments.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/claco/sinatra-environments}
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 environments}
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_ENVIRONMENT_EXISTS = true
3
+ end
@@ -0,0 +1,3 @@
1
+ module Test
2
+ THAT_TEST_ENVIRONMENT_EXISTS = true
3
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Sinatra::Environments do
4
+ class TestSinatraApplication < Sinatra::Base
5
+ register Sinatra::Environments
6
+ end
7
+
8
+ describe "using base settings" do
9
+ it "defaults the setting config_directory to config/environments" do
10
+ Sinatra::Base.config_directory.should == "config/environments"
11
+ end
12
+ end
13
+
14
+ describe "using an example environment" do
15
+ it "allows you to override config_directory" do
16
+ TestSinatraApplication.config_directory = "spec/config/environments"
17
+ TestSinatraApplication.config_directory.should == "spec/config/environments"
18
+ end
19
+
20
+ it "registers an environment for the test sinatra application" do
21
+ TestSinatraApplication.config_directory = "spec/config/environments"
22
+ Test::THAT_ENVIRONMENT_EXISTS.should == true
23
+ Test::THAT_TEST_ENVIRONMENT_EXISTS.should == true
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Sinatra::Environments do
4
+ it 'is the latest version' do
5
+ Sinatra::Environments.version.should == '0.0.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-environments'
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,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-environments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christopher H. Laco
9
+ - Chad W Pry
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-07-11 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ requirement: !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: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ description: Rails like environments
64
+ email: claco@chrislaco.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files:
68
+ - LICENSE
69
+ - README.rdoc
70
+ files:
71
+ - .document
72
+ - .gitignore
73
+ - CHANGES
74
+ - LICENSE
75
+ - README.rdoc
76
+ - VERSION
77
+ - lib/sinatra-environments.rb
78
+ - lib/sinatra-environments/version.rb
79
+ - sinatra-environments.gemspec
80
+ - Gemfile
81
+ - Rakefile
82
+ - spec/config/environment.rb
83
+ - spec/config/environments/test.rb
84
+ - spec/sinatra-environments/sinatra-environments_spec.rb
85
+ - spec/sinatra-environments/version_spec.rb
86
+ - spec/spec_helper.rb
87
+ homepage: http://github.com/claco/sinatra-environments
88
+ licenses: []
89
+ post_install_message:
90
+ rdoc_options:
91
+ - --charset=UTF-8
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ segments:
101
+ - 0
102
+ hash: -4023376974684312126
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 1.8.25
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: A Sinatra Extension that follows a pattern of rails environments
115
+ test_files:
116
+ - spec/config/environment.rb
117
+ - spec/config/environments/test.rb
118
+ - spec/sinatra-environments/sinatra-environments_spec.rb
119
+ - spec/sinatra-environments/version_spec.rb
120
+ - spec/spec_helper.rb