mobilis 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/mobilis/docker_compose_projector.rb +1 -1
- data/lib/mobilis/interactive_designer.rb +83 -23
- data/lib/mobilis/project.rb +7 -9
- data/lib/mobilis/rails_project.rb +1 -1
- data/lib/mobilis/version.rb +1 -1
- data/mobilis.gemspec +47 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f70c5988047af743d26f24694bdbf9894f7a6b5d05666987617aaf55fccd93
|
4
|
+
data.tar.gz: 185119c7a513b48f0d8ff991f2d79c40b43890b0fcf016624f786f8ba1383b45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6678e0445f6a8d777bc6f6c5280b7abacac3b61cb9b545cd51fc4a5ada43696a4815a2fa1fff553e8b3a2646b36550b12ec157437a78027225de87e63a20b650
|
7
|
+
data.tar.gz: ac072bd7e4bebca33480d3817aba9920869033d142d562f4908c6ca0c1a1a592f005ef834ffab4a025ea2b99e24741f534869e6daac49d2c3c461040bfc59c01
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.0.5] - 2022-12-09
|
4
|
+
- fixed a bug when loading a project that made the rails builder not update
|
5
|
+
- fixed permissions of wait-until, which means rails projects will wait until the database
|
6
|
+
is available to run migrations and start the server
|
7
|
+
- reworked a lot of the screens to be less cluttered and make more sense
|
8
|
+
- fixed unit tests to not hardcode my username in the test
|
9
|
+
- bumped redis version
|
10
|
+
|
3
11
|
## [0.0.4] - 2022-09-11
|
4
12
|
|
5
13
|
- Added command line options load and build
|
@@ -99,7 +99,7 @@ def redis_service service
|
|
99
99
|
attributes = @project.attributes
|
100
100
|
port_key = "#{service.name}_internal_port_no".to_sym
|
101
101
|
{
|
102
|
-
"image" => "redis:
|
102
|
+
"image" => "redis:7.0.5-alpine",
|
103
103
|
"restart" => "always",
|
104
104
|
"command" => "redis-server --save 20 1 --loglevel warning --requirepass #{ service.password }",
|
105
105
|
"environment" => [
|
@@ -26,28 +26,37 @@ state_machine :state, initial: :intialize do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
event :go_add_omakase_stack_rails_project do
|
29
|
-
transition [:
|
29
|
+
transition [:add_project_menu] => :add_omakase_stack_rails_project
|
30
30
|
end
|
31
31
|
|
32
32
|
event :go_add_prime_stack_rails_project do
|
33
|
-
transition [:
|
33
|
+
transition [:add_project_menu] => :add_prime_stack_rails_project
|
34
34
|
end
|
35
35
|
|
36
36
|
event :go_add_postgresql_instance do
|
37
|
-
transition [:
|
37
|
+
transition [:add_project_menu] => :add_postgresql_instance
|
38
|
+
end
|
39
|
+
|
40
|
+
event :go_add_project_menu do
|
41
|
+
transition [:main_menu] => :add_project_menu
|
42
|
+
end
|
43
|
+
|
44
|
+
event :go_edit_project_menu do
|
45
|
+
transition [:main_menu] => :edit_project_menu
|
38
46
|
end
|
39
47
|
|
40
48
|
event :go_add_mysql_instance do
|
41
|
-
transition [:
|
49
|
+
transition [:add_project_menu] => :add_mysql_instance
|
42
50
|
end
|
43
51
|
|
44
52
|
event :go_add_redis_instance do
|
45
|
-
transition [:
|
53
|
+
transition [:add_project_menu] => :add_redis_instance
|
46
54
|
end
|
47
55
|
|
48
56
|
event :go_back do
|
49
|
-
transition [:edit_rails_project] => :
|
57
|
+
transition [:edit_rails_project] => :edit_project_menu
|
50
58
|
transition [:edit_generic_project] => :main_menu
|
59
|
+
transition [:add_project_menu] => :main_menu
|
51
60
|
end
|
52
61
|
|
53
62
|
event :go_add_rack_project do
|
@@ -56,12 +65,7 @@ state_machine :state, initial: :intialize do
|
|
56
65
|
|
57
66
|
event :go_edit_rails_project do
|
58
67
|
transition [
|
59
|
-
:add_omakase_stack_rails_project,
|
60
|
-
:add_prime_stack_rails_project,
|
61
|
-
:edit_rails_controller,
|
62
|
-
:edit_rails_model,
|
63
|
-
:toggle_rails_api_mode,
|
64
|
-
:main_menu
|
68
|
+
:edit_project_menu, :add_omakase_stack_rails_project, :add_prime_stack_rails_project
|
65
69
|
] => :edit_rails_project
|
66
70
|
end
|
67
71
|
|
@@ -99,6 +103,7 @@ state_machine :state, initial: :intialize do
|
|
99
103
|
|
100
104
|
event :go_edit_links_select_project do
|
101
105
|
transition [:main_menu] => :edit_links_select_project
|
106
|
+
transition [:edit_links] => :edit_links_select_project
|
102
107
|
end
|
103
108
|
|
104
109
|
event :go_edit_links do
|
@@ -119,10 +124,55 @@ state_machine :state, initial: :intialize do
|
|
119
124
|
puts
|
120
125
|
end
|
121
126
|
def choices
|
122
|
-
|
123
|
-
{ name: "
|
127
|
+
menu_items = [
|
128
|
+
{ name: "reload all code", value: -> { reload! }},
|
129
|
+
{ name: "[m] Add project", value: -> { go_add_project_menu }},
|
130
|
+
{ name: "[m] Edit existing project", value: -> { go_edit_project_menu }}
|
131
|
+
]
|
132
|
+
if projects.length > 1
|
133
|
+
menu_items.concat([
|
134
|
+
{ name: "[m] edit links", value: -> { go_edit_links_select_project }}
|
135
|
+
])
|
124
136
|
end
|
137
|
+
if projects.length > 0
|
138
|
+
menu_items.concat([
|
139
|
+
{ name: "Save mproj.json", value: -> { go_save_project }},
|
140
|
+
{ name: "Generate", value: -> { go_generate }},
|
141
|
+
{ name: "Build", value: -> { go_build }}
|
142
|
+
])
|
143
|
+
end
|
144
|
+
menu_items
|
145
|
+
end
|
146
|
+
def action = false
|
147
|
+
end
|
148
|
+
|
149
|
+
state :edit_project_menu do
|
150
|
+
def display
|
151
|
+
puts
|
152
|
+
tp.set :max_width, 160
|
153
|
+
tp projects, 'name', 'type', 'options': lambda {|p| p.options.join ", "}
|
154
|
+
puts
|
155
|
+
end
|
156
|
+
def choices
|
157
|
+
[
|
158
|
+
{name: "return to Main Menu", value: -> { go_main_menu }},
|
159
|
+
*(projects.map { |project| { name: "Edit '#{ project.name }' project", value: -> { @selected_rails_project = project ; go_edit_rails_project } } })
|
160
|
+
]
|
161
|
+
end
|
162
|
+
def action = false
|
163
|
+
end
|
164
|
+
|
165
|
+
state :add_project_menu do
|
166
|
+
def display
|
167
|
+
puts
|
168
|
+
tp.set :max_width, 160
|
169
|
+
tp projects, 'name', 'type', 'options': lambda {|p| p.options.join ", "}
|
170
|
+
puts
|
171
|
+
end
|
172
|
+
|
173
|
+
def choices
|
125
174
|
[
|
175
|
+
{name: "return to Main Menu", value: -> { go_main_menu }},
|
126
176
|
{name: "Add prime stack rails project", value: -> { go_add_prime_stack_rails_project }},
|
127
177
|
{name: "Add omakase stack rails project", value: -> { go_add_omakase_stack_rails_project }},
|
128
178
|
{name: "Add rack3 project", value: -> { go_add_rack_project }},
|
@@ -138,12 +188,7 @@ state_machine :state, initial: :intialize do
|
|
138
188
|
#{ name: "Add couchdb instance", value: -> { go_add_couchdb_instance }},
|
139
189
|
#{ name: "Add kafka instance", value: -> { go_add_kafka_instance }},
|
140
190
|
#{ name: "Add graphql instance", value: -> { go_add_grapql_instance }},
|
141
|
-
#{ name: "Add gitlab instance w/workers", value: -> { go_add_gitlab_instance }}
|
142
|
-
*project_choices,
|
143
|
-
{ name: "edit links", value: -> { go_edit_links_select_project }},
|
144
|
-
{ name: "Save mproj.json", value: -> { go_save_project }},
|
145
|
-
{ name: "Generate", value: -> { go_generate }},
|
146
|
-
{ name: "Build", value: -> { go_build }}
|
191
|
+
#{ name: "Add gitlab instance w/workers", value: -> { go_add_gitlab_instance }}
|
147
192
|
]
|
148
193
|
end
|
149
194
|
def action = false
|
@@ -179,7 +224,7 @@ state_machine :state, initial: :intialize do
|
|
179
224
|
end
|
180
225
|
end
|
181
226
|
@selected_project.set_links selected
|
182
|
-
|
227
|
+
go_edit_links_select_project
|
183
228
|
end
|
184
229
|
end
|
185
230
|
|
@@ -217,7 +262,8 @@ state_machine :state, initial: :intialize do
|
|
217
262
|
|
218
263
|
state :add_prime_stack_rails_project do
|
219
264
|
def display
|
220
|
-
|
265
|
+
puts "Creates a new rails project, using the prime stack"
|
266
|
+
puts "includes rspec haml factory_bot"
|
221
267
|
end
|
222
268
|
def choices = false
|
223
269
|
def action
|
@@ -229,7 +275,7 @@ state_machine :state, initial: :intialize do
|
|
229
275
|
|
230
276
|
state :add_rack_project do
|
231
277
|
def display
|
232
|
-
|
278
|
+
puts "Creates a new rack project, with a minimal script"
|
233
279
|
end
|
234
280
|
def choices = false
|
235
281
|
def action
|
@@ -392,5 +438,19 @@ def blank_space
|
|
392
438
|
puts ""
|
393
439
|
end
|
394
440
|
|
441
|
+
def reload!(print = true)
|
442
|
+
puts 'Reloading ...' if print
|
443
|
+
# Main project directory.
|
444
|
+
root_dir = File.expand_path('../..', __dir__)
|
445
|
+
# Directories within the project that should be reloaded.
|
446
|
+
reload_dirs = %w{lib}
|
447
|
+
# Loop through and reload every file in all relevant project directories.
|
448
|
+
reload_dirs.each do |dir|
|
449
|
+
Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
|
450
|
+
end
|
451
|
+
# Return true when complete.
|
452
|
+
true
|
453
|
+
end
|
454
|
+
|
395
455
|
end
|
396
456
|
end
|
data/lib/mobilis/project.rb
CHANGED
@@ -99,17 +99,15 @@ source "https://rubygems.org"
|
|
99
99
|
# FIXME
|
100
100
|
#git_source(:github) { |repo| "https://github.com/repo.git" }
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
gem "
|
105
|
-
gem "sqlite3", "~> 1.4"
|
106
|
-
gem "puma", "~> 5.0"
|
102
|
+
gem "rails"
|
103
|
+
gem "sqlite3"
|
104
|
+
gem "puma"
|
107
105
|
gem "jbuilder"
|
108
|
-
gem "redis"
|
106
|
+
gem "redis"
|
109
107
|
gem "kredis"
|
110
|
-
gem "bcrypt"
|
108
|
+
gem "bcrypt"
|
111
109
|
gem "bootsnap", require: false
|
112
|
-
gem "image_processing"
|
110
|
+
gem "image_processing"
|
113
111
|
gem "rack-cors"
|
114
112
|
gem "pg"
|
115
113
|
gem "mysql2"
|
@@ -130,7 +128,7 @@ end
|
|
130
128
|
|
131
129
|
def has_rails_project?
|
132
130
|
projects.each do |p|
|
133
|
-
return true if p.type == :rails
|
131
|
+
return true if p.type.to_sym == :rails
|
134
132
|
end
|
135
133
|
return false
|
136
134
|
end
|
@@ -126,7 +126,7 @@ def generate_Dockerfile
|
|
126
126
|
FROM ruby:latest
|
127
127
|
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client default-mysql-client dos2unix
|
128
128
|
WORKDIR /myapp
|
129
|
-
COPY wait-until /myapp/wait-until
|
129
|
+
COPY --chmod=0755 wait-until /myapp/wait-until
|
130
130
|
COPY Gemfile /myapp/Gemfile
|
131
131
|
COPY Gemfile.lock /myapp/Gemfile.lock
|
132
132
|
RUN bundle install
|
data/lib/mobilis/version.rb
CHANGED
data/mobilis.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/mobilis/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "mobilis"
|
7
|
+
spec.version = Mobilis::VERSION
|
8
|
+
spec.authors = ["Meleneth"]
|
9
|
+
spec.email = ["meleneth@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Generate and scaffold multiple projects and a docker compose file"
|
12
|
+
spec.homepage = "https://github.com/meleneth/mobilis"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
spec.licenses = ['MIT']
|
15
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/meleneth/mobilis"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/meleneth/mobilis/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
spec.executables << 'mobilis'
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
spec.add_dependency "awesome_print"
|
35
|
+
spec.add_dependency "optimist"
|
36
|
+
spec.add_dependency "pry"
|
37
|
+
spec.add_dependency "state_machine"
|
38
|
+
spec.add_dependency "table_print"
|
39
|
+
spec.add_dependency "tty-prompt"
|
40
|
+
|
41
|
+
spec.add_development_dependency "super_diff"
|
42
|
+
|
43
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
44
|
+
|
45
|
+
# For more information and examples about making a new gem, check out our
|
46
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobilis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meleneth
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/mobilis/rails_project.rb
|
142
142
|
- lib/mobilis/redis_instance.rb
|
143
143
|
- lib/mobilis/version.rb
|
144
|
+
- mobilis.gemspec
|
144
145
|
- sig/mobilis.rbs
|
145
146
|
homepage: https://github.com/meleneth/mobilis
|
146
147
|
licenses:
|