sandra-rails 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sandra-rails.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ require "generators/sandra"
2
+
3
+ module Sandra
4
+ module Generators
5
+
6
+ class ModelGenerator < Base
7
+ argument :model_key, :type => :string, :default => "key"
8
+ argument :columns, :type => :hash, :default => [], :banner => "field:type field:type"
9
+
10
+ check_class_collision
11
+
12
+ def create_model_file
13
+ template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
14
+ end
15
+
16
+ hook_for :test_framework
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ class <%= class_name %>
2
+ include Sandra
3
+
4
+ key_attribute :<%= model_key.split(":").first %>, :<%= model_key.split(":").last %>
5
+ <% columns.each do |column, type| %>
6
+ column :<%= column %>, :<%= type %>
7
+ <% end %>
8
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails/generators/named_base'
2
+
3
+ module Sandra
4
+ module Generators
5
+
6
+ class Base < ::Rails::Generators::NamedBase
7
+
8
+ def self.source_root
9
+ @_sandra_source_root ||=
10
+ File.expand_path("../#{base_name}/#{generator_name}/templates", __FILE__)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'sandra'
2
+ require 'rails'
3
+ require 'active_model/railtie'
4
+
5
+ require 'action_controller/railtie'
6
+
7
+ module Rails
8
+ module Sandra
9
+
10
+ class Railtie < Rails::Railtie
11
+ config.app_generators.orm = :sandra
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Sandra
2
+ module Rails
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "sandra-rails/railtie"
2
+
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sandra-rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sandra-rails"
7
+ s.version = Sandra::Rails::VERSION
8
+ s.authors = ["Charles Max Wood"]
9
+ s.email = ["chuck@teachmetocode.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Connect Sandra with Rails}
12
+ s.description = %q{Connect Sandra with Rails}
13
+
14
+ s.rubyforge_project = "sandra-rails"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_runtime_dependency "sandra"
23
+ s.add_runtime_dependency "actionpack", ["~> 3.1.0"]
24
+ s.add_runtime_dependency "railties", ["~> 3.1.0"]
25
+ # s.add_runtime_dependency "rest-client"
26
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sandra-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Charles Max Wood
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sandra
16
+ requirement: &70350906271640 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70350906271640
25
+ - !ruby/object:Gem::Dependency
26
+ name: actionpack
27
+ requirement: &70350906270820 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 3.1.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70350906270820
36
+ - !ruby/object:Gem::Dependency
37
+ name: railties
38
+ requirement: &70350906270020 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70350906270020
47
+ description: Connect Sandra with Rails
48
+ email:
49
+ - chuck@teachmetocode.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - Rakefile
57
+ - lib/generators/sandra.rb
58
+ - lib/generators/sandra/model/model_generator.rb
59
+ - lib/generators/sandra/model/templates/model.rb
60
+ - lib/sandra-rails.rb
61
+ - lib/sandra-rails/railtie.rb
62
+ - lib/sandra-rails/version.rb
63
+ - sandra-rails.gemspec
64
+ homepage: ''
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project: sandra-rails
84
+ rubygems_version: 1.8.6
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Connect Sandra with Rails
88
+ test_files: []