lbhrr 1.0.24 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/lbhrr +53 -11
  3. data/lib/lbhrr/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd06f5b2b2c2ead4e766e8db02df61b8e698cbf9a45c96ab63724c74644114d6
4
- data.tar.gz: e2c15f6103ed1a0f4a1d9f356bb08ad7fdb8e7f6ac6245d27ef1eb0ee9c912be
3
+ metadata.gz: 6cf67c16657d7441eb1afe1cbe45d92b091582d0909860277bba699fba9409c7
4
+ data.tar.gz: d3c9bed0e42a7081a639ca0e6341f8fa783e4f848a125125a35d7ed2971d6053
5
5
  SHA512:
6
- metadata.gz: 5ed7d928a8b43c5930aff091d063589843daf4d4975bf0f08f983e28492d4abadd5560477637747bb81cf581605125f8b426dc18d6730de7e8191a7c56c70178
7
- data.tar.gz: 273804677d3c8e4bdb2916d9f5a09ea201a40ddc118c831c2942db69b81136f6fddf08c75980a818199beb5dc839f0769ddafd36ddf7f2bb8d74e973ff2d14d4
6
+ metadata.gz: bd05fb0380b15ba715342597d558c7477c85719da51e5f2f8b17e77b89bb900613417465d2230209b6a3c8a80702eba2c5d51e6da76d30d9427e5f3e93f9a46d
7
+ data.tar.gz: c20241b685a9f0a03dd859a1781a2e22053c9a529a3da52013e514e9bf0a6e0ba88eb9a792f15a6ead66827fc860cce56699a0ef53c060e9d62d0b41fb4aa387
data/exe/lbhrr CHANGED
@@ -100,24 +100,64 @@ class LbhrrCLI < Thor
100
100
  YAML.dump(example_global_config)
101
101
  end
102
102
 
103
- def create_run_file
104
- run_file_path = File.join(Dir.pwd, "exe", "run")
105
- run_file_content = "#!/bin/sh\n HARBR_ENV=$2 bundle exec puma -p $1"
106
- exe_directory = File.join(Dir.pwd, "exe")
103
+ def create_run_file(type)
107
104
 
108
- Dir.mkdir(exe_directory) unless Dir.exist?(exe_directory)
109
- File.write(run_file_path, run_file_content)
110
- File.chmod(0o755, run_file_path) # Set executable permission
105
+ service_content = <<-RUBY
106
+ #!/usr/bin/env ruby
107
+ require 'bundler/inline'
108
+
109
+ gemfile do
110
+ source 'https://rubygems.org'
111
+ #gem 'kafkr', require: true
112
+ end
113
+
114
+ puts 'Gems installed and loaded!'
115
+
116
+ loop do
117
+ puts 'ok!'
118
+ sleep 1
119
+ end
120
+
121
+ RUBY
122
+
123
+ if type == "web"
124
+ run_file_path = File.join(Dir.pwd, "exe", "run")
125
+ web_run_file_content = "#!/bin/sh\n HARBR_ENV=$2 bundle exec puma -p $1"
126
+ exe_directory = File.join(Dir.pwd, "exe")
127
+
128
+ Dir.mkdir(exe_directory) unless Dir.exist?(exe_directory)
129
+ File.write(run_file_path, web_run_file_content)
130
+ File.chmod(0o755, run_file_path) # Set executable permission
131
+ puts "Created ./exe/run file."
132
+ end
133
+
134
+ if type == "service"
135
+ run_file_path = File.join(Dir.pwd, "exe", "run")
136
+ service_run_file_content = "#!/bin/sh\n HARBR_ENV=$2 ruby service"
137
+ exe_directory = File.join(Dir.pwd, "exe")
138
+
139
+ Dir.mkdir(exe_directory) unless Dir.exist?(exe_directory)
140
+ File.write(run_file_path, service_run_file_content)
141
+ File.chmod(0o755, run_file_path) # Set executable permission
142
+ puts "Created ./exe/run file."
143
+
144
+ File.write("service", service_content)
145
+ File.chmod(0o755, "service") # Set executable permission
146
+ puts "Created ./service file."
147
+
148
+ end
149
+
150
+
111
151
 
112
- puts "Created ./exe/run file."
113
152
  rescue => e
114
153
  puts "Error creating ./exe/run file: #{e.message}"
115
154
  end
116
155
 
117
- def create_example_local_config
156
+ def create_example_local_config(type)
118
157
  example_local_config = {
119
158
  "name" => File.basename(Dir.pwd),
120
159
  "version" => "0",
160
+ "type" => type,
121
161
  "port" => "#{File.basename(Dir.pwd)}.app",
122
162
  "host" => "#{File.basename(Dir.pwd)}.harbr.zero2one.ee"
123
163
  }
@@ -162,17 +202,19 @@ class LbhrrCLI < Thor
162
202
  end
163
203
 
164
204
  desc "init", "Initialize project with .gitignore"
205
+ method_option :type, type: :string, enum: ['web', 'service'], default: 'web', desc: "Specify the type of process"
165
206
  def init
166
207
  local_config_path = File.join(Dir.pwd, "config", "manifest.yml")
167
208
 
168
209
  unless File.exist?(local_config_path)
169
210
  FileUtils.mkdir_p(File.dirname(local_config_path)) unless Dir.exist?(File.dirname(local_config_path))
170
- File.write(local_config_path, create_example_local_config)
211
+ File.write(local_config_path, create_example_local_config(options[:type]))
171
212
  end
172
213
  # Load and merge configurations
173
214
  local_config = YAML.load_file(local_config_path) || {}
174
215
  create_gitignore
175
- create_run_file
216
+ create_run_file(options[:type])
217
+
176
218
 
177
219
 
178
220
  # Include other initialization tasks if necessary
data/lib/lbhrr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lbhrr
4
- VERSION = "1.0.24"
4
+ VERSION = "1.0.26"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbhrr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.24
4
+ version: 1.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke