bin_install 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d7cc7be65e21a4b462e317507a1923ce5de2c952cedea6cca4cf5150d228947
4
- data.tar.gz: c172cbeca434d96f882fa1f2330f51128886db0006be8607e6c4d4f8ecd202ab
3
+ metadata.gz: 2a2e4626da5353ef03c0da52c52aac16413ed77064cbb29a60ae29dc34012469
4
+ data.tar.gz: 5fda4f42d2217f3152a1ca7960a11f5d79df65697866d98430ad82f5be126b9a
5
5
  SHA512:
6
- metadata.gz: ddc577bc489edd7029a2c28c6f565224498f44055251fc1b38e86f7a717844d44b8bedfc56938251c20a3e6e89b863bd9599c58cc823626d73f93508a8d95110
7
- data.tar.gz: 6a4a4d09094f0839a4069d1aec4523f49e9a0aa0ed362b1d7ceff4ef4efc3a6becdcadb09fb5bf33b1dd7edad6bb506b5e2242effaab4d8e8f8a9e5bd1c7ef34
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
- ### [Brew](https://brew.sh/)
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
- ### [Gem](https://rubygems.org/)
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
- ### [Node](https://nodejs.org/en/)
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
- ### [Postgres](https://www.postgresql.org/)
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 the username *postgres* and a blank password:
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.create_default_user # or create_default_user!
85
+ BinInstall::Postgres.create_superuser('username') # or create_superuser!('username')
76
86
 
77
- ### [Rails](https://rubyonrails.org/)
87
+ ### Rails
78
88
 
79
89
  Setup database with:
80
90
 
@@ -0,0 +1,13 @@
1
+ module BinInstall
2
+ module Mysql
3
+ def self.install
4
+ puts 'Installing MySQL...'.white
5
+ Brew.install_or_upgrade('mysql')
6
+ end
7
+
8
+ def self.install!
9
+ puts 'Installing MySQL...'.white
10
+ Brew.install_or_upgrade!('mysql')
11
+ end
12
+ end
13
+ end
@@ -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.create_default_user
16
- system('createuser -s postgres')
13
+ def self.create_superuser(username = 'postgres')
14
+ system("createuser --superuser #{username}")
17
15
  end
18
16
 
19
- def self.create_default_user!
20
- BinInstall.system!('createuser -s postgres')
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
@@ -1,3 +1,3 @@
1
1
  module BinInstall
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
data/lib/bin_install.rb CHANGED
@@ -2,6 +2,7 @@ require 'awesome_print'
2
2
 
3
3
  require 'bin_install/brew'
4
4
  require 'bin_install/gem'
5
+ require 'bin_install/mysql'
5
6
  require 'bin_install/node'
6
7
  require 'bin_install/postgres'
7
8
  require 'bin_install/rails'
@@ -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
@@ -0,0 +1,8 @@
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::Server.kill!
8
+ end
@@ -0,0 +1,11 @@
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::Gem.install!
8
+ BinInstall::Node.yarn_upgrade
9
+ BinInstall::Rails.db_migrate
10
+ BinInstall::Rails.clear
11
+ 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.3
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