Skip to content

Commit bec932c

Browse files
author
Curtis Schiewek
committed
initial commit with first generator method
0 parents  commit bec932c

File tree

11 files changed

+148
-0
lines changed

11 files changed

+148
-0
lines changed

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
.yardoc
6+
Gemfile.lock
7+
InstalledFiles
8+
_yardoc
9+
coverage
10+
doc/
11+
lib/bundler/man
12+
pkg
13+
rdoc
14+
spec/reports
15+
test/tmp
16+
test/version_tmp
17+
tmp

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format progress

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in geocoder-oracle.gemspec
4+
gemspec

LICENSE.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 Curtis Schiewek
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following 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 OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Geocoder::Oracle
2+
3+
TODO: Write a gem description
4+
5+
## Installation
6+
7+
Add this line to your application's Gemfile:
8+
9+
gem 'geocoder-oracle'
10+
11+
And then execute:
12+
13+
$ bundle
14+
15+
Or install it yourself as:
16+
17+
$ gem install geocoder-oracle
18+
19+
## Usage
20+
21+
TODO: Write usage instructions here
22+
23+
## Contributing
24+
25+
1. Fork it
26+
2. Create your feature branch (`git checkout -b my-new-feature`)
27+
3. Commit your changes (`git commit -am 'Add some feature'`)
28+
4. Push to the branch (`git push origin my-new-feature`)
29+
5. Create new Pull Request

Rakefile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require "bundler/gem_tasks"

geocoder-oracle.gemspec

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# coding: utf-8
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'geocoder/oracle/version'
5+
6+
Gem::Specification.new do |spec|
7+
spec.name = "geocoder-oracle"
8+
spec.version = Geocoder::Oracle::VERSION
9+
spec.authors = ["Curtis Schiewek"]
10+
spec.email = ["[email protected]"]
11+
spec.description = %q{Adds Oracle support to the geocoder gem}
12+
spec.summary = spec.description
13+
spec.homepage = ""
14+
spec.license = "MIT"
15+
16+
spec.files = `git ls-files`.split($/)
17+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19+
spec.require_paths = ["lib"]
20+
21+
spec.add_development_dependency "bundler", "~> 1.3"
22+
spec.add_development_dependency "rake"
23+
spec.add_development_dependency "rspec"
24+
25+
spec.add_dependency "geocoder", "~> 1.1"
26+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'rails/generators'
2+
3+
module Geocoder
4+
module Oracle
5+
class FunctionsGenerator < Rails::Generators::Base
6+
ActiveRecord::Base.establish_connection
7+
8+
desc 'Creates a custom functions required for geocoding in the Oracle database'
9+
def pi_function
10+
function = %q(
11+
CREATE OR REPLACE FUNCTION PI
12+
RETURN NUMBER DETERMINISTIC IS
13+
PI NUMBER;
14+
BEGIN
15+
SELECT ACOS(-1) INTO PI FROM DUAL;
16+
RETURN PI;
17+
END PI;
18+
)
19+
ActiveRecord::Base.connection().execute(function)
20+
end
21+
end
22+
end
23+
end

lib/geocoder/oracle.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require "geocoder/oracle/version"
2+
3+
module Geocoder
4+
module Oracle
5+
6+
end
7+
end

lib/geocoder/oracle/version.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Geocoder
2+
module Oracle
3+
VERSION = "0.0.1"
4+
end
5+
end

spec/spec_helper.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
2+
RSpec.configure do |config|
3+
config.treat_symbols_as_metadata_keys_with_true_values = true
4+
config.run_all_when_everything_filtered = true
5+
config.filter_run :focus
6+
7+
# Run specs in random order to surface order dependencies. If you find an
8+
# order dependency and want to debug it, you can fix the order by providing
9+
# the seed, which is printed after each run.
10+
# --seed 1234
11+
config.order = 'random'
12+
end

0 commit comments

Comments
 (0)