fm_store 0.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/LICENSE +13 -0
- data/README.rdoc +211 -0
- data/lib/fm_store.rb +35 -0
- data/lib/fm_store/associations.rb +44 -0
- data/lib/fm_store/associations/belongs_to.rb +36 -0
- data/lib/fm_store/associations/has_many.rb +39 -0
- data/lib/fm_store/associations/options.rb +30 -0
- data/lib/fm_store/associations/proxy.rb +17 -0
- data/lib/fm_store/builders/collection.rb +33 -0
- data/lib/fm_store/builders/single.rb +25 -0
- data/lib/fm_store/components.rb +19 -0
- data/lib/fm_store/config.rb +19 -0
- data/lib/fm_store/connection.rb +23 -0
- data/lib/fm_store/criteria.rb +98 -0
- data/lib/fm_store/criterion/exclusion.rb +24 -0
- data/lib/fm_store/criterion/inclusion.rb +255 -0
- data/lib/fm_store/criterion/optional.rb +46 -0
- data/lib/fm_store/ext/field.rb +20 -0
- data/lib/fm_store/field.rb +14 -0
- data/lib/fm_store/fields.rb +36 -0
- data/lib/fm_store/finders.rb +36 -0
- data/lib/fm_store/layout.rb +156 -0
- data/lib/fm_store/paging.rb +27 -0
- data/lib/fm_store/persistence.rb +109 -0
- data/lib/fm_store/railtie.rb +17 -0
- data/lib/fm_store/version.rb +4 -0
- data/lib/generators/fm_model/fm_model_generator.rb +28 -0
- data/lib/generators/fm_model/templates/model.rb +10 -0
- metadata +95 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Rails #:nodoc:
|
4
|
+
module FmStore #:nodoc:
|
5
|
+
class Railtie < Rails::Railtie #:nodoc:
|
6
|
+
initializer "setup database" do
|
7
|
+
config_file = Rails.root.join("config", "fm_store.yml")
|
8
|
+
|
9
|
+
if config_file.file?
|
10
|
+
settings = YAML.load(ERB.new(config_file.read).result)[Rails.env]
|
11
|
+
config = ::FmStore::Config.instance
|
12
|
+
config.set_settings(settings)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class FmModelGenerator < Rails::Generators::NamedBase
|
4
|
+
argument :layout_name, :type => :string, :required => true
|
5
|
+
argument :database_name, :type => :string, :required => true
|
6
|
+
|
7
|
+
def create_model_file
|
8
|
+
config = FmStore::Config.instance
|
9
|
+
|
10
|
+
server = Rfm::Server.new({
|
11
|
+
:host => config.host,
|
12
|
+
:account_name => config.account_name,
|
13
|
+
:password => config.password,
|
14
|
+
:ssl => config.ssl,
|
15
|
+
:log_actions => config.log_actions
|
16
|
+
})
|
17
|
+
|
18
|
+
conn = server[database_name][layout_name]
|
19
|
+
|
20
|
+
@fields = conn.any.first.keys
|
21
|
+
|
22
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.source_root
|
26
|
+
File.join(File.dirname(__FILE__), 'templates')
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class <%= file_name.classify %>
|
2
|
+
include FmStore::Layout
|
3
|
+
|
4
|
+
set_layout "<%= layout_name %>"
|
5
|
+
set_database "<%= database_name %>"
|
6
|
+
|
7
|
+
<% @fields.each do |field| -%>
|
8
|
+
field :<%= field.parameterize.underscore %>, String, :fm_name => "<%= field %>"
|
9
|
+
<% end -%>
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fm_store
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Swee Me Chai
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activemodel
|
16
|
+
requirement: &70120328487200 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70120328487200
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: will_paginate
|
27
|
+
requirement: &70120328481000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.pre
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70120328481000
|
36
|
+
description: FmStore allow ActiveRecord-like read/write access to a FileMaker database.
|
37
|
+
email:
|
38
|
+
- mech@me.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- lib/fm_store/associations/belongs_to.rb
|
44
|
+
- lib/fm_store/associations/has_many.rb
|
45
|
+
- lib/fm_store/associations/options.rb
|
46
|
+
- lib/fm_store/associations/proxy.rb
|
47
|
+
- lib/fm_store/associations.rb
|
48
|
+
- lib/fm_store/builders/collection.rb
|
49
|
+
- lib/fm_store/builders/single.rb
|
50
|
+
- lib/fm_store/components.rb
|
51
|
+
- lib/fm_store/config.rb
|
52
|
+
- lib/fm_store/connection.rb
|
53
|
+
- lib/fm_store/criteria.rb
|
54
|
+
- lib/fm_store/criterion/exclusion.rb
|
55
|
+
- lib/fm_store/criterion/inclusion.rb
|
56
|
+
- lib/fm_store/criterion/optional.rb
|
57
|
+
- lib/fm_store/ext/field.rb
|
58
|
+
- lib/fm_store/field.rb
|
59
|
+
- lib/fm_store/fields.rb
|
60
|
+
- lib/fm_store/finders.rb
|
61
|
+
- lib/fm_store/layout.rb
|
62
|
+
- lib/fm_store/paging.rb
|
63
|
+
- lib/fm_store/persistence.rb
|
64
|
+
- lib/fm_store/railtie.rb
|
65
|
+
- lib/fm_store/version.rb
|
66
|
+
- lib/fm_store.rb
|
67
|
+
- lib/generators/fm_model/fm_model_generator.rb
|
68
|
+
- lib/generators/fm_model/templates/model.rb
|
69
|
+
- LICENSE
|
70
|
+
- README.rdoc
|
71
|
+
homepage: http://www.jobline.com.sg
|
72
|
+
licenses: []
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.3.6
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project: fm_store
|
91
|
+
rubygems_version: 1.8.12
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: ActiveRecord-like access for FileMaker r/w.
|
95
|
+
test_files: []
|