bin_install 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -7
- data/lib/bin_install/mysql.rb +13 -0
- data/lib/bin_install/postgres.rb +12 -6
- data/lib/bin_install/version.rb +1 -1
- data/lib/bin_install.rb +1 -0
- data/lib/generators/bin_install/install_generator.rb +23 -0
- data/lib/generators/bin_install/templates/install +15 -0
- data/lib/generators/bin_install/templates/kill +8 -0
- data/lib/generators/bin_install/templates/update +11 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a2e4626da5353ef03c0da52c52aac16413ed77064cbb29a60ae29dc34012469
|
4
|
+
data.tar.gz: 5fda4f42d2217f3152a1ca7960a11f5d79df65697866d98430ad82f5be126b9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 356494c7d54e530fb331d6db8ce54f53d4912909a40d91fccddc073d26434168c6bdbcae984ada5db906af846e7ce3bc234e66e549b98869beeb53d7ef270549
|
7
|
+
data.tar.gz: bc591902a6cbe9c4e61c6a29a56a9fd82b2f23ae245ae15f65e81287baa985779cff4094e1b296b1219e05b9e23ce7a810d26e91eac265936e05aac505950713
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Will create the following files with some common defaults:
|
|
26
26
|
|
27
27
|
Most methods in this library have also have a bang version that will halt all further execution. No bang methods will only display the error output of the command but execution will continue.
|
28
28
|
|
29
|
-
###
|
29
|
+
### Brew
|
30
30
|
|
31
31
|
Require [Homebrew](https://brew.sh/) before continuing:
|
32
32
|
|
@@ -48,13 +48,19 @@ Install or Upgrade with one command:
|
|
48
48
|
|
49
49
|
BinInstall::Brew.install_or_upgrade('package') # or install_or_upgrade!('package')
|
50
50
|
|
51
|
-
###
|
51
|
+
### Gem
|
52
52
|
|
53
53
|
Install all [gems](https://rubygems.org/) with:
|
54
54
|
|
55
55
|
BinInstall::Gem.install # or install!
|
56
56
|
|
57
|
-
###
|
57
|
+
### Mysql
|
58
|
+
|
59
|
+
Install [MySQL](https://www.mysql.com/) with:
|
60
|
+
|
61
|
+
BinInstall::Mysql.install # or install!
|
62
|
+
|
63
|
+
### Node
|
58
64
|
|
59
65
|
Install [Node.js](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/en/) with:
|
60
66
|
|
@@ -64,17 +70,21 @@ Upgrade [Yarn](https://yarnpkg.com/en/) with:
|
|
64
70
|
|
65
71
|
BinInstall::Node.upgrade_yarn # or upgrade_yarn!
|
66
72
|
|
67
|
-
###
|
73
|
+
### Postgres
|
68
74
|
|
69
75
|
Install [PostgreSQL](https://www.postgresql.org/) with:
|
70
76
|
|
71
77
|
BinInstall::Postgres.install # or install!
|
72
78
|
|
73
|
-
Create a user with
|
79
|
+
Create a user with a username and blank password:
|
80
|
+
|
81
|
+
BinInstall::Postgres.create_user('username') # or create_user!('username')
|
82
|
+
|
83
|
+
Create a superuser with a username and blank password:
|
74
84
|
|
75
|
-
BinInstall::Postgres.
|
85
|
+
BinInstall::Postgres.create_superuser('username') # or create_superuser!('username')
|
76
86
|
|
77
|
-
###
|
87
|
+
### Rails
|
78
88
|
|
79
89
|
Setup database with:
|
80
90
|
|
data/lib/bin_install/postgres.rb
CHANGED
@@ -3,21 +3,27 @@ module BinInstall
|
|
3
3
|
def self.install
|
4
4
|
puts 'Installing PostgreSQL...'.white
|
5
5
|
Brew.install_or_upgrade('postgresql')
|
6
|
-
create_default_user
|
7
6
|
end
|
8
7
|
|
9
8
|
def self.install!
|
10
9
|
puts 'Installing PostgreSQL...'.white
|
11
10
|
Brew.install_or_upgrade!('postgresql')
|
12
|
-
create_default_user!
|
13
11
|
end
|
14
12
|
|
15
|
-
def self.
|
16
|
-
system(
|
13
|
+
def self.create_superuser(username = 'postgres')
|
14
|
+
system("createuser --superuser #{username}")
|
17
15
|
end
|
18
16
|
|
19
|
-
def self.
|
20
|
-
BinInstall.system!(
|
17
|
+
def self.create_superuser!(username = 'postgres')
|
18
|
+
BinInstall.system!("createuser --superuser #{username}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_user(username = 'postgres')
|
22
|
+
system("createuser #{username}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.create_user!(username = 'postgres')
|
26
|
+
BinInstall.system!("createuser #{username}")
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
data/lib/bin_install/version.rb
CHANGED
data/lib/bin_install.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module BinInstall
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
desc 'Copies scripts to your bin directory.'
|
9
|
+
def copy_scripts
|
10
|
+
copy_bin_file 'install'
|
11
|
+
copy_bin_file 'update'
|
12
|
+
copy_bin_file 'kill'
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def copy_bin_file(file)
|
18
|
+
copy_file file, "bin/#{file}"
|
19
|
+
FileUtils.chmod(0744, "bin/#{file}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'bin_install'
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
5
|
+
|
6
|
+
Dir.chdir(APP_ROOT) do
|
7
|
+
BinInstall::Brew.require!
|
8
|
+
BinInstall::Gem.install!
|
9
|
+
BinInstall::RubyEnvironmentManager.install
|
10
|
+
BinInstall::Postgres.install
|
11
|
+
BinInstall::Postgres.create_superuser('postgres')
|
12
|
+
BinInstall::Node.install
|
13
|
+
BinInstall::Rails.db_setup
|
14
|
+
BinInstall::Rails.clear
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bin_install
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Singer
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/bin_install.rb
|
116
116
|
- lib/bin_install/brew.rb
|
117
117
|
- lib/bin_install/gem.rb
|
118
|
+
- lib/bin_install/mysql.rb
|
118
119
|
- lib/bin_install/node.rb
|
119
120
|
- lib/bin_install/postgres.rb
|
120
121
|
- lib/bin_install/rails.rb
|
@@ -123,6 +124,10 @@ files:
|
|
123
124
|
- lib/bin_install/ruby_environment_manager/rvm.rb
|
124
125
|
- lib/bin_install/server.rb
|
125
126
|
- lib/bin_install/version.rb
|
127
|
+
- lib/generators/bin_install/install_generator.rb
|
128
|
+
- lib/generators/bin_install/templates/install
|
129
|
+
- lib/generators/bin_install/templates/kill
|
130
|
+
- lib/generators/bin_install/templates/update
|
126
131
|
homepage: https://github.com/ramaboo/bin_install
|
127
132
|
licenses:
|
128
133
|
- MIT
|