utilio 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +56 -5
- data/VERSION +1 -1
- data/utilio.gemspec +64 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -1,9 +1,60 @@
|
|
1
|
-
|
1
|
+
# Utilio #
|
2
2
|
|
3
|
-
|
3
|
+
A general collection of application utilities for dealing with paths and active_record.
|
4
|
+
|
5
|
+
## Installation ##
|
6
|
+
|
7
|
+
Use rubygems, like a good boy should.
|
8
|
+
|
9
|
+
install gem utilio
|
10
|
+
|
11
|
+
## Usage ##
|
12
|
+
|
13
|
+
### Path Utilities ###
|
14
|
+
|
15
|
+
Path utilities mainly for root and app. Also a simple helper for loading yaml files from the root of your app.
|
16
|
+
|
17
|
+
# file: /code/myapp/myapp.rb
|
18
|
+
require 'utilio'
|
19
|
+
|
20
|
+
Set root to an absolute or relative location. If you choose not to set the root path, Utilio assumes' it's the directory of the running ruby file (e.g. `File.dirname($0)`).
|
21
|
+
|
22
|
+
Utilio::Path.root = File.dirname(__FILE__)
|
23
|
+
Utilio::Path.root = '/some/random/dir'
|
24
|
+
|
25
|
+
Read the root path:
|
26
|
+
|
27
|
+
Utilio::Path.root
|
28
|
+
|
29
|
+
Concatenating paths onto root path (ala File#join). Note that this doesn't modify subsequent calls to `Utilio::Path.root`.
|
30
|
+
|
31
|
+
Utilio::Path.root 'db', 'migrate' #=> /code/myapp/myapp/db/migrate
|
32
|
+
|
33
|
+
App folder shortcut (equivalent to doing `Utilio::Path.root 'app', ...`):
|
34
|
+
|
35
|
+
Utilio::Path.app 'models' #=> /code/myapp/myapp/app/models
|
36
|
+
|
37
|
+
Loading yaml file contents (see YAML#load_file):
|
38
|
+
|
39
|
+
Utilio::Path.yaml_file 'config', 'settings.yml'
|
40
|
+
|
41
|
+
### Database Utilities ###
|
42
|
+
|
43
|
+
Database utilities for simple config loading. Note that this depends on Utilio::Path.root, so set that if you need to.
|
44
|
+
|
45
|
+
# file /code/myapp/myapp.rb
|
46
|
+
require 'utilio'
|
47
|
+
|
48
|
+
Load the configuration file from it's default location ({ROOT}/config/database.yml). Note this gives you the full file contents (all env's).
|
49
|
+
|
50
|
+
Utilio::Database.config
|
51
|
+
|
52
|
+
You can specify the specific env to use as well as the location of the file for all you misfits out there who just happen to call your config directory `conf`. Creepy.
|
53
|
+
|
54
|
+
Utilio::Database.config :environment => ENV['RACK_ENV'], :file => 'some_random_directory/database.yml'
|
55
|
+
|
56
|
+
## Note on Patches/Pull Requests ##
|
4
57
|
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
58
|
* Fork the project.
|
8
59
|
* Make your feature addition or bug fix.
|
9
60
|
* Add tests for it. This is important so I don't break it in a
|
@@ -12,6 +63,6 @@ Description goes here.
|
|
12
63
|
(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)
|
13
64
|
* Send me a pull request. Bonus points for topic branches.
|
14
65
|
|
15
|
-
|
66
|
+
## Copyright ##
|
16
67
|
|
17
68
|
Copyright (c) 2010 BJ Neilsen. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/utilio.gemspec
ADDED
@@ -0,0 +1,64 @@
|
|
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{utilio}
|
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 = ["BJ Neilsen"]
|
12
|
+
s.date = %q{2010-08-06}
|
13
|
+
s.description = %q{}
|
14
|
+
s.email = %q{bj.neilsen@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".bundle/config",
|
21
|
+
".bundle/environment.rb",
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE",
|
27
|
+
"README.md",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"lib/utilio.rb",
|
31
|
+
"lib/utilio/database.rb",
|
32
|
+
"lib/utilio/path.rb",
|
33
|
+
"spec/data/database.yml",
|
34
|
+
"spec/data/path.yml",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"spec/utilio_database_spec.rb",
|
37
|
+
"spec/utilio_path_spec.rb",
|
38
|
+
"utilio.gemspec"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://www.rand9.com}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.7}
|
44
|
+
s.summary = %q{A general collection of application utilities for dealing with paths and active_record}
|
45
|
+
s.test_files = [
|
46
|
+
"spec/spec_helper.rb",
|
47
|
+
"spec/utilio_database_spec.rb",
|
48
|
+
"spec/utilio_path_spec.rb"
|
49
|
+
]
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
59
|
+
end
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- BJ Neilsen
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- spec/spec_helper.rb
|
61
61
|
- spec/utilio_database_spec.rb
|
62
62
|
- spec/utilio_path_spec.rb
|
63
|
+
- utilio.gemspec
|
63
64
|
has_rdoc: true
|
64
65
|
homepage: http://www.rand9.com
|
65
66
|
licenses: []
|