rs-rails-base 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +75 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +9 -0
- data/LICENSE.md +9 -0
- data/README.md +61 -0
- data/Rakefile +7 -0
- data/bin/bundle +3 -0
- data/bin/rails +7 -0
- data/bin/rake +16 -0
- data/bin/rs_rails_base +37 -0
- data/bin/setup +8 -0
- data/circle.yml +12 -0
- data/config.reek +109 -0
- data/docs/chat.md +14 -0
- data/docs/facebook.md +10 -0
- data/docs/twilio.md +21 -0
- data/images/chat_flow.png +0 -0
- data/images/chat_struct.png +0 -0
- data/lib/rs-rails-base/cli_actions.rb +16 -0
- data/lib/rs-rails-base/commands.rb +81 -0
- data/lib/rs-rails-base/constants.rb +7 -0
- data/lib/rs-rails-base/features.rb +16 -0
- data/lib/rs-rails-base/features/chat.rb +91 -0
- data/lib/rs-rails-base/features/facebook.rb +41 -0
- data/lib/rs-rails-base/features/twilio.rb +18 -0
- data/lib/rs-rails-base/file_manipulation.rb +55 -0
- data/lib/rs-rails-base/git_actions.rb +13 -0
- data/lib/rs-rails-base/rails_actions.rb +27 -0
- data/lib/rs_rails_base.rb +10 -0
- data/lib/templates/chat/channel.rb +4 -0
- data/lib/templates/chat/chat_channel.rb +15 -0
- data/lib/templates/chat/chat_service.rb +28 -0
- data/lib/templates/chat/chats_controller.rb +56 -0
- data/lib/templates/chat/connection.rb +24 -0
- data/lib/templates/chat/jbuilder/_info.json.jbuilder +2 -0
- data/lib/templates/chat/jbuilder/_message.json.jbuilder +2 -0
- data/lib/templates/chat/jbuilder/index.json.jbuilder +3 -0
- data/lib/templates/chat/jbuilder/messages_create.json.jbuilder +3 -0
- data/lib/templates/chat/jbuilder/messages_create_info.json.jbuilder +7 -0
- data/lib/templates/chat/jbuilder/show.json.jbuilder +3 -0
- data/lib/templates/chat/messages_controller.rb +23 -0
- data/lib/templates/chat/migration-models/add_chat.rb +9 -0
- data/lib/templates/chat/migration-models/add_message.rb +15 -0
- data/lib/templates/chat/migration-models/add_participant.rb +12 -0
- data/lib/templates/chat/migration-models/chat.rb +30 -0
- data/lib/templates/chat/migration-models/message.rb +43 -0
- data/lib/templates/chat/migration-models/participant.rb +28 -0
- data/lib/templates/chat/migration-models/user.rb +3 -0
- data/lib/templates/chat/routes.rb +6 -0
- data/lib/templates/chat/routes_2.rb +1 -0
- data/lib/templates/chat/sessions_controller.rb +7 -0
- data/lib/templates/chat/specs/chat_channel_spec.rb +25 -0
- data/lib/templates/chat/specs/chat_factory.rb +20 -0
- data/lib/templates/chat/specs/chat_service_spec.rb +19 -0
- data/lib/templates/chat/specs/chat_spec.rb +27 -0
- data/lib/templates/chat/specs/connection_spec.rb +10 -0
- data/lib/templates/chat/specs/message_factory.rb +7 -0
- data/lib/templates/chat/specs/message_spec.rb +40 -0
- data/lib/templates/chat/specs/participant_factory.rb +7 -0
- data/lib/templates/chat/specs/participant_spec.rb +21 -0
- data/lib/templates/chat/specs/rails_helper.rb +1 -0
- data/lib/templates/facebook/apiary.apib +28 -0
- data/lib/templates/facebook/en.yml +4 -0
- data/lib/templates/facebook/facebook_service.rb +13 -0
- data/lib/templates/facebook/facebook_spec.rb +146 -0
- data/lib/templates/facebook/factories_user.rb +6 -0
- data/lib/templates/facebook/routes.rb +3 -0
- data/lib/templates/facebook/sessions_controller.rb +9 -0
- data/lib/templates/facebook/sessions_controller_2.rb +7 -0
- data/lib/templates/facebook/sessions_routing_spec.rb +4 -0
- data/lib/templates/facebook/user_spec.rb +5 -0
- data/lib/templates/twilio/twilio.rb +4 -0
- data/lib/templates/twilio/twilio_service.rb +21 -0
- data/rs-rails-base.gemspec +29 -0
- data/tasks/code_analysis.rake +4 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d2af007f9d818520e56a11f79264f663de5d3130
|
4
|
+
data.tar.gz: a7967442a817183745d696c33aa61941d102509c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 268a171d0747ba18c5a2cf33592bec874685591d9e823cba7dc941b20b439b8d2f88b163e1cfaa977530af0212c24ca63080bbb82d1f0dc90333b5c6bfc94212
|
7
|
+
data.tar.gz: eab5f32fe8dff7adb2b9ee81aa446f6d0885ca06296bbfdffb65025e4e3e09308164d5ad0321392941e661deeacf1a9f2bcdfd56b9df19493522a31f0de1e33f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
Documentation:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Lint/AmbiguousBlockAssociation:
|
5
|
+
Exclude:
|
6
|
+
- spec/**/*
|
7
|
+
|
8
|
+
Metrics/AbcSize:
|
9
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
10
|
+
# a Float.
|
11
|
+
Max: 16
|
12
|
+
|
13
|
+
Metrics/BlockLength:
|
14
|
+
CountComments: false # count full line comments?
|
15
|
+
Max: 25
|
16
|
+
Exclude:
|
17
|
+
- spec/**/*
|
18
|
+
- 'lib/rails-base/features.rb'
|
19
|
+
|
20
|
+
Metrics/BlockNesting:
|
21
|
+
Max: 4
|
22
|
+
|
23
|
+
Metrics/ClassLength:
|
24
|
+
CountComments: false # count full line comments?
|
25
|
+
Max: 200
|
26
|
+
|
27
|
+
# Avoid complex methods.
|
28
|
+
Metrics/CyclomaticComplexity:
|
29
|
+
Max: 6
|
30
|
+
|
31
|
+
Metrics/MethodLength:
|
32
|
+
CountComments: false # count full line comments?
|
33
|
+
Max: 24
|
34
|
+
Exclude:
|
35
|
+
- 'lib/rails-base/features.rb'
|
36
|
+
|
37
|
+
Metrics/ModuleLength:
|
38
|
+
CountComments: false # count full line comments?
|
39
|
+
Max: 200
|
40
|
+
|
41
|
+
Metrics/LineLength:
|
42
|
+
Max: 100
|
43
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
44
|
+
# containing a URI to be longer than Max.
|
45
|
+
AllowURI: true
|
46
|
+
URISchemes:
|
47
|
+
- http
|
48
|
+
- https
|
49
|
+
Exclude:
|
50
|
+
- 'lib/rails-base/features.rb'
|
51
|
+
|
52
|
+
Metrics/ParameterLists:
|
53
|
+
Max: 5
|
54
|
+
CountKeywordArgs: true
|
55
|
+
|
56
|
+
Metrics/PerceivedComplexity:
|
57
|
+
Max: 12
|
58
|
+
|
59
|
+
Style/FrozenStringLiteralComment:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Style/BlockLength:
|
63
|
+
Exclude:
|
64
|
+
- 'lib/templates/**/*.rb'
|
65
|
+
|
66
|
+
Style/InitialIndentation:
|
67
|
+
Exclude:
|
68
|
+
- 'lib/templates/**/*.rb'
|
69
|
+
|
70
|
+
Style/SymbolArray:
|
71
|
+
Exclude:
|
72
|
+
- 'lib/templates/**/add_*.rb'
|
73
|
+
|
74
|
+
Style/ModuleFunction:
|
75
|
+
Enabled: false
|
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 fagripa@toptierlabs.com. 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.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Rootstrap
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Rails::Base
|
2
|
+
[![CircleCI](https://circleci.com/gh/rootstrap/rails_base.svg?style=shield)](https://circleci.com/gh/rootstrap/rails_base)
|
3
|
+
[![License](https://img.shields.io/github/license/rootstrap/rails_base.svg)](https://github.com/rootstrap/rails_base/blob/master/LICENSE.md)
|
4
|
+
|
5
|
+
This is a project generator that comes with a lot of amazing features/help code.
|
6
|
+
It is intended to be a start point for your new projects and also import new functionalities on a safe way to your existing ones.
|
7
|
+
|
8
|
+
And obviously if you want something new, just ask for it!!! or do a pull request if you are brave enough
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Install it yourself as:
|
13
|
+
|
14
|
+
$ gem install rs-rails-base
|
15
|
+
|
16
|
+
This will generate some commands with it, and thats all you need.
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
* First Project
|
21
|
+
|
22
|
+
Just choose a folder and run
|
23
|
+
|
24
|
+
rs_rails_base new
|
25
|
+
|
26
|
+
* Existing Project
|
27
|
+
|
28
|
+
|
29
|
+
rs_rails_base add FEATURE
|
30
|
+
|
31
|
+
Or just 'rs_rails_base add' to get some help
|
32
|
+
|
33
|
+
|
34
|
+
## Current features
|
35
|
+
|
36
|
+
* [Facebook Documentation](./docs/facebook.md)
|
37
|
+
* [Chat Documentation](./docs/chat.md)
|
38
|
+
* [Twilio SMS](./docs/twilio.md)
|
39
|
+
|
40
|
+
## Upcoming awesome features
|
41
|
+
|
42
|
+
* Carrierwave
|
43
|
+
* Active Admin
|
44
|
+
* Twilio Calls
|
45
|
+
* Test & Quality tools
|
46
|
+
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports (please use Issues) and pull requests are welcome on GitHub at https://github.com/rootstrap/rails_base. 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.
|
51
|
+
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
Rootstrap Rails Base is available under the MIT license. See the LICENSE file for more info.
|
56
|
+
|
57
|
+
## Credits
|
58
|
+
|
59
|
+
**Rootstrap Rails Base** is maintained by [Rootstrap](http://www.rootstrap.com) with the help of our [contributors](https://github.com/rootstrap/rails_base/contributors).
|
60
|
+
|
61
|
+
[<img src="https://s3-us-west-1.amazonaws.com/rootstrap.com/img/rs.png" width="100"/>](http://www.rootstrap.com)
|
data/Rakefile
ADDED
data/bin/bundle
ADDED
data/bin/rails
ADDED
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/rs_rails_base
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby -wU
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
5
|
+
$LOAD_PATH << source_path
|
6
|
+
|
7
|
+
require 'rs_rails_base'
|
8
|
+
require 'commander/import'
|
9
|
+
|
10
|
+
if !ARGV.empty? && (['-v', '--version'].include? ARGV[0])
|
11
|
+
puts RailsBase::VERSION
|
12
|
+
exit 0
|
13
|
+
end
|
14
|
+
|
15
|
+
program :name, 'Rails api base'
|
16
|
+
program :version, RailsBase::VERSION
|
17
|
+
program :description, 'Rootstrap rails base modules'
|
18
|
+
default_command :help
|
19
|
+
|
20
|
+
command :new do |c|
|
21
|
+
c.syntax = 'rs_rails_base new'
|
22
|
+
c.description = 'creates a new awesome project'
|
23
|
+
c.action do
|
24
|
+
RailsBase::Commands.new_project
|
25
|
+
RailsBase::Commands.display_menu
|
26
|
+
feature = RailsBase::CliActions.ask_for_something('Now please select featrues to add')
|
27
|
+
RailsBase::Commands.add_feature(feature)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
command :add do |c|
|
32
|
+
c.syntax = 'rs_rails_base add FEATURE'
|
33
|
+
c.description = 'add great features to your project'
|
34
|
+
c.action do |args|
|
35
|
+
RailsBase::Commands.add_feature(args.first)
|
36
|
+
end
|
37
|
+
end
|
data/bin/setup
ADDED
data/circle.yml
ADDED
data/config.reek
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
Attribute:
|
2
|
+
enabled: false
|
3
|
+
exclude: []
|
4
|
+
BooleanParameter:
|
5
|
+
enabled: true
|
6
|
+
exclude: ['inject_into_file']
|
7
|
+
ClassVariable:
|
8
|
+
enabled: false
|
9
|
+
exclude: []
|
10
|
+
ControlParameter:
|
11
|
+
enabled: true
|
12
|
+
exclude: ['feature_case', 'inject_into_file']
|
13
|
+
DataClump:
|
14
|
+
enabled: true
|
15
|
+
exclude: []
|
16
|
+
max_copies: 2
|
17
|
+
min_clump_size: 2
|
18
|
+
DuplicateMethodCall:
|
19
|
+
enabled: true
|
20
|
+
exclude: []
|
21
|
+
max_calls: 1
|
22
|
+
allow_calls: []
|
23
|
+
FeatureEnvy:
|
24
|
+
enabled: true
|
25
|
+
exclude: ['AddChat', 'AddMessage', 'AddParticipant', 'send_message', 'create_message']
|
26
|
+
InstanceVariableAssumption:
|
27
|
+
enabled: false
|
28
|
+
IrresponsibleModule:
|
29
|
+
enabled: false
|
30
|
+
exclude: []
|
31
|
+
LongParameterList:
|
32
|
+
enabled: true
|
33
|
+
exclude: []
|
34
|
+
max_params: 4
|
35
|
+
overrides:
|
36
|
+
initialize:
|
37
|
+
max_params: 5
|
38
|
+
LongYieldList:
|
39
|
+
enabled: true
|
40
|
+
exclude: []
|
41
|
+
max_params: 3
|
42
|
+
NestedIterators:
|
43
|
+
enabled: true
|
44
|
+
exclude: []
|
45
|
+
max_allowed_nesting: 2
|
46
|
+
ignore_iterators: []
|
47
|
+
NilCheck:
|
48
|
+
enabled: false
|
49
|
+
exclude: []
|
50
|
+
PrimaDonnaMethod:
|
51
|
+
enabled: false
|
52
|
+
exclude: []
|
53
|
+
RepeatedConditional:
|
54
|
+
enabled: true
|
55
|
+
exclude: []
|
56
|
+
max_ifs: 3
|
57
|
+
TooManyInstanceVariables:
|
58
|
+
enabled: true
|
59
|
+
exclude: []
|
60
|
+
max_instance_variables: 9
|
61
|
+
TooManyMethods:
|
62
|
+
enabled: true
|
63
|
+
exclude: []
|
64
|
+
max_methods: 25
|
65
|
+
TooManyStatements:
|
66
|
+
enabled: true
|
67
|
+
max_statements: 12
|
68
|
+
UncommunicativeMethodName:
|
69
|
+
enabled: true
|
70
|
+
exclude: []
|
71
|
+
reject:
|
72
|
+
- !ruby/regexp /^[a-z]$/
|
73
|
+
- !ruby/regexp /[0-9]$/
|
74
|
+
- !ruby/regexp /[A-Z]/
|
75
|
+
accept: []
|
76
|
+
UncommunicativeModuleName:
|
77
|
+
enabled: true
|
78
|
+
exclude: ['V1']
|
79
|
+
reject:
|
80
|
+
- !ruby/regexp /^.$/
|
81
|
+
- !ruby/regexp /[0-9]$/
|
82
|
+
accept:
|
83
|
+
- Inline::C
|
84
|
+
UncommunicativeParameterName:
|
85
|
+
enabled: true
|
86
|
+
exclude: []
|
87
|
+
reject:
|
88
|
+
- !ruby/regexp /^.$/
|
89
|
+
- !ruby/regexp /[0-9]$/
|
90
|
+
- !ruby/regexp /[A-Z]/
|
91
|
+
accept: []
|
92
|
+
UncommunicativeVariableName:
|
93
|
+
enabled: false
|
94
|
+
exclude: []
|
95
|
+
reject:
|
96
|
+
- !ruby/regexp /^.$/
|
97
|
+
- !ruby/regexp /[0-9]$/
|
98
|
+
- !ruby/regexp /[A-Z]/
|
99
|
+
accept:
|
100
|
+
- _
|
101
|
+
UnusedParameters:
|
102
|
+
enabled: true
|
103
|
+
exclude: []
|
104
|
+
UnusedPrivateMethod:
|
105
|
+
enabled: false
|
106
|
+
UtilityFunction:
|
107
|
+
enabled: false
|
108
|
+
DataClump:
|
109
|
+
max_copies: 3
|