mobile_workflow_cli 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/.byebug_history +2 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +205 -0
- data/LICENSE.txt +21 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/USAGE +9 -0
- data/bin/mwf +23 -0
- data/bin/setup +8 -0
- data/lib/mobile_workflow_cli.rb +9 -0
- data/lib/mobile_workflow_cli/app_builder.rb +16 -0
- data/lib/mobile_workflow_cli/app_generator.rb +149 -0
- data/lib/mobile_workflow_cli/version.rb +5 -0
- data/mobile_workflow_cli.gemspec +27 -0
- data/spec/mobile_workflow_cli_spec.rb +9 -0
- data/spec/spec_helper.rb +14 -0
- data/templates/README.md.erb +22 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a607d960e964bcf728fc65d5a7dccd77fcf08104795162bcae0fd70b40388b72
|
4
|
+
data.tar.gz: 53a051164d56c0ac2f7657fd2ba9f8cab954abe00a39697d0b7cbf80e3543fd3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 779afd9ff5f88425498e69b17389ab84b93887b25848ffb88266719d17df0f08c9de2258fc9b9cc68c7f00cafc638ec55312c107ec4e7507e4a183a35f31450d
|
7
|
+
data.tar.gz: 0e0c41293f094c7f19364376a1ebefbb996ec7c035f689f02c91a5e313f6f7a5de19247b9363e07d5d2e1ef77664aaa29253faf907689adf225476f4e2d3eb24
|
data/.byebug_history
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mobile_workflow_cli (0.1.0)
|
5
|
+
administrate
|
6
|
+
rails (>= 6.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.0.3)
|
12
|
+
actionpack (= 6.0.3)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.0.3)
|
16
|
+
actionpack (= 6.0.3)
|
17
|
+
activejob (= 6.0.3)
|
18
|
+
activerecord (= 6.0.3)
|
19
|
+
activestorage (= 6.0.3)
|
20
|
+
activesupport (= 6.0.3)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.0.3)
|
23
|
+
actionpack (= 6.0.3)
|
24
|
+
actionview (= 6.0.3)
|
25
|
+
activejob (= 6.0.3)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.0.3)
|
29
|
+
actionview (= 6.0.3)
|
30
|
+
activesupport (= 6.0.3)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.0.3)
|
36
|
+
actionpack (= 6.0.3)
|
37
|
+
activerecord (= 6.0.3)
|
38
|
+
activestorage (= 6.0.3)
|
39
|
+
activesupport (= 6.0.3)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.0.3)
|
42
|
+
activesupport (= 6.0.3)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.0.3)
|
48
|
+
activesupport (= 6.0.3)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.0.3)
|
51
|
+
activesupport (= 6.0.3)
|
52
|
+
activerecord (6.0.3)
|
53
|
+
activemodel (= 6.0.3)
|
54
|
+
activesupport (= 6.0.3)
|
55
|
+
activestorage (6.0.3)
|
56
|
+
actionpack (= 6.0.3)
|
57
|
+
activejob (= 6.0.3)
|
58
|
+
activerecord (= 6.0.3)
|
59
|
+
marcel (~> 0.3.1)
|
60
|
+
activesupport (6.0.3)
|
61
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
+
i18n (>= 0.7, < 2)
|
63
|
+
minitest (~> 5.1)
|
64
|
+
tzinfo (~> 1.1)
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
66
|
+
administrate (0.13.0)
|
67
|
+
actionpack (>= 4.2)
|
68
|
+
actionview (>= 4.2)
|
69
|
+
activerecord (>= 4.2)
|
70
|
+
autoprefixer-rails (>= 6.0)
|
71
|
+
datetime_picker_rails (~> 0.0.7)
|
72
|
+
jquery-rails (>= 4.0)
|
73
|
+
kaminari (>= 1.0)
|
74
|
+
momentjs-rails (~> 2.8)
|
75
|
+
sassc-rails (~> 2.1)
|
76
|
+
selectize-rails (~> 0.6)
|
77
|
+
autoprefixer-rails (9.7.6)
|
78
|
+
execjs
|
79
|
+
builder (3.2.4)
|
80
|
+
byebug (11.1.3)
|
81
|
+
concurrent-ruby (1.1.6)
|
82
|
+
crass (1.0.6)
|
83
|
+
datetime_picker_rails (0.0.7)
|
84
|
+
momentjs-rails (>= 2.8.1)
|
85
|
+
diff-lcs (1.3)
|
86
|
+
erubi (1.9.0)
|
87
|
+
execjs (2.7.0)
|
88
|
+
ffi (1.12.2)
|
89
|
+
globalid (0.4.2)
|
90
|
+
activesupport (>= 4.2.0)
|
91
|
+
i18n (1.8.2)
|
92
|
+
concurrent-ruby (~> 1.0)
|
93
|
+
jquery-rails (4.4.0)
|
94
|
+
rails-dom-testing (>= 1, < 3)
|
95
|
+
railties (>= 4.2.0)
|
96
|
+
thor (>= 0.14, < 2.0)
|
97
|
+
kaminari (1.2.0)
|
98
|
+
activesupport (>= 4.1.0)
|
99
|
+
kaminari-actionview (= 1.2.0)
|
100
|
+
kaminari-activerecord (= 1.2.0)
|
101
|
+
kaminari-core (= 1.2.0)
|
102
|
+
kaminari-actionview (1.2.0)
|
103
|
+
actionview
|
104
|
+
kaminari-core (= 1.2.0)
|
105
|
+
kaminari-activerecord (1.2.0)
|
106
|
+
activerecord
|
107
|
+
kaminari-core (= 1.2.0)
|
108
|
+
kaminari-core (1.2.0)
|
109
|
+
loofah (2.5.0)
|
110
|
+
crass (~> 1.0.2)
|
111
|
+
nokogiri (>= 1.5.9)
|
112
|
+
mail (2.7.1)
|
113
|
+
mini_mime (>= 0.1.1)
|
114
|
+
marcel (0.3.3)
|
115
|
+
mimemagic (~> 0.3.2)
|
116
|
+
method_source (1.0.0)
|
117
|
+
mimemagic (0.3.5)
|
118
|
+
mini_mime (1.0.2)
|
119
|
+
mini_portile2 (2.4.0)
|
120
|
+
minitest (5.14.0)
|
121
|
+
momentjs-rails (2.20.1)
|
122
|
+
railties (>= 3.1)
|
123
|
+
nio4r (2.5.2)
|
124
|
+
nokogiri (1.10.9)
|
125
|
+
mini_portile2 (~> 2.4.0)
|
126
|
+
rack (2.2.2)
|
127
|
+
rack-test (1.1.0)
|
128
|
+
rack (>= 1.0, < 3)
|
129
|
+
rails (6.0.3)
|
130
|
+
actioncable (= 6.0.3)
|
131
|
+
actionmailbox (= 6.0.3)
|
132
|
+
actionmailer (= 6.0.3)
|
133
|
+
actionpack (= 6.0.3)
|
134
|
+
actiontext (= 6.0.3)
|
135
|
+
actionview (= 6.0.3)
|
136
|
+
activejob (= 6.0.3)
|
137
|
+
activemodel (= 6.0.3)
|
138
|
+
activerecord (= 6.0.3)
|
139
|
+
activestorage (= 6.0.3)
|
140
|
+
activesupport (= 6.0.3)
|
141
|
+
bundler (>= 1.3.0)
|
142
|
+
railties (= 6.0.3)
|
143
|
+
sprockets-rails (>= 2.0.0)
|
144
|
+
rails-dom-testing (2.0.3)
|
145
|
+
activesupport (>= 4.2.0)
|
146
|
+
nokogiri (>= 1.6)
|
147
|
+
rails-html-sanitizer (1.3.0)
|
148
|
+
loofah (~> 2.3)
|
149
|
+
railties (6.0.3)
|
150
|
+
actionpack (= 6.0.3)
|
151
|
+
activesupport (= 6.0.3)
|
152
|
+
method_source
|
153
|
+
rake (>= 0.8.7)
|
154
|
+
thor (>= 0.20.3, < 2.0)
|
155
|
+
rake (12.3.3)
|
156
|
+
rspec (3.9.0)
|
157
|
+
rspec-core (~> 3.9.0)
|
158
|
+
rspec-expectations (~> 3.9.0)
|
159
|
+
rspec-mocks (~> 3.9.0)
|
160
|
+
rspec-core (3.9.2)
|
161
|
+
rspec-support (~> 3.9.3)
|
162
|
+
rspec-expectations (3.9.2)
|
163
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
164
|
+
rspec-support (~> 3.9.0)
|
165
|
+
rspec-mocks (3.9.1)
|
166
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
167
|
+
rspec-support (~> 3.9.0)
|
168
|
+
rspec-support (3.9.3)
|
169
|
+
sassc (2.3.0)
|
170
|
+
ffi (~> 1.9)
|
171
|
+
sassc-rails (2.1.2)
|
172
|
+
railties (>= 4.0.0)
|
173
|
+
sassc (>= 2.0)
|
174
|
+
sprockets (> 3.0)
|
175
|
+
sprockets-rails
|
176
|
+
tilt
|
177
|
+
selectize-rails (0.12.6)
|
178
|
+
sprockets (4.0.0)
|
179
|
+
concurrent-ruby (~> 1.0)
|
180
|
+
rack (> 1, < 3)
|
181
|
+
sprockets-rails (3.2.1)
|
182
|
+
actionpack (>= 4.0)
|
183
|
+
activesupport (>= 4.0)
|
184
|
+
sprockets (>= 3.0.0)
|
185
|
+
thor (1.0.1)
|
186
|
+
thread_safe (0.3.6)
|
187
|
+
tilt (2.0.10)
|
188
|
+
tzinfo (1.2.7)
|
189
|
+
thread_safe (~> 0.1)
|
190
|
+
websocket-driver (0.7.1)
|
191
|
+
websocket-extensions (>= 0.1.0)
|
192
|
+
websocket-extensions (0.1.4)
|
193
|
+
zeitwerk (2.3.0)
|
194
|
+
|
195
|
+
PLATFORMS
|
196
|
+
ruby
|
197
|
+
|
198
|
+
DEPENDENCIES
|
199
|
+
byebug
|
200
|
+
mobile_workflow_cli!
|
201
|
+
rake (~> 12.0)
|
202
|
+
rspec (~> 3.0)
|
203
|
+
|
204
|
+
BUNDLED WITH
|
205
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Matt Brooke-Smith
|
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,24 @@
|
|
1
|
+
# Mobile Workflow CLI
|
2
|
+
A utility to create a Rails server from an Open API Spec file.
|
3
|
+
|
4
|
+
The server contains
|
5
|
+
* Models
|
6
|
+
* API
|
7
|
+
* Password protected admin console (for updating the data)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install the utility
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'mobile_workflow_cli'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```mwf new <path to open api spec json> [options]```
|
20
|
+
|
21
|
+
|
22
|
+
## License
|
23
|
+
|
24
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/USAGE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Description:
|
2
|
+
Mobile Workflow CLI creates a Rails template project for your Mobile Workflow App.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
mwf todo_server ~/Downloads/todo_oai_spec.json -H
|
6
|
+
|
7
|
+
Generate a Rails installation from the downloaded todo_oai_spec.json in the todo_server
|
8
|
+
folder relative to the current directory. Then create an new Heroku app and deploy the code.
|
9
|
+
|
data/bin/mwf
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
6
|
+
$LOAD_PATH << source_path
|
7
|
+
|
8
|
+
require 'mobile_workflow_cli'
|
9
|
+
|
10
|
+
if ARGV.empty?
|
11
|
+
puts "USAGE: mwf <directory> <OpenAPI Spec file path> [options]"
|
12
|
+
puts "See --help for more info"
|
13
|
+
exit 0
|
14
|
+
elsif ['-v', '--version'].include? ARGV[0]
|
15
|
+
puts MobileWorkflowCli::VERSION
|
16
|
+
exit 0
|
17
|
+
end
|
18
|
+
|
19
|
+
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
20
|
+
MobileWorkflowCli::AppGenerator.source_root templates_root
|
21
|
+
MobileWorkflowCli::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
22
|
+
|
23
|
+
MobileWorkflowCli::AppGenerator.start
|
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module MobileWorkflowCli
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
def readme
|
4
|
+
template 'README.md.erb', 'README.md'
|
5
|
+
end
|
6
|
+
|
7
|
+
def gemfile
|
8
|
+
super
|
9
|
+
# Thoughtbot administrate for admin console
|
10
|
+
gem "administrate"
|
11
|
+
|
12
|
+
# Dotenv for development / test
|
13
|
+
gem 'dotenv-rails', groups: [:development, :test]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
require 'json'
|
4
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
5
|
+
|
6
|
+
module MobileWorkflowCli
|
7
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
8
|
+
hide!
|
9
|
+
|
10
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql", desc: "Configure for selected database (options: #{DATABASES.join("/")})"
|
11
|
+
class_option :skip_test, type: :boolean, default: true, desc: "Skip Test Unit"
|
12
|
+
class_option :force, type: :boolean, default: true, desc: "Force overwrite"
|
13
|
+
|
14
|
+
class_option :version, type: :boolean, aliases: "-v", desc: "Show version number and quit"
|
15
|
+
class_option :help, type: :boolean, aliases: '-h', desc: "Show this help message and quit"
|
16
|
+
|
17
|
+
class_option :heroku, type: :boolean, aliases: "-H", default: false, desc: "Create Heroku app"
|
18
|
+
|
19
|
+
def self.banner
|
20
|
+
"mwf <directory> <OpenAPI Spec file path> [options]"
|
21
|
+
end
|
22
|
+
|
23
|
+
def finish_template
|
24
|
+
open_api_spec = read_openapi_spec
|
25
|
+
generate_models(open_api_spec)
|
26
|
+
setup_db
|
27
|
+
generate_administrate
|
28
|
+
generate_base_api_controller(open_api_spec)
|
29
|
+
generate_controllers_and_routes(open_api_spec)
|
30
|
+
generate_procfile
|
31
|
+
|
32
|
+
admin_user = 'admin'
|
33
|
+
admin_password = SecureRandom.base64(12)
|
34
|
+
generate_dot_env(admin_user, admin_password)
|
35
|
+
super
|
36
|
+
|
37
|
+
initial_git_commit
|
38
|
+
deploy_heroku(admin_user, admin_password) if options[:heroku]
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def get_builder_class
|
44
|
+
MobileWorkflowCli::AppBuilder
|
45
|
+
end
|
46
|
+
|
47
|
+
# Todo: MBS - move these methods to the builder class
|
48
|
+
# Ideally override RailsBuilder methods
|
49
|
+
private
|
50
|
+
def read_openapi_spec
|
51
|
+
openapi_spec_path = ARGV[1]
|
52
|
+
say "Loading model from OpenAPI Spec: #{openapi_spec_path}"
|
53
|
+
return JSON.parse(File.read(openapi_spec_path)).with_indifferent_access
|
54
|
+
end
|
55
|
+
|
56
|
+
def generate_administrate
|
57
|
+
generate('administrate:install')
|
58
|
+
file 'app/assets/config/manifest.js', <<-CODE
|
59
|
+
//= link administrate/application.css
|
60
|
+
//= link administrate/application.js
|
61
|
+
CODE
|
62
|
+
|
63
|
+
file 'app/controllers/admin/application_controller.rb', <<-CODE
|
64
|
+
module Admin
|
65
|
+
class ApplicationController < Administrate::ApplicationController
|
66
|
+
before_action :authenticate_admin
|
67
|
+
|
68
|
+
def authenticate_admin
|
69
|
+
self.class.http_basic_authenticate_with(name: ENV["ADMIN_USER"], password: ENV["ADMIN_PASSWORD"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
CODE
|
74
|
+
end
|
75
|
+
|
76
|
+
def generate_models(openapi_spec)
|
77
|
+
say "Generating models"
|
78
|
+
openapi_spec[:components][:schemas].each_pair do |name, schema|
|
79
|
+
properties_args = schema['properties'].keys.reject{|key| key == 'id'}.collect{|key| "#{key}:#{schema['properties'][key]['type']}" }.join(' ')
|
80
|
+
generate(:model, "#{name.underscore} #{properties_args}")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def generate_base_api_controller(openapi_spec)
|
85
|
+
file 'app/controllers/api_controller.rb', <<-CODE
|
86
|
+
class ApiController < ActionController::API
|
87
|
+
end
|
88
|
+
CODE
|
89
|
+
end
|
90
|
+
|
91
|
+
def generate_controllers_and_routes(openapi_spec)
|
92
|
+
say "Generating controllers"
|
93
|
+
controller_names = []
|
94
|
+
openapi_spec[:paths].each_pair do |url_path, path|
|
95
|
+
controller_name = url_path.split('/').last.pluralize
|
96
|
+
model = path[:get][:responses]["200"][:content]['application/json'][:schema][:items]['$ref'].split('/').last
|
97
|
+
file "app/controllers/#{controller_name}_controller.rb", <<-CODE
|
98
|
+
class #{controller_name.titleize}Controller < ApiController
|
99
|
+
def index
|
100
|
+
render json: #{model}.where(filter_params)
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
def filter_params
|
105
|
+
params.permit() # Add any filter properties here
|
106
|
+
end
|
107
|
+
end
|
108
|
+
CODE
|
109
|
+
controller_names << controller_name
|
110
|
+
end
|
111
|
+
controller_names.each {|n| route "resources :#{n}, only: :index" }
|
112
|
+
|
113
|
+
# Root route
|
114
|
+
route "root to: 'admin/#{controller_names.first}#index'"
|
115
|
+
end
|
116
|
+
|
117
|
+
def setup_db
|
118
|
+
rails_command("db:drop")
|
119
|
+
rails_command("db:create")
|
120
|
+
rails_command("db:migrate")
|
121
|
+
end
|
122
|
+
|
123
|
+
def generate_procfile
|
124
|
+
file 'Procfile', <<-CODE
|
125
|
+
web: bundle exec rackup config.ru -p $PORT
|
126
|
+
release: bundle exec rake db:migrate
|
127
|
+
CODE
|
128
|
+
end
|
129
|
+
|
130
|
+
def initial_git_commit
|
131
|
+
git add: "."
|
132
|
+
git commit: %Q{ -m 'Initial commit' }
|
133
|
+
end
|
134
|
+
|
135
|
+
def generate_dot_env(admin_user, admin_password)
|
136
|
+
file '.env', <<-CODE
|
137
|
+
ADMIN_USER=#{admin_user}
|
138
|
+
ADMIN_PASSWORD=#{admin_password}
|
139
|
+
CODE
|
140
|
+
end
|
141
|
+
|
142
|
+
def deploy_heroku(admin_user, admin_password)
|
143
|
+
heroku_output = `heroku create`
|
144
|
+
`git push heroku master`
|
145
|
+
`heroku config:set ADMIN_USER=#{admin_user} ADMIN_PASSWORD=#{admin_password}`
|
146
|
+
say "Server created: #{heroku_output}"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'lib/mobile_workflow_cli/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "mobile_workflow_cli"
|
5
|
+
s.version = MobileWorkflowCli::VERSION
|
6
|
+
s.authors = ["Matt Brooke-Smith"]
|
7
|
+
s.email = ["matt@futureworkshops.com"]
|
8
|
+
|
9
|
+
s.summary = "CLI tool for Mobile Workflow"
|
10
|
+
s.homepage = "https://github.com/FutureWorkshops/MobileWorkflowCli"
|
11
|
+
s.license = "MIT"
|
12
|
+
s.required_ruby_version = ">= #{MobileWorkflowCli::RUBY_VERSION}"
|
13
|
+
|
14
|
+
s.metadata["homepage_uri"] = s.homepage
|
15
|
+
s.metadata["source_code_uri"] = s.homepage
|
16
|
+
|
17
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|s|features)/}) }
|
19
|
+
end
|
20
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency 'administrate'
|
24
|
+
s.add_dependency 'rails', ">= #{MobileWorkflowCli::RAILS_VERSION}"
|
25
|
+
|
26
|
+
s.add_development_dependency 'byebug'
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "mobile_workflow_cli"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# <%= app_name.humanize %>
|
2
|
+
|
3
|
+
## Prereqs
|
4
|
+
* Ruby >= 2.5.5
|
5
|
+
* Rails >= 6.0.0
|
6
|
+
|
7
|
+
Optional
|
8
|
+
* Heroku toolbelt
|
9
|
+
* Heroku account
|
10
|
+
|
11
|
+
## Getting Started
|
12
|
+
|
13
|
+
After you have cloned this repo, run this setup script to set up your machine
|
14
|
+
with the necessary dependencies to run and test this app:
|
15
|
+
|
16
|
+
% ./bin/setup
|
17
|
+
|
18
|
+
After setting up, you can run the application using [Heroku Local]:
|
19
|
+
|
20
|
+
% heroku local
|
21
|
+
|
22
|
+
[Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mobile_workflow_cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Brooke-Smith
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: administrate
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- matt@futureworkshops.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".byebug_history"
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- USAGE
|
72
|
+
- bin/mwf
|
73
|
+
- bin/setup
|
74
|
+
- lib/mobile_workflow_cli.rb
|
75
|
+
- lib/mobile_workflow_cli/app_builder.rb
|
76
|
+
- lib/mobile_workflow_cli/app_generator.rb
|
77
|
+
- lib/mobile_workflow_cli/version.rb
|
78
|
+
- mobile_workflow_cli.gemspec
|
79
|
+
- spec/mobile_workflow_cli_spec.rb
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- templates/README.md.erb
|
82
|
+
homepage: https://github.com/FutureWorkshops/MobileWorkflowCli
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/FutureWorkshops/MobileWorkflowCli
|
87
|
+
source_code_uri: https://github.com/FutureWorkshops/MobileWorkflowCli
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.5.5
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.0.8
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: CLI tool for Mobile Workflow
|
107
|
+
test_files: []
|