mongo_model 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README +0 -0
- data/README.rdoc +17 -0
- data/lib/generators/mongo_model/mongo_model_generator.rb +13 -0
- data/lib/generators/mongo_model/templates/model.rb +7 -0
- data/spec/mongo_model_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- data/test/generators/mongo_modl/mongo_modl_generator_test.rb +30 -0
- data/test/test_helper.rb +2 -0
- metadata +73 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Kristian Mandrup
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= mongo_modl
|
2
|
+
|
3
|
+
Rails 3 generator to generate Mongo DB models
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(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
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Kristian Mandrup. See LICENSE for details.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class MongoModelGenerator < Rails::Generators::NamedBase
|
2
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
3
|
+
|
4
|
+
def self.source_root
|
5
|
+
@source_root ||= File.expand_path('../templates', __FILE__)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_model_file
|
9
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
# hook_for :test_framework
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/mongo_modl/mongo_modl_generator'
|
3
|
+
|
4
|
+
class ColorboxGeneratorTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@destination = File.join('tmp', 'test_app')
|
8
|
+
@source = ColorboxGenerator.source_root
|
9
|
+
|
10
|
+
ColorboxGenerator.start('', :destination_root => @destination)
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
FileUtils.rm_rf(@destination)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def test_install_colorbox
|
19
|
+
assert File.exists?(
|
20
|
+
File.join(@destination, 'public', 'javascripts', 'jquery.colorbox-min.js')
|
21
|
+
)
|
22
|
+
|
23
|
+
assert_equal(
|
24
|
+
File.read(File.join(@source, 'jquery.colorbox-min.js')),
|
25
|
+
File.read(File.join(@destination, 'public', 'javascripts', 'jquery.colorbox-min.js'))
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mongo_model
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kristian Mandrup
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-26 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.9
|
24
|
+
version:
|
25
|
+
description: Rails 3 model generator Mongo DB
|
26
|
+
email: kmandrup@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README
|
34
|
+
- README.rdoc
|
35
|
+
files:
|
36
|
+
- lib/generators/mongo_model/mongo_model_generator.rb
|
37
|
+
- lib/generators/mongo_model/templates/model.rb
|
38
|
+
- LICENSE
|
39
|
+
- README
|
40
|
+
- README.rdoc
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/kristianmandrup/mongo_model_r3
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --charset=UTF-8
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.3.5
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Rails 3 model generator Mongo DB
|
69
|
+
test_files:
|
70
|
+
- spec/mongo_model_spec.rb
|
71
|
+
- spec/spec_helper.rb
|
72
|
+
- test/generators/mongo_modl/mongo_modl_generator_test.rb
|
73
|
+
- test/test_helper.rb
|