heroku_whiz 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/lib/heroku_whiz.rb +184 -0
- data.tar.gz.sig +0 -0
- metadata +91 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5800f5f32cb8db97a0533705239764f93beda9e9f5bd05440d2e3a29c82e2b68
|
4
|
+
data.tar.gz: 6e3b4e3ff383822c3c6db9b62f4010f422e3a85cec747f70eba7f4d6e61885e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '049384d28472b0b534610be275db670e977509be3af49132907ad6f5b6825ea20ae9c13a1f8e6a88196d023e27e1456fccc418ac250f506d89e96e6f7580f507'
|
7
|
+
data.tar.gz: feef8ec4211b1e8e9d7a790a5ae06c35997b5fb62f2da53eec1d0eb91f68cbef49eee1e3914e8a21a251d22cb30a2e72f00483c4a7f4bbc8e43e217239737546
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
��g�5�+ *Vd�6h��0�p����3f��_�r�A��kv����������pr�3"{Չ�T$����(;c�i.j�Eb��H�5�AJrhǰ�������ڻ&��no�_�9���*��t��c�%V��[?t۶|`����p<��ĕ0��~U��Ý�I�es1���
|
2
|
+
���Dl�w �C�9��o�?m��QA�����;�]E�F@����f�tcZ��z�K�P�7��8�?��_�FӲ\+w��I��.ob�ܱѣ���e��-f�=��s�~�{����خ8߯-���c�-���oG�Ek��A�V�s�I��%��.Ir�Yw��eK�B��?#���#�4�5��6�C&�L�x5!۷��
|
data/lib/heroku_whiz.rb
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: heroku_whiz.rb
|
4
|
+
|
5
|
+
# created: 8th March 2022
|
6
|
+
# description: Handy (experimental) Heroku gem for noobs to create a
|
7
|
+
# simple Heroku app in a whiz!
|
8
|
+
|
9
|
+
# note: If this gem becomes outdated because of a change in the Heroku app
|
10
|
+
# setup process, please inform the owner of this project via *Issues*
|
11
|
+
# on GitHub (https://github.com/jrobertson/heroku_whiz).
|
12
|
+
|
13
|
+
|
14
|
+
require 'open-uri'
|
15
|
+
require 'fileutils'
|
16
|
+
require 'clipboard'
|
17
|
+
|
18
|
+
|
19
|
+
# Resources
|
20
|
+
#
|
21
|
+
# * [Deploying Rack-based Apps](https://devcenter.heroku.com/articles/rack#pure-rack-apps)
|
22
|
+
|
23
|
+
|
24
|
+
# Example usage:
|
25
|
+
#
|
26
|
+
# hw = HerokuWhiz.new dir: '/home/james/heroku', template: 'rack', appname: 'hello2', debug: true
|
27
|
+
#
|
28
|
+
# hw.wipe_clean # removes the previous local app file directory
|
29
|
+
# hw.create # creates the local app file directory
|
30
|
+
# #hw.local_run # runs the web app locally
|
31
|
+
# hw.local_testrun # tests the local web app returns the correct page
|
32
|
+
# hw.deploy # creates the new app on Heroku
|
33
|
+
# hw.app_url #=> e.g. https://frozen-dusk-65820.herokuapp.com/
|
34
|
+
|
35
|
+
|
36
|
+
class HerokuWhiz
|
37
|
+
|
38
|
+
def initialize(dir: '.', template: 'rack', appname: 'myapp',
|
39
|
+
verbose: true, debug: false)
|
40
|
+
|
41
|
+
@dir, @template, @appname, @verbose = dir, template, appname, verbose
|
42
|
+
|
43
|
+
@app_path = File.join(@dir, @appname)
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def app_url()
|
49
|
+
|
50
|
+
app = `heroku config`.lines.first.split[1]
|
51
|
+
s = "https://#{app}.herokuapp.com/"
|
52
|
+
|
53
|
+
Clipboard.copy s
|
54
|
+
puts 'app URL copied to clipboard.'
|
55
|
+
|
56
|
+
return s
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
def create()
|
61
|
+
|
62
|
+
case @template.to_sym
|
63
|
+
when :rack
|
64
|
+
create_rack()
|
65
|
+
else
|
66
|
+
return puts 'template not recognised!'
|
67
|
+
end
|
68
|
+
|
69
|
+
# build
|
70
|
+
`bundle install`
|
71
|
+
sleep 1
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
def wipe_clean(setup=:local)
|
76
|
+
|
77
|
+
return unless File.exists? @app_path
|
78
|
+
|
79
|
+
# remove the app files
|
80
|
+
#
|
81
|
+
%w(Gemfile config.ru Gemfile.lock).each do |file|
|
82
|
+
|
83
|
+
puts 'removing file ' + file if @debug
|
84
|
+
rm File.join(@app_path, file)
|
85
|
+
sleep 0.5
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
rm_rf File.join(@app_path, '.git')
|
90
|
+
rmdir File.join(@app_path, '.git')
|
91
|
+
rmdir @app_path
|
92
|
+
|
93
|
+
return unless setup == :both
|
94
|
+
|
95
|
+
app = `heroku config`.lines.first.split[1]
|
96
|
+
`heroku apps:destroy --confirm #{app}`
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
def deploy()
|
101
|
+
|
102
|
+
`git init`
|
103
|
+
sleep 0.5
|
104
|
+
|
105
|
+
`git add .`
|
106
|
+
sleep 0.5
|
107
|
+
|
108
|
+
`git commit -m 'pure rack app'`
|
109
|
+
sleep 0.5
|
110
|
+
|
111
|
+
#`heroku create #{@appname}`
|
112
|
+
|
113
|
+
# the above statement was commented out because there's a
|
114
|
+
# high probability the appname you have chosen has already been taken
|
115
|
+
# e.g. hello2 => hello2.herokuapp.com
|
116
|
+
|
117
|
+
`heroku create`
|
118
|
+
sleep 2
|
119
|
+
|
120
|
+
r = `git push heroku master`
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
def local_run()
|
125
|
+
`bundle exec rackup -p 9292 config.ru &`
|
126
|
+
end
|
127
|
+
|
128
|
+
def local_testrun()
|
129
|
+
|
130
|
+
r = IO.popen( "bundle exec rackup -p 9292 config.ru" )
|
131
|
+
puts 'r: ' + r.inspect if @debug
|
132
|
+
sleep 2
|
133
|
+
|
134
|
+
s = URI.open('http://127.0.0.1:9292').read
|
135
|
+
sleep 1
|
136
|
+
|
137
|
+
Process.kill('QUIT', r.pid)
|
138
|
+
|
139
|
+
|
140
|
+
puts 'SUCCESS! Ready to deploy' if s == "Hello World!\n"
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
145
|
+
|
146
|
+
def create_rack()
|
147
|
+
|
148
|
+
FileUtils.mkdir_p @app_path
|
149
|
+
FileUtils.chdir @app_path
|
150
|
+
|
151
|
+
# write the config.ru file
|
152
|
+
#
|
153
|
+
config = %q(
|
154
|
+
run lambda do |env|
|
155
|
+
[200, {'Content-Type'=>'text/plain'}, StringIO.new("Hello World!\n")]
|
156
|
+
end)
|
157
|
+
File.write File.join(@app_path, 'config.ru'), config
|
158
|
+
|
159
|
+
# write the Gemfile
|
160
|
+
#
|
161
|
+
gemfile = %q(
|
162
|
+
source 'https://rubygems.org'
|
163
|
+
gem 'rack'
|
164
|
+
gem 'puma'
|
165
|
+
)
|
166
|
+
File.write File.join(@app_path, 'Gemfile'), gemfile
|
167
|
+
sleep 0.5
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def rm(file)
|
172
|
+
FileUtils.rm file if File.exists? file
|
173
|
+
end
|
174
|
+
|
175
|
+
def rm_rf(file)
|
176
|
+
FileUtils.rm_rf file if File.exists? file
|
177
|
+
end
|
178
|
+
|
179
|
+
def rmdir(file)
|
180
|
+
FileUtils.rmdir file if File.exists? file
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heroku_whiz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGI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MB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAGKCIZf7JdlUrF7FEaPSpXjJhnx1a2ycmtVM1cj5O
|
29
|
+
TI16sjKyBkrMjtufJ/D5uf5SvAjOznr0LKZZIdkmRBciAzj53zCDM6lNbWc1WR/k
|
30
|
+
QAYBzE15bELAd1odOnYa0H1vhRkeRpsPZKDVai66d1+rlVFOCygDoWPVEPkjlY3X
|
31
|
+
wX6OpHH0h0PnNBJgc6vztzxXhafYfFcrti+KPmXCl0yNl7f3lrJm5j2rFNKFAGpK
|
32
|
+
xLDt4NtIIgydn7uADv30WdE3eAlWbBiSndaPS786B9m95xLr9g+A+jNCKsYOOTfq
|
33
|
+
HwyJjXghKUSwQhLtXoMkXFZpn9sYgA8uyyxfk8gOS4d10aqVkkGxsEvM8oierBnc
|
34
|
+
ZwoeMRnUgam0t4/OfCefewn2lcvIEQ7qXRqrZ8KuTQoIO7gT5e6DrVzaGt/1+egO
|
35
|
+
n5lICiaMyvvvMKfV1rE1Pz0tCPqOu++rZFRC9XbrR+Vio0ha4mHPPAUsvY2f9DtE
|
36
|
+
ZOz9jhKlb8t2o3xNUKH/e3WN
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: clipboard
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.3.6
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.3'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.3.6
|
60
|
+
description:
|
61
|
+
email: digital.robertson@gmail.com
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- lib/heroku_whiz.rb
|
67
|
+
homepage: https://github.com/jrobertson/heroku_whiz
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.2.22
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Handy (experimental) Heroku gem for noobs to create a simple Heroku app in
|
90
|
+
a whiz!
|
91
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
9��a��}�<�'c~GU�_�scb�K��_�'���2���'(�~C�N@u�\z���ھঢ���,�0�q�R^�����HިIM���ׇU�2Ob ������8��3�+XЦf�e�!��T���j�c�����P��l�)��4Z1)E����פ�ɼy8�s�O���{3%hf�qg����g�gu
|