bin_install 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/bin_install/rails.rb +18 -10
- data/lib/bin_install/{ruby_environment_manager → ruby}/rbenv.rb +5 -5
- data/lib/bin_install/{ruby_environment_manager → ruby}/rvm.rb +3 -3
- data/lib/bin_install/ruby.rb +18 -0
- data/lib/bin_install/version.rb +1 -1
- data/lib/bin_install.rb +1 -1
- data/lib/generators/bin_install/templates/install +1 -1
- data/lib/generators/bin_install/templates/update +2 -1
- metadata +5 -5
- data/lib/bin_install/ruby_environment_manager.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf520e85a67139400ac80332f8c75edcc4d3963670c88befc29e2f18add01ce2
|
4
|
+
data.tar.gz: 5290b4fd34eed30a1f53e77008dd05e3386b0841b4f38eb7fc966004d2dbd71c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d42687f1281e5b05564ad718f5c328ff6b61ca9b2100b11c5b96ad5d950d6b4b0bae1b0d1282363ed12a128c21e00063568082265780942242c51867657a9ee
|
7
|
+
data.tar.gz: 983e45d53b549124507dc7d8b1a5c793fc692f10fdd1a0ccf1d672d2b9b0a7d933c21152b008805475514adf171be8b3ebe7da903176a938d35d0075d77320a4
|
data/README.md
CHANGED
@@ -136,11 +136,11 @@ Install [Redis](https://redis.io/) with:
|
|
136
136
|
|
137
137
|
BinInstall::Redis.install # or install!
|
138
138
|
|
139
|
-
###
|
139
|
+
### Ruby
|
140
140
|
|
141
141
|
Install [rbenv](https://github.com/rbenv/rbenv) unless [RVM](https://rvm.io/) is installed with:
|
142
142
|
|
143
|
-
BinInstall::
|
143
|
+
BinInstall::Ruby.install # or install!
|
144
144
|
|
145
145
|
### Server
|
146
146
|
|
data/lib/bin_install/rails.rb
CHANGED
@@ -1,25 +1,33 @@
|
|
1
1
|
module BinInstall
|
2
2
|
module Rails
|
3
|
-
def self.db_setup
|
3
|
+
def self.db_setup(environment = 'development')
|
4
4
|
puts 'Preparing database...'.white
|
5
|
-
rails_or_rake(
|
6
|
-
rails_or_rake!('db:setup RAILS_ENV=test')
|
5
|
+
rails_or_rake("db:setup RAILS_ENV=#{environment}")
|
7
6
|
end
|
8
7
|
|
9
|
-
def self.db_setup!
|
8
|
+
def self.db_setup!(environment = 'development')
|
10
9
|
puts 'Preparing database...'.white
|
11
|
-
rails_or_rake!(
|
12
|
-
rails_or_rake!('db:setup RAILS_ENV=test')
|
10
|
+
rails_or_rake!("db:setup RAILS_ENV=#{environment}")
|
13
11
|
end
|
14
12
|
|
15
|
-
def self.db_migrate
|
13
|
+
def self.db_migrate(environment = 'development')
|
16
14
|
puts 'Migrating database...'.white
|
17
|
-
rails_or_rake(
|
15
|
+
rails_or_rake("db:migrate RAILS_ENV=#{environment}")
|
18
16
|
end
|
19
17
|
|
20
|
-
def self.db_migrate!
|
18
|
+
def self.db_migrate!(environment = 'development')
|
21
19
|
puts 'Migrating database...'.white
|
22
|
-
rails_or_rake!(
|
20
|
+
rails_or_rake!("db:migrate RAILS_ENV=#{environment}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.db_reset(environment = 'development')
|
24
|
+
puts 'Resetting database...'.white
|
25
|
+
rails_or_rake("db:reset RAILS_ENV=#{environment}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.db_reset!(environment = 'development')
|
29
|
+
puts 'Resetting database...'.white
|
30
|
+
rails_or_rake!("db:reset RAILS_ENV=#{environment}")
|
23
31
|
end
|
24
32
|
|
25
33
|
def self.clear
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module BinInstall
|
2
|
-
module
|
2
|
+
module Ruby
|
3
3
|
module Rbenv
|
4
4
|
def self.install
|
5
5
|
if installed?
|
@@ -52,11 +52,11 @@ module BinInstall
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.install_ruby(version = nil)
|
55
|
-
version ||=
|
55
|
+
version ||= Ruby.required_ruby_version
|
56
56
|
puts "Installing Ruby #{version}...".white
|
57
57
|
|
58
58
|
if version
|
59
|
-
if
|
59
|
+
if Ruby.ruby_version_installed?(version)
|
60
60
|
puts "Ruby #{version} is already installed. Skipping.".blue
|
61
61
|
else
|
62
62
|
system("rbenv install #{version}")
|
@@ -68,11 +68,11 @@ module BinInstall
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.install_ruby!(version = nil)
|
71
|
-
version ||=
|
71
|
+
version ||= Ruby.required_ruby_version
|
72
72
|
puts "Installing Ruby #{version}...".white
|
73
73
|
|
74
74
|
if version
|
75
|
-
if
|
75
|
+
if Ruby.ruby_version_installed?(version)
|
76
76
|
puts "Ruby #{version} is already installed. Skipping.".blue
|
77
77
|
else
|
78
78
|
BinInstall.system!("rbenv install #{version}")
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module BinInstall
|
2
|
-
module
|
2
|
+
module Ruby
|
3
3
|
module Rvm
|
4
4
|
def self.install_ruby(version = nil)
|
5
|
-
version ||=
|
5
|
+
version ||= Ruby.required_ruby_version
|
6
6
|
|
7
7
|
if version
|
8
8
|
system("rvm install #{version}")
|
@@ -13,7 +13,7 @@ module BinInstall
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.install_ruby!(version = nil)
|
16
|
-
version ||=
|
16
|
+
version ||= Ruby.required_ruby_version
|
17
17
|
|
18
18
|
if version
|
19
19
|
BinInstall.system!("rvm install #{version}")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'bin_install/ruby/rbenv'
|
2
|
+
require 'bin_install/ruby/rvm'
|
3
|
+
|
4
|
+
module BinInstall
|
5
|
+
module Ruby
|
6
|
+
def self.required_ruby_version
|
7
|
+
Dir.chdir(Dir.pwd) { `cat .ruby-version` }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.ruby_version
|
11
|
+
Dir.chdir(Dir.pwd) { `ruby --version` }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.ruby_version_installed?(version)
|
15
|
+
ruby_version.start_with?("ruby #{version}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/bin_install/version.rb
CHANGED
data/lib/bin_install.rb
CHANGED
@@ -9,7 +9,7 @@ require 'bin_install/node'
|
|
9
9
|
require 'bin_install/postgres'
|
10
10
|
require 'bin_install/rails'
|
11
11
|
require 'bin_install/redis'
|
12
|
-
require 'bin_install/
|
12
|
+
require 'bin_install/ruby'
|
13
13
|
require 'bin_install/server'
|
14
14
|
require 'bin_install/shell'
|
15
15
|
require 'bin_install/version'
|
@@ -6,7 +6,7 @@ APP_ROOT = File.expand_path('..', __dir__)
|
|
6
6
|
Dir.chdir(APP_ROOT) do
|
7
7
|
BinInstall::Brew.require!
|
8
8
|
BinInstall::OhMyZsh.install
|
9
|
-
BinInstall::
|
9
|
+
BinInstall::Ruby.install
|
10
10
|
BinInstall::Postgres.install
|
11
11
|
BinInstall::Postgres.create_superuser('postgres')
|
12
12
|
BinInstall::Gem.install!
|
@@ -6,6 +6,7 @@ APP_ROOT = File.expand_path('..', __dir__)
|
|
6
6
|
Dir.chdir(APP_ROOT) do
|
7
7
|
BinInstall::Gem.install!
|
8
8
|
BinInstall::Yarn.install
|
9
|
-
BinInstall::Rails.db_migrate
|
9
|
+
BinInstall::Rails.db_migrate('development')
|
10
|
+
BinInstall::Rails.db_migrate('test')
|
10
11
|
BinInstall::Rails.clear
|
11
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Singer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -129,9 +129,9 @@ files:
|
|
129
129
|
- lib/bin_install/postgres.rb
|
130
130
|
- lib/bin_install/rails.rb
|
131
131
|
- lib/bin_install/redis.rb
|
132
|
-
- lib/bin_install/
|
133
|
-
- lib/bin_install/
|
134
|
-
- lib/bin_install/
|
132
|
+
- lib/bin_install/ruby.rb
|
133
|
+
- lib/bin_install/ruby/rbenv.rb
|
134
|
+
- lib/bin_install/ruby/rvm.rb
|
135
135
|
- lib/bin_install/server.rb
|
136
136
|
- lib/bin_install/shell.rb
|
137
137
|
- lib/bin_install/version.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'bin_install/ruby_environment_manager/rbenv'
|
2
|
-
require 'bin_install/ruby_environment_manager/rvm'
|
3
|
-
|
4
|
-
module BinInstall
|
5
|
-
module RubyEnvironmentManager
|
6
|
-
def self.install
|
7
|
-
if RubyEnvironmentManager::Rvm.installed?
|
8
|
-
puts 'RVM is already installed. Skipping rbenv install.'.blue
|
9
|
-
else
|
10
|
-
RubyEnvironmentManager::Rbenv.install
|
11
|
-
end
|
12
|
-
|
13
|
-
install_ruby
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.install!
|
17
|
-
if RubyEnvironmentManager::Rvm.installed?
|
18
|
-
puts 'RVM is already installed. Skipping rbenv install.'.blue
|
19
|
-
else
|
20
|
-
RubyEnvironmentManager::Rbenv.install!
|
21
|
-
end
|
22
|
-
|
23
|
-
install_ruby!
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.install_ruby(version = nil)
|
27
|
-
case find_environment_manager!
|
28
|
-
when :rbenv then RubyEnvironmentManager::Rbenv.install_ruby(version)
|
29
|
-
when :rvm then RubyEnvironmentManager::Rvm.install_ruby(version)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.install_ruby!(version = nil)
|
34
|
-
case find_environment_manager!
|
35
|
-
when :rbenv then RubyEnvironmentManager::Rbenv.install_ruby(version)
|
36
|
-
when :rvm then RubyEnvironmentManager::Rvm.install_ruby(version)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.required_ruby_version
|
41
|
-
Dir.chdir(Dir.pwd) { `cat .ruby-version` }
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.ruby_version
|
45
|
-
Dir.chdir(Dir.pwd) { `ruby --version` }
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.ruby_version_installed?(version)
|
49
|
-
ruby_version.start_with?("ruby #{version}")
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.find_environment_manager
|
53
|
-
return :rbenv if RubyEnvironmentManager::Rbenv.installed?
|
54
|
-
return :rvm if RubyEnvironmentManager::Rvm.installed?
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.find_environment_manager!
|
58
|
-
find_environment_manager || abort('No Ruby environment manager found.'.red)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|