railsmdb 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ require 'mongoid'
2
+
3
+ Mongoid.configure do
4
+ target_version = "<%= Mongoid::VERSION[/^\d+\.\d+/] %>"
5
+
6
+ # Load Mongoid behavior defaults. This automatically sets
7
+ # feature flags (refer to documentation)
8
+ config.load_defaults target_version
9
+
10
+ # It is recommended to use config/mongoid.yml for most Mongoid-related
11
+ # configuration, whenever possible, but if you prefer, you can set
12
+ # configuration values here, instead:
13
+ #
14
+ # config.log_level = :debug
15
+ #
16
+ # Note that the settings in config/mongoid.yml always take precedence,
17
+ # whatever else is set here.
18
+ end
19
+
20
+ # Enable Mongo driver query cache for Rack
21
+ # Rails.application.config.middleware.use(Mongo::QueryCache::Middleware)
22
+
23
+ # Enable Mongo driver query cache for ActiveJob
24
+ # ActiveSupport.on_load(:active_job) do
25
+ # include Mongo::QueryCache::Middleware::ActiveJob
26
+ # end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/concern'
4
+
5
+ module Railsmdb
6
+ # Defines the behavior for extending the Thor framework to allow commands
7
+ # to be reprioritized--ensuring they run immediately before or after
8
+ # another command.
9
+ module Prioritizable
10
+ extend ActiveSupport::Concern
11
+
12
+ # rubocop:disable Metrics/BlockLength
13
+ class_methods do
14
+ # Override all_commands to return a new hash with the keys in priority
15
+ # order.
16
+ #
17
+ # @return [ Hash ] the commands in priority order
18
+ #
19
+ # rubocop:disable Naming/MemoizedInstanceVariableName
20
+ def all_commands
21
+ @prioritized_all_commands ||= begin
22
+ commands = super.dup
23
+
24
+ aside = priorities.keys
25
+ ordered = commands.slice!(*aside)
26
+
27
+ {}.tap do |prioritized|
28
+ ordered.each do |key, command|
29
+ add_prioritized_command(prioritized, key, command)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ # rubocop:enable Naming/MemoizedInstanceVariableName
35
+
36
+ # @return [ Hash<String, Array<Symbol, Command>> ] the declared priorities, with
37
+ # each task name referencing a 2-tuple of [priority, command].
38
+ #
39
+ # @api private
40
+ def priorities
41
+ @priorities ||= {}
42
+ end
43
+
44
+ # @return [ Hash<String, Hash<(:before|:after), Array>> ] the declared
45
+ # priorities, organized by the task they are relative to.
46
+ #
47
+ # @api private
48
+ def priorities_by_relative_task
49
+ @priorities_by_relative_task ||= {}
50
+ end
51
+
52
+ # Specify that `task` should run before or after another task.
53
+ #
54
+ # @param [ String | Symbol ] task the task to prioritize.
55
+ # @param [ :before | :after ] priority the priority to use
56
+ # @param [ String | Symbol ] other_task the task relative to which to prioritize `task`
57
+ def prioritize(task, priority, other_task)
58
+ raise ArgumentError, 'priority must be either of :before or :after' if priority != :before && priority != :after
59
+
60
+ task = task.to_s
61
+ other_task = other_task.to_s
62
+
63
+ priorities[task] = [ priority, other_task ]
64
+ priorities_by_relative_task[other_task] ||= { before: [], after: [] }
65
+ priorities_by_relative_task[other_task][priority].push task
66
+
67
+ @prioritized_all_commands = nil
68
+ end
69
+
70
+ private
71
+
72
+ # Adds the given [key, command] pair to the commands mapping, but
73
+ # first recursively considers if any other tasks need to be added
74
+ # before it. Then, after adding [key, command], it recursively
75
+ # considers if any other tasks need to be added after it.
76
+ #
77
+ # @param [ Hash ] commands the mapping of task names to command
78
+ # objects.
79
+ # @param [ String ] key the name of the task to add
80
+ # @param [ Object ] command the command object
81
+ def add_prioritized_command(commands, key, command)
82
+ priorities = priorities_by_relative_task[key] || {}
83
+
84
+ (priorities[:before] || []).each do |earlier|
85
+ add_prioritized_command(commands, earlier, all_tasks[earlier])
86
+ end
87
+
88
+ commands[key] = command
89
+
90
+ (priorities[:after] || []).each do |later|
91
+ add_prioritized_command(commands, later, all_tasks[later])
92
+ end
93
+ end
94
+ end
95
+ # rubocop:enable Metrics/BlockLength
96
+ end
97
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Railsmdb
4
+ module Version
5
+ MAJOR = 1
6
+ MINOR = 0
7
+ PATCH = 0
8
+ SUFFIX = 'alpha1' # pre-release, alpha, beta, etc.
9
+
10
+ STRING = [ MAJOR, MINOR, PATCH, SUFFIX ].compact.join('.')
11
+ end
12
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ �g�y�ѵ�����鲝� ����՛�7CRS��l�rU�~v�l�<¡�*��V���'�M�g�
2
+ ^�>ђ�rn�
3
+ ΫI���dY̦91�>���}���Q,
4
+ �PER�hp�`�+`��h�u+ڈZ��d:���]h.�MP<2�ح/�w2a�
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: railsmdb
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - The MongoDB Ruby Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMREwDwYDVQQDDAhkYngt
14
+ cnVieTEXMBUGCgmSJomT8ixkARkWB21vbmdvZGIxEzARBgoJkiaJk/IsZAEZFgNj
15
+ b20wHhcNMjMwMTMxMTE1NjM1WhcNMjQwMTMxMTE1NjM1WjBBMREwDwYDVQQDDAhk
16
+ YngtcnVieTEXMBUGCgmSJomT8ixkARkWB21vbmdvZGIxEzARBgoJkiaJk/IsZAEZ
17
+ FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC0/Veq9l47cTfX
18
+ tQ+kHq2NOCwJuJGt1iXWQ/vH/yp7pZ/bLej7gPDl2CfIngAXRjM7r1FkR9ya7VAm
19
+ IneBFcVU3HhpIXWi4ByXGjBOXFD1Dfbz4C4zedIWRk/hNzXa+rQY4KPwpOwG/hZg
20
+ id+rSXWSbNlkyN97XfonweVh7JsIa9X/2JY9ADYjhCfEZF+b0+Wl7+jgwzLWb46I
21
+ 0WH0bZBIZ0BbKAwUXIgvq5mQf9PzukmMVYCwnkJ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
+ -----END CERTIFICATE-----
38
+ date: 2023-09-14 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: rails
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '7.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '7.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: os
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.1'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.1'
68
+ - !ruby/object:Gem::Dependency
69
+ name: faraday
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.7'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.7'
82
+ - !ruby/object:Gem::Dependency
83
+ name: minitar
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.9'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.9'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rubyzip
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.3'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.3'
110
+ - !ruby/object:Gem::Dependency
111
+ name: mongoid
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '8.0'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '8.0'
124
+ description: A CLI for assisting Rails programmers in creating and managing Rails
125
+ projects that use Mongoid and MongoDB as the datastore.
126
+ email: dbx-ruby@mongodb.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - LICENSE
132
+ - README.md
133
+ - Rakefile
134
+ - lib/railsmdb/cli.rb
135
+ - lib/railsmdb/commands.rb
136
+ - lib/railsmdb/commands/dbconsole/dbconsole_command.rb
137
+ - lib/railsmdb/commands/setup/setup_command.rb
138
+ - lib/railsmdb/crypt_shared/catalog.rb
139
+ - lib/railsmdb/crypt_shared/listing.rb
140
+ - lib/railsmdb/downloader.rb
141
+ - lib/railsmdb/ext/rails/command.rb
142
+ - lib/railsmdb/ext/rails/command/behavior.rb
143
+ - lib/railsmdb/ext/rails/generators.rb
144
+ - lib/railsmdb/ext/rails/generators/rails/app/app_generator.rb
145
+ - lib/railsmdb/extractor.rb
146
+ - lib/railsmdb/generators/mongoid/model/model_generator.rb
147
+ - lib/railsmdb/generators/mongoid/model/templates/model.rb.tt
148
+ - lib/railsmdb/generators/setup/concerns/setuppable.rb
149
+ - lib/railsmdb/generators/setup/setup_generator.rb
150
+ - lib/railsmdb/generators/setup/templates/README.md.tt
151
+ - lib/railsmdb/generators/setup/templates/_bin/railsmdb.tt
152
+ - lib/railsmdb/generators/setup/templates/_config/initializers/mongoid.rb.tt
153
+ - lib/railsmdb/prioritizable.rb
154
+ - lib/railsmdb/version.rb
155
+ homepage: ''
156
+ licenses:
157
+ - Apache-2.0
158
+ metadata:
159
+ rubygems_mfa_required: 'true'
160
+ bug_tracker_uri: https://jira.mongodb.org/projects/MONGOID
161
+ changelog_uri: https://github.com/mongodb/mongoid-railsmdb/releases
162
+ source_code_uri: https://github.com/mongodb/mongoid-railsmdb
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '3.0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">"
175
+ - !ruby/object:Gem::Version
176
+ version: 1.3.1
177
+ requirements: []
178
+ rubygems_version: 3.4.19
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: CLI for creating and managing Rails projects that use Mongoid
182
+ test_files: []
metadata.gz.sig ADDED
Binary file