easyfire 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.byebug_history +256 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/easyfire +5 -0
- data/bin/setup +8 -0
- data/easyfire.gemspec +40 -0
- data/lib/easyfire/cli.rb +23 -0
- data/lib/easyfire/easyfire_model.rb +140 -0
- data/lib/easyfire/renders/helpers.rb +68 -0
- data/lib/easyfire/renders/model.rb +32 -0
- data/lib/easyfire/renders/service.rb +30 -0
- data/lib/easyfire/renders/templates/model.java.erb +220 -0
- data/lib/easyfire/renders/templates/model.swift.erb +62 -0
- data/lib/easyfire/renders/templates/service.java.erb +43 -0
- data/lib/easyfire/renders/templates/service.swift.erb +92 -0
- data/lib/easyfire/renders.rb +7 -0
- data/lib/easyfire/thor/android/build.gradle.tt +100 -0
- data/lib/easyfire/thor/android/build.sbt.tt +17 -0
- data/lib/easyfire/thor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/easyfire/thor/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/lib/easyfire/thor/android/gradle.properties +2 -0
- data/lib/easyfire/thor/android/gradlew +160 -0
- data/lib/easyfire/thor/android/gradlew.bat +90 -0
- data/lib/easyfire/thor/android/pom.xml.tt +76 -0
- data/lib/easyfire/thor/android/settings.gradle.tt +1 -0
- data/lib/easyfire/thor/android/src/main/AndroidManifest.xml.tt +3 -0
- data/lib/easyfire/thor/android.rb +56 -0
- data/lib/easyfire/thor/android_helper/EasyfireDelegate.java.tt +10 -0
- data/lib/easyfire/thor/android_helper/EasyfireListDelegate.java.tt +11 -0
- data/lib/easyfire/thor/android_helper/ModelEF.java.tt +10 -0
- data/lib/easyfire/thor/android_helper/ServiceEF.java.tt +370 -0
- data/lib/easyfire/version.rb +3 -0
- data/lib/easyfire.rb +22 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aac44c199b21f0364bb40948073b4aff28a4f58e
|
4
|
+
data.tar.gz: cb07bce34ce48df856b405bfe1e4fa98742b2b64
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: abbae2b9e9f3000f3ed199ec5ec32a85d257210999bebf4f61677504266a2b571aff6e2a2f4149a933158a67e1a34aabb076485435b799ff03cb4b19ca0eb2fc
|
7
|
+
data.tar.gz: 5d6665f61f69b67d0d13f4503426755cc7293e83f6f663919ff73c5fa5ca0283e0a5fbdb87dd5d277b4b15db8bae5cc5c3ba9458ac724dc122ec2c1b9b692aea
|
data/.byebug_history
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
q
|
2
|
+
foo
|
3
|
+
foo = eval(content)
|
4
|
+
eval(content)
|
5
|
+
content
|
6
|
+
c
|
7
|
+
q
|
8
|
+
Q
|
9
|
+
File.dirname(__FILE__)
|
10
|
+
q
|
11
|
+
value[:type].gsub("EF","").to_sym
|
12
|
+
value[:type]
|
13
|
+
@parents
|
14
|
+
type_to_java_value(value[:type])
|
15
|
+
c
|
16
|
+
type_to_java_value(value[:type])
|
17
|
+
c
|
18
|
+
type_to_java_value(value[:type])
|
19
|
+
c
|
20
|
+
type_to_java_value(value[:type])
|
21
|
+
c
|
22
|
+
type_to_java_value(value[:type])
|
23
|
+
c
|
24
|
+
type_to_java_value(value[:type])
|
25
|
+
c
|
26
|
+
type_to_java_value(value[:type])
|
27
|
+
c
|
28
|
+
type_to_java_value(value[:type])
|
29
|
+
c
|
30
|
+
type_to_java_value(value[:type])
|
31
|
+
c
|
32
|
+
type_to_java_value(value[:type])
|
33
|
+
c
|
34
|
+
type_to_java_value(value[:type])
|
35
|
+
c
|
36
|
+
type_to_java_value(value[:type])
|
37
|
+
type_to_java_value(value[:type])c
|
38
|
+
c
|
39
|
+
type_to_java_value(value[:type])
|
40
|
+
c
|
41
|
+
type_to_java_value(value[:type])
|
42
|
+
c
|
43
|
+
type_to_java_value(value[:type])
|
44
|
+
c
|
45
|
+
type_to_java_value(value[:type])
|
46
|
+
c
|
47
|
+
type_to_java_value(value[:type])
|
48
|
+
c
|
49
|
+
type_to_java_value(value[:type])
|
50
|
+
c
|
51
|
+
type_to_java_value(value[:type])
|
52
|
+
q
|
53
|
+
@parents.map{|e| ""}.join(",")
|
54
|
+
@parents.map{|e| ""}
|
55
|
+
@parents
|
56
|
+
c
|
57
|
+
@parents
|
58
|
+
c
|
59
|
+
q
|
60
|
+
spec.parents
|
61
|
+
c
|
62
|
+
spec.parents
|
63
|
+
@class_name_ef
|
64
|
+
c
|
65
|
+
@class_name_ef
|
66
|
+
spec.parents
|
67
|
+
q
|
68
|
+
specq
|
69
|
+
spec.parents
|
70
|
+
c
|
71
|
+
spec.model_name
|
72
|
+
c
|
73
|
+
spec.model_name
|
74
|
+
c
|
75
|
+
spec.model_name
|
76
|
+
spec.name
|
77
|
+
c
|
78
|
+
spec.model_name
|
79
|
+
@spec
|
80
|
+
c
|
81
|
+
q
|
82
|
+
spec.model_name
|
83
|
+
c
|
84
|
+
spec.model_name
|
85
|
+
c
|
86
|
+
spec.model_name
|
87
|
+
spec
|
88
|
+
c
|
89
|
+
q
|
90
|
+
spec.model_name
|
91
|
+
q
|
92
|
+
spec
|
93
|
+
spec.name
|
94
|
+
spec
|
95
|
+
q
|
96
|
+
spec
|
97
|
+
q
|
98
|
+
spec
|
99
|
+
spec.instance_variable_get(:@ddescription)
|
100
|
+
spec.instance_variable_get(:@description)
|
101
|
+
spec.instance_variable_get
|
102
|
+
spec.get_instance_variables("@description")
|
103
|
+
spec.get_instance_variable("@description")
|
104
|
+
spec.instance_variables
|
105
|
+
spec
|
106
|
+
c
|
107
|
+
q
|
108
|
+
spec
|
109
|
+
q
|
110
|
+
spec[1].attributesx
|
111
|
+
spec[1].attributes
|
112
|
+
spec[0]
|
113
|
+
spec
|
114
|
+
c
|
115
|
+
q
|
116
|
+
c
|
117
|
+
spec[1][:attributes].keys
|
118
|
+
spec
|
119
|
+
c
|
120
|
+
"#{attribute_name.to_s.uncapitalize}EFPath"
|
121
|
+
c
|
122
|
+
"#{attribute_name.to_s.uncapitalize}EFPath"
|
123
|
+
q
|
124
|
+
spec[1][:attributes].keys
|
125
|
+
spec[1][:attributes]
|
126
|
+
spec[1]["attributes"]
|
127
|
+
spec[1]
|
128
|
+
spec
|
129
|
+
q
|
130
|
+
c
|
131
|
+
@name
|
132
|
+
c
|
133
|
+
@name
|
134
|
+
c
|
135
|
+
@name
|
136
|
+
c
|
137
|
+
@name
|
138
|
+
c
|
139
|
+
@name
|
140
|
+
value
|
141
|
+
c
|
142
|
+
q
|
143
|
+
@@spec
|
144
|
+
c
|
145
|
+
@@spec
|
146
|
+
c
|
147
|
+
@@spec
|
148
|
+
text
|
149
|
+
c
|
150
|
+
@@spec
|
151
|
+
self.name
|
152
|
+
text
|
153
|
+
c
|
154
|
+
text
|
155
|
+
c
|
156
|
+
@@spec
|
157
|
+
c
|
158
|
+
@@spec
|
159
|
+
c
|
160
|
+
@@spec
|
161
|
+
c
|
162
|
+
@@spec
|
163
|
+
c
|
164
|
+
@@spec
|
165
|
+
c
|
166
|
+
@@spec
|
167
|
+
c
|
168
|
+
@@spec
|
169
|
+
c
|
170
|
+
@@spec
|
171
|
+
c
|
172
|
+
@@spec
|
173
|
+
c
|
174
|
+
@@spec["Grupo"]
|
175
|
+
@@spec.keys
|
176
|
+
@@spec.last
|
177
|
+
@@spec.count
|
178
|
+
@@spec["Chat"]
|
179
|
+
@@spec
|
180
|
+
c
|
181
|
+
@@spec
|
182
|
+
c
|
183
|
+
q
|
184
|
+
@@spec["Chat"]
|
185
|
+
@@spec
|
186
|
+
c
|
187
|
+
@@spec
|
188
|
+
c
|
189
|
+
q
|
190
|
+
@@spec
|
191
|
+
c
|
192
|
+
@@spec
|
193
|
+
@@spec["Chat"]
|
194
|
+
@@spec[self.name]["Chat"]
|
195
|
+
@@spec[self.name]["Chat"
|
196
|
+
self.name
|
197
|
+
@@spec.keys
|
198
|
+
c
|
199
|
+
@@spec[self.name] ||= Spec
|
200
|
+
@@spec[self.name]
|
201
|
+
self.name
|
202
|
+
@@spec
|
203
|
+
q
|
204
|
+
@@spec[self.name]
|
205
|
+
q
|
206
|
+
@@spec[self.name]
|
207
|
+
@@spec.keys
|
208
|
+
q
|
209
|
+
self.name
|
210
|
+
[self.name
|
211
|
+
q
|
212
|
+
@belongs_to[key.to_s.gsub(/EFPath/,'').camelcase.to_sym]q
|
213
|
+
@belongs_to[key.to_s.gsub(/EFPath/,'').camelcase.to_sym]
|
214
|
+
@belongs_to[key.to_s.gsub(/EFPath/,'')camelcase.to_sym]
|
215
|
+
key.to_s.gsub(/EFPath/,'').camelcase.to_sym
|
216
|
+
@belongs_to
|
217
|
+
key.to_s.gsub(/EFPath/,'').to_sym
|
218
|
+
@belongs_to[key.to_s.gsub(/EFPath/,'').to_sym]
|
219
|
+
key.to_s.end_with?("EFPath")
|
220
|
+
q
|
221
|
+
c
|
222
|
+
q
|
223
|
+
value
|
224
|
+
q
|
225
|
+
"#{attribute_name.to_s.uncapitalize}Path"
|
226
|
+
attribute_name.to_s.uncapitalize
|
227
|
+
attribute_name.to_s.undercapitalize
|
228
|
+
attribute_name.to_s
|
229
|
+
attribute_name
|
230
|
+
q
|
231
|
+
spec[1][:associations]
|
232
|
+
c
|
233
|
+
"asa".underscore
|
234
|
+
q
|
235
|
+
"asa".underscore
|
236
|
+
c
|
237
|
+
q
|
238
|
+
Renders::GEM_ROOTq
|
239
|
+
Renders::GEM_ROOT
|
240
|
+
q
|
241
|
+
y
|
242
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| "#{e[0].to_s}: #{e[1][:type]}"}.join("\n,")q
|
243
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| "#{e[0].to_s}: #{e[1][:type]}"}.join("\n,")
|
244
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| "#{e[0].to_s}: #{e[1][:type]}"}
|
245
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| "#{e[0].to_s}: e[1][:type]"}
|
246
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| "#{e[0].to_s}:"}
|
247
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| e[0].to_s}
|
248
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| e[0]}
|
249
|
+
Chat.to_spec[1][:attributes].to_a.map{|e| e[0]
|
250
|
+
Chat.to_spec[1][:attributes].to_a.count
|
251
|
+
Chat.to_spec[1][:attributes].to_a
|
252
|
+
Chat.to_spec[1][:attributes]
|
253
|
+
Chat.to_spec[1][:attributes].values
|
254
|
+
Chat.to_spec[1][:attributes]
|
255
|
+
Chat.to_spec[1][:attributes].map{|e| e}.map{|e| e[1]}
|
256
|
+
Chat.to_spec[1][:attributes].map{|e| e}.map{|e| e[0]}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at TODO: Write your email address. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Easyfire
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/easyfire`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'easyfire'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install easyfire
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/easyfire. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Easyfire project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/easyfire/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "easyfire"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/easyfire
ADDED
data/bin/setup
ADDED
data/easyfire.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "easyfire/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "easyfire"
|
8
|
+
spec.version = Easyfire::VERSION
|
9
|
+
spec.authors = ["Rodrigo Sol"]
|
10
|
+
spec.email = ["rodrigo@rarolabs.com.br"]
|
11
|
+
|
12
|
+
spec.summary = %q{High level models descriptions for Firebase Realtime Database}
|
13
|
+
spec.description = %q{This gem provides an abstraction layer to define Firebase Realtime Database models and basic services.
|
14
|
+
Once the model was defined you can generate a client library to Android, Swift and Javascript.}
|
15
|
+
spec.homepage = "http://www.rarolabs.com.br"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
# if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
# else
|
23
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
# "public gem pushes."
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_dependency "thor"
|
35
|
+
spec.add_dependency "activesupport"
|
36
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
37
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
38
|
+
spec.add_development_dependency "rspec", "~> 3.2"
|
39
|
+
spec.add_development_dependency "byebug"
|
40
|
+
end
|
data/lib/easyfire/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Easyfire
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
desc "android", "This will create a Easyfire client lib for android"
|
7
|
+
long_desc <<-ANDROID
|
8
|
+
|
9
|
+
android command will generate a gradle library contains all models and services
|
10
|
+
for firebase integration via Easyfire.
|
11
|
+
ANDROID
|
12
|
+
|
13
|
+
option :version
|
14
|
+
option :package
|
15
|
+
option :source
|
16
|
+
option :destination
|
17
|
+
option :group
|
18
|
+
option :artifact
|
19
|
+
def android
|
20
|
+
android = Android.new(options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
module Easyfire
|
2
|
+
class ModelSpec
|
3
|
+
attr_accessor :model_name, :description, :model_type, :parents, :attributes, :associations
|
4
|
+
def initialize()
|
5
|
+
@model_name = ""
|
6
|
+
@description = ""
|
7
|
+
@model_type = nil
|
8
|
+
@attributes = {}
|
9
|
+
@associations = {}
|
10
|
+
@parents = []
|
11
|
+
end
|
12
|
+
end
|
13
|
+
class EasyfireModel
|
14
|
+
|
15
|
+
attr_accessor :spec
|
16
|
+
|
17
|
+
def initialize()
|
18
|
+
@spec = ModelSpec.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def compile(&block)
|
22
|
+
instance_eval(&block)
|
23
|
+
return @spec
|
24
|
+
end
|
25
|
+
|
26
|
+
def model_name(text)
|
27
|
+
@spec.model_name = text
|
28
|
+
end
|
29
|
+
|
30
|
+
def parents(value)
|
31
|
+
@spec.parents = value
|
32
|
+
end
|
33
|
+
|
34
|
+
def description(text)
|
35
|
+
@spec.description = text
|
36
|
+
end
|
37
|
+
|
38
|
+
def model_type(value)
|
39
|
+
@spec.model_type = value
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def child(child_class)
|
44
|
+
@@spec.child = child_class
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
def belongs_to(bt_name, &block)
|
50
|
+
|
51
|
+
@bt_name = bt_name
|
52
|
+
|
53
|
+
new_association = {
|
54
|
+
type: :belongs_to,
|
55
|
+
description: "",
|
56
|
+
example: "",
|
57
|
+
navigable: false,
|
58
|
+
load: :lazy
|
59
|
+
}
|
60
|
+
|
61
|
+
unless self.respond_to? :bt_navigable
|
62
|
+
|
63
|
+
def bt_navigable(value)
|
64
|
+
@spec.associations[@bt_name][:navigable] = value
|
65
|
+
end
|
66
|
+
|
67
|
+
def bt_load(value)
|
68
|
+
@spec.associations[@bt_name][:load] = value
|
69
|
+
end
|
70
|
+
|
71
|
+
def bt_example(text)
|
72
|
+
@spec.associations[@bt_name][:example] = text
|
73
|
+
end
|
74
|
+
|
75
|
+
def bt_description(text)
|
76
|
+
@spec.associations[@bt_name][:description] = text
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
@spec.associations[@bt_name] = new_association
|
82
|
+
block.call
|
83
|
+
|
84
|
+
|
85
|
+
proc = Proc.new do
|
86
|
+
attr_description ""
|
87
|
+
attr_data_type :String
|
88
|
+
end
|
89
|
+
attribute("#{bt_name.to_s.uncapitalize}EFPath".to_sym,&proc)
|
90
|
+
|
91
|
+
proc = Proc.new do
|
92
|
+
attr_description ""
|
93
|
+
attr_data_type "#{bt_name}EF"
|
94
|
+
attr_options [:transient]
|
95
|
+
attr_association bt_name
|
96
|
+
end
|
97
|
+
|
98
|
+
attribute("#{bt_name.to_s.uncapitalize}EF".to_sym,&proc)
|
99
|
+
end
|
100
|
+
|
101
|
+
def attribute(attribute_name, &block)
|
102
|
+
@attribute_name = attribute_name
|
103
|
+
new_attribute = {
|
104
|
+
description: "",
|
105
|
+
example: "",
|
106
|
+
type: nil,
|
107
|
+
options: [],
|
108
|
+
association: nil
|
109
|
+
}
|
110
|
+
|
111
|
+
unless self.respond_to? :attr_association
|
112
|
+
def attr_association(value)
|
113
|
+
@spec.attributes[@attribute_name][:association] = value
|
114
|
+
end
|
115
|
+
|
116
|
+
def attr_options(options)
|
117
|
+
@spec.attributes[@attribute_name][:options] = options
|
118
|
+
end
|
119
|
+
|
120
|
+
def attr_example(text)
|
121
|
+
@spec.attributes[@attribute_name][:example] = text
|
122
|
+
end
|
123
|
+
|
124
|
+
def attr_description(text)
|
125
|
+
@spec.attributes[@attribute_name][:description] = text
|
126
|
+
end
|
127
|
+
|
128
|
+
def attr_data_type(symbol)
|
129
|
+
@spec.attributes[@attribute_name][:type] = symbol
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
@spec.attributes[@attribute_name] = new_attribute
|
135
|
+
block.call
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|