negroku 2.4.2 → 2.5.0
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 +4 -4
- data/.travis.yml +2 -0
- data/lib/negroku.rb +13 -0
- data/lib/negroku/{deploy.rb → capistrano/deploy.rb} +1 -2
- data/lib/negroku/{eye.rb → capistrano/eye.rb} +0 -0
- data/lib/negroku/{eye → capistrano/eye}/delayed_job.rb +0 -0
- data/lib/negroku/{eye → capistrano/eye}/thinking_sphinx.rb +0 -0
- data/lib/negroku/{eye → capistrano/eye}/unicorn.rb +0 -0
- data/lib/negroku/{formatters → capistrano/formatters}/simple.rb +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/bower.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/bundler.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/delayed_job.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/env.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/eye.rake +1 -1
- data/lib/negroku/{tasks → capistrano/tasks}/eye/delayed_job.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/eye/thinking_sphinx.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/eye/unicorn.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/github.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/log.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/nginx.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/nodenv.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/rails.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/rbenv.rake +0 -0
- data/lib/negroku/{tasks → capistrano/tasks}/thinking_sphinx.rake +1 -1
- data/lib/negroku/{tasks → capistrano/tasks}/unicorn.rake +1 -1
- data/lib/negroku/{tasks → capistrano/tasks}/whenever.rake +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/eye/_delayed_job.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/eye/_process.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/eye/_sphinx.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/eye/_unicorn.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/eye/application.eye.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/thinking_sphinx.yml.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/unicorn_rails.rb.erb +0 -0
- data/lib/negroku/{templates/tasks → capistrano/templates}/unicorn_rails_activerecord.rb.erb +0 -0
- data/lib/negroku/capistrano/update.rb +3 -0
- data/lib/negroku/cli.rb +8 -5
- data/lib/negroku/cli/commands/app.rb +10 -1
- data/lib/negroku/cli/commands/env.rb +1 -1
- data/lib/negroku/cli/commands/stage.rb +1 -1
- data/lib/negroku/config.rb +64 -0
- data/lib/negroku/helpers.rb +1 -22
- data/lib/negroku/helpers/tasks.rb +21 -0
- data/lib/negroku/helpers/templates.rb +1 -3
- data/lib/negroku/helpers/watch.rb +1 -1
- data/lib/negroku/locales/en.yml +15 -0
- data/lib/negroku/modes/app.rb +167 -0
- data/lib/negroku/modes/env.rb +59 -0
- data/lib/negroku/modes/stage.rb +95 -0
- data/lib/negroku/templates/Capfile.erb +49 -0
- data/lib/negroku/templates/{negroku/deploy.rb.erb → deploy.rb.erb} +0 -0
- data/lib/negroku/templates/{negroku/stage.rb.erb → stage.rb.erb} +0 -0
- data/lib/negroku/version.rb +1 -1
- data/lib/negroku/versionable.rb +31 -0
- data/negroku.gemspec +7 -2
- data/spec/lib/modes/app_spec.rb +47 -0
- data/spec/lib/modes/env_spec.rb +44 -0
- data/spec/lib/{cli → modes}/stage_spec.rb +20 -17
- data/spec/lib/versionable_spec.rb +88 -0
- data/spec/negroku_mocks.rb +10 -0
- data/spec/spec_helper.rb +10 -4
- metadata +108 -47
- data/lib/negroku/cli/bootstrap.rb +0 -58
- data/lib/negroku/cli/env.rb +0 -57
- data/lib/negroku/cli/stage.rb +0 -93
- data/lib/negroku/tasks/negroku.rake +0 -48
- data/lib/negroku/templates/negroku/Capfile.erb +0 -46
- data/spec/lib/cli/bootstrap_spec.rb +0 -46
- data/spec/lib/cli/env_spec.rb +0 -49
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dcb77d7922f3f0294a836a8995476b009898fa2
|
|
4
|
+
data.tar.gz: 2162463bb26561d51e152dc47f90ae58fe5b6ca8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f158341dcc67274203b30f9f749f8fc4bb82b2763171772a4afc2b5fbfd217d6b584ce8c0b851b61145a2dd8234a9b681cb0dbf9f6a28dba79167cf7baaf9523
|
|
7
|
+
data.tar.gz: 9fd78397e37a89241b39619b3037a8415de29848fc4485524853dc1ed4dad1cd6a3f628029d8971be947d63a1cfeb51d50bec575dab2bdfbe586bbf386520d8a
|
data/.travis.yml
CHANGED
data/lib/negroku.rb
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
require 'negroku/i18n'
|
|
2
2
|
require 'negroku/version'
|
|
3
|
+
require 'negroku/versionable'
|
|
4
|
+
|
|
5
|
+
module Negroku
|
|
6
|
+
include Negroku::Versionable
|
|
7
|
+
|
|
8
|
+
def self.version
|
|
9
|
+
VERSION
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.capfile_version
|
|
13
|
+
defined?(::CAPFILE_VERSION).nil? ? "0.0.0" : ::CAPFILE_VERSION
|
|
14
|
+
end
|
|
15
|
+
end
|
|
3
16
|
|
|
4
17
|
# Add requires for other files you add to your project here, so
|
|
5
18
|
# you just need to require this one file in your bin file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require 'negroku/helpers'
|
|
1
|
+
require 'negroku/helpers/tasks'
|
|
2
2
|
|
|
3
3
|
# Base configuration
|
|
4
4
|
namespace :load do
|
|
@@ -21,7 +21,6 @@ namespace :load do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# Load Negroku tasks
|
|
24
|
-
load_task "negroku"
|
|
25
24
|
load_task "env"
|
|
26
25
|
load_task "rbenv" if required? 'capistrano/rbenv'
|
|
27
26
|
load_task "nodenv" if required? 'capistrano/nodenv'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -78,7 +78,7 @@ namespace :negroku do
|
|
|
78
78
|
|
|
79
79
|
# use a build in template if the template doesn't exists in the project
|
|
80
80
|
unless File.exists?(template_path)
|
|
81
|
-
template_path = "
|
|
81
|
+
template_path = "capistrano/templates/eye/application.eye.erb"
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
config = build_template(template_path, nil, binding)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -37,7 +37,7 @@ namespace :negroku do
|
|
|
37
37
|
|
|
38
38
|
# user a build in template if the template doesn't exists in the project
|
|
39
39
|
unless File.exists?(template_path)
|
|
40
|
-
template_path = "
|
|
40
|
+
template_path = "capistrano/templates/thinking_sphinx.yml.erb"
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
config = build_template(template_path, nil, binding)
|
|
@@ -70,7 +70,7 @@ namespace :negroku do
|
|
|
70
70
|
|
|
71
71
|
# user a build in template if the template doesn't exists in the project
|
|
72
72
|
unless File.exists?(template_path)
|
|
73
|
-
template_path = "
|
|
73
|
+
template_path = "capistrano/templates/unicorn_#{fetch(:unicorn_template_type)}.rb.erb"
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
config = build_template(template_path, nil, binding)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/negroku/cli.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
require 'capistrano/all'
|
|
2
2
|
require 'capistrano/setup'
|
|
3
3
|
require 'capistrano/deploy'
|
|
4
|
+
require 'bundler'
|
|
5
|
+
require 'virtus'
|
|
4
6
|
|
|
5
7
|
# Load applications deploy config if it exists
|
|
6
8
|
require './config/deploy' if File.exists? "./config/deploy.rb"
|
|
@@ -9,15 +11,16 @@ require 'gli'
|
|
|
9
11
|
require 'inquirer'
|
|
10
12
|
require 'negroku/i18n'
|
|
11
13
|
require 'negroku/version'
|
|
12
|
-
require 'negroku/
|
|
13
|
-
require 'negroku/
|
|
14
|
-
require 'negroku/
|
|
14
|
+
require 'negroku/versionable'
|
|
15
|
+
require 'negroku/config'
|
|
16
|
+
require 'negroku/modes/app'
|
|
17
|
+
require 'negroku/modes/stage'
|
|
18
|
+
require 'negroku/modes/env'
|
|
15
19
|
require 'negroku/helpers/app_directory'
|
|
16
20
|
require 'negroku/helpers/templates'
|
|
17
21
|
|
|
18
22
|
require 'capistrano/rbenv'
|
|
19
|
-
require 'negroku/deploy'
|
|
20
|
-
|
|
23
|
+
require 'negroku/capistrano/deploy'
|
|
21
24
|
|
|
22
25
|
module Negroku::CLI
|
|
23
26
|
|
|
@@ -7,7 +7,16 @@ module Negroku::CLI
|
|
|
7
7
|
app.command :create do |create|
|
|
8
8
|
create.action do |global_options,options,args|
|
|
9
9
|
|
|
10
|
-
Negroku::
|
|
10
|
+
Negroku::Modes::App.install
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
app.desc 'Update your negroku capfile'
|
|
16
|
+
app.command :update do |create|
|
|
17
|
+
create.action do |global_options,options,args|
|
|
18
|
+
|
|
19
|
+
Negroku::Modes::App.update
|
|
11
20
|
|
|
12
21
|
end
|
|
13
22
|
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module Negroku
|
|
2
|
+
class Feature
|
|
3
|
+
include Virtus.value_object
|
|
4
|
+
|
|
5
|
+
values do
|
|
6
|
+
attribute :name, String
|
|
7
|
+
attribute :required, Boolean, default: false
|
|
8
|
+
attribute :enabled, Boolean, default: false, :writer => :public
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Negroku::ConfigFactory
|
|
14
|
+
include Virtus.model
|
|
15
|
+
|
|
16
|
+
def self.loaded_in_bundler(name)
|
|
17
|
+
Bundler.load.dependencies.any? {|a| a.name == name}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
attribute :bower, Negroku::Feature, default: {
|
|
21
|
+
name: "bower", enabled: File.exists?('bower.json')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
attribute :bundler, Negroku::Feature, default: {
|
|
25
|
+
name: "bundler", enabled: File.exists?('Gemfile')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
attribute :delayed_job, Negroku::Feature, default: {
|
|
29
|
+
name: "delayed_job", enabled: loaded_in_bundler('delayed_jobs')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
attribute :nginx, Negroku::Feature, default: {
|
|
33
|
+
name: "nginx", enabled: true, required: true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
attribute :nodenv, Negroku::Feature, default: {
|
|
37
|
+
name: "nodenv", enabled: true, required: true
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
attribute :rails, Negroku::Feature, default: {
|
|
41
|
+
name: "rails", enabled: loaded_in_bundler('rails')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
attribute :rbenv, Negroku::Feature, default: {
|
|
45
|
+
name: "rbenv", enabled: true, required: true
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
attribute :sphinx, Negroku::Feature, default: {
|
|
49
|
+
name: "sphinx", enabled: loaded_in_bundler('thinking-sphinx')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
attribute :unicorn, Negroku::Feature, default: {
|
|
53
|
+
name: "unicorn", enabled: loaded_in_bundler('unicorn')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
attribute :whenever, Negroku::Feature, default: {
|
|
57
|
+
name: "whenever", enabled: loaded_in_bundler('whenever')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# private
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Negroku::Config = Negroku::ConfigFactory.new
|
data/lib/negroku/helpers.rb
CHANGED
|
@@ -2,25 +2,4 @@ require 'negroku/helpers/templates'
|
|
|
2
2
|
require 'negroku/helpers/watch'
|
|
3
3
|
require 'negroku/helpers/logs'
|
|
4
4
|
require 'negroku/helpers/env'
|
|
5
|
-
|
|
6
|
-
# Find out if a specific library file was already required
|
|
7
|
-
def required?(file)
|
|
8
|
-
rex = Regexp.new("/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
|
|
9
|
-
$LOADED_FEATURES.find { |f| f =~ rex }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def any_required?(arr)
|
|
13
|
-
arr.any? { |file| required?(file) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def all_required?(arr)
|
|
17
|
-
arr.all? { |file| required?(file) }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def load_task(name, dependencies = [])
|
|
21
|
-
if all_required? dependencies
|
|
22
|
-
load File.join(File.dirname(__FILE__), 'tasks', "#{name}.rake")
|
|
23
|
-
else
|
|
24
|
-
fail "To load #{name} you need to include #{dependencies.join ", "}"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
5
|
+
require 'negroku/helpers/tasks'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Find out if a specific library file was already required
|
|
2
|
+
def required?(file)
|
|
3
|
+
rex = Regexp.new("/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
|
|
4
|
+
$LOADED_FEATURES.find { |f| f =~ rex }
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def any_required?(arr)
|
|
8
|
+
arr.any? { |file| required?(file) }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def all_required?(arr)
|
|
12
|
+
arr.all? { |file| required?(file) }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def load_task(name, dependencies = [])
|
|
16
|
+
if all_required? dependencies
|
|
17
|
+
load File.join(File.dirname(__FILE__), '..', 'capistrano', 'tasks', "#{name}.rake")
|
|
18
|
+
else
|
|
19
|
+
fail "To load #{name} you need to include #{dependencies.join ", "}"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -11,8 +11,6 @@ def build_template(template, destination, binding)
|
|
|
11
11
|
File.open(destination.to_s, 'w+') do |f|
|
|
12
12
|
f.write(result)
|
|
13
13
|
end
|
|
14
|
-
|
|
15
|
-
puts I18n.t(:written_file, scope: :negroku, file: destination)
|
|
16
14
|
else
|
|
17
15
|
return StringIO.new(result)
|
|
18
16
|
end
|
|
@@ -29,7 +27,7 @@ def get_template_file(filename)
|
|
|
29
27
|
if File.exists?(filename)
|
|
30
28
|
templateFile = filename
|
|
31
29
|
else
|
|
32
|
-
templateFile = File.expand_path("
|
|
30
|
+
templateFile = File.expand_path("../../#{filename}", __FILE__)
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
File.read(templateFile)
|
|
@@ -6,7 +6,7 @@ def watch_process(name, options = {})
|
|
|
6
6
|
options[:template] ||= name.to_sym
|
|
7
7
|
|
|
8
8
|
if options[:template].kind_of?(Symbol)
|
|
9
|
-
options[:template] = "
|
|
9
|
+
options[:template] = "capistrano/templates/eye/_#{options[:template]}.erb"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
processes[name] = options
|
data/lib/negroku/locales/en.yml
CHANGED
|
@@ -17,3 +17,18 @@ en:
|
|
|
17
17
|
ask_domains: "Type the domains to use"
|
|
18
18
|
ask_server_url: "Type the server url to deploy to"
|
|
19
19
|
ask_set_vars: "Do you want to set rbenv-vars to the server now?"
|
|
20
|
+
application_features: "What features do you want to enable?"
|
|
21
|
+
updating_capfile: "Updating application Capfile...."
|
|
22
|
+
updated_capfile: "The Capfile was updated"
|
|
23
|
+
no_change_capfile: "Nothing to update "
|
|
24
|
+
gem_up_to_date: "\u2713 Negroku is up to date"
|
|
25
|
+
capfile_up_to_date: "\u2713 Your Capfile is up to date"
|
|
26
|
+
gem_new_version: "There is a new version of negroku\n"
|
|
27
|
+
capfile_new_version: "\u2718 Your Capfile version doesn't match your negroku version\n"
|
|
28
|
+
gem_latest_version: "Latest negroku version: %{version}\n"
|
|
29
|
+
gem_current_version: "Your negroku version: %{version}\n"
|
|
30
|
+
capfile_current_version: "Your Capfile version: %{version}\n"
|
|
31
|
+
continue_without_update: "Do you want to continue without updating?"
|
|
32
|
+
capfile_ask_update: "Capfile might be out-dated, the current negroku version might have added new features to your Capfile,\ndo you want to continue without update your Capfile?"
|
|
33
|
+
gem_update_instructions: "To update just change your %{gemfile} with the latest version and run %{cmd}"
|
|
34
|
+
capfile_update_instructions: "To update your %{capfile} just run %{cmd}"
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
require 'inquirer'
|
|
2
|
+
require 'colorize'
|
|
3
|
+
require 'negroku'
|
|
4
|
+
|
|
5
|
+
module Negroku::Modes
|
|
6
|
+
module App
|
|
7
|
+
def install
|
|
8
|
+
|
|
9
|
+
check_version
|
|
10
|
+
|
|
11
|
+
data = {}
|
|
12
|
+
data[:application_name] = ask_name
|
|
13
|
+
data[:repo_url] = select_repo
|
|
14
|
+
|
|
15
|
+
ask_features
|
|
16
|
+
|
|
17
|
+
custom_capify data
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update
|
|
22
|
+
|
|
23
|
+
puts I18n.t :updating_capfile, scope: :negroku
|
|
24
|
+
|
|
25
|
+
capfilePath = AppDirectory.root.join('Capfile')
|
|
26
|
+
capfile = File.read(capfilePath)
|
|
27
|
+
|
|
28
|
+
build_capfile
|
|
29
|
+
|
|
30
|
+
capfile_new = File.read(capfilePath)
|
|
31
|
+
|
|
32
|
+
if capfile_new != capfile
|
|
33
|
+
puts I18n.t :updated_capfile, scope: :negroku
|
|
34
|
+
else
|
|
35
|
+
puts I18n.t :no_change_capfile, scope: :negroku
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# This code was exatracted from capistrano to be used with our own templates
|
|
41
|
+
# https://github.com/capistrano/capistrano/blob/68e7632c5f16823a09c324d556a208e096abee62/lib/capistrano/tasks/install.rake
|
|
42
|
+
def custom_capify(data={}, config=nil)
|
|
43
|
+
# defaults
|
|
44
|
+
data[:server_url] = ""
|
|
45
|
+
data[:branch] = "master"
|
|
46
|
+
|
|
47
|
+
FileUtils.mkdir_p AppDirectory.deploy
|
|
48
|
+
|
|
49
|
+
build_capfile
|
|
50
|
+
|
|
51
|
+
deploy_rb = AppDirectory.config.join('deploy.rb')
|
|
52
|
+
build_template("templates/deploy.rb.erb", deploy_rb, binding)
|
|
53
|
+
|
|
54
|
+
FileUtils.mkdir_p AppDirectory.tasks
|
|
55
|
+
|
|
56
|
+
puts I18n.t :capified, scope: :negroku
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def build_capfile
|
|
61
|
+
# Default Config
|
|
62
|
+
config ||= Negroku::Config
|
|
63
|
+
|
|
64
|
+
capfile = AppDirectory.root.join('Capfile')
|
|
65
|
+
build_template('templates/Capfile.erb', capfile, binding)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Ask the application name
|
|
69
|
+
def ask_name
|
|
70
|
+
question = I18n.t :application_name, scope: :negroku
|
|
71
|
+
Ask.input question, default: File.basename(Dir.getwd)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def ask_features
|
|
75
|
+
optional_features = Negroku::Config::attributes.select{|k,v| !v.required?}
|
|
76
|
+
default_features = optional_features.map{|k,v| v.enabled?}
|
|
77
|
+
features_names = optional_features.map{|k,v| v.name}
|
|
78
|
+
|
|
79
|
+
question = I18n.t :application_features, scope: :negroku
|
|
80
|
+
selected = Ask.checkbox question, features_names, default: default_features
|
|
81
|
+
|
|
82
|
+
optional_features.each.with_index do |(idx, feat), index|
|
|
83
|
+
Negroku::Config[feat.name].enabled = selected[index]
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Get git remotes from current git and ask to select one
|
|
88
|
+
def select_repo
|
|
89
|
+
remote_urls = %x(git remote -v 2> /dev/null | awk '{print $2}' | uniq).split("\n")
|
|
90
|
+
remote_urls << (I18n.t :other, scope: :negroku)
|
|
91
|
+
|
|
92
|
+
question = I18n.t :choose_repo_url, scope: :negroku
|
|
93
|
+
selected_idx = Ask.list question, remote_urls
|
|
94
|
+
|
|
95
|
+
if selected_idx == remote_urls.length - 1
|
|
96
|
+
question = I18n.t :type_repo_url, scope: :negroku
|
|
97
|
+
Ask.input question
|
|
98
|
+
else remote_urls[selected_idx] end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def check_version
|
|
103
|
+
updated = Negroku.check_version
|
|
104
|
+
|
|
105
|
+
if(updated)
|
|
106
|
+
puts I18n.t(:gem_up_to_date, scope: :negroku).colorize(:green)
|
|
107
|
+
else
|
|
108
|
+
|
|
109
|
+
puts I18n.t(:gem_new_version, scope: :negroku).colorize(:yellow)
|
|
110
|
+
|
|
111
|
+
puts I18n.t(:gem_latest_version, scope: :negroku, version: Negroku.latest.colorize(:green))
|
|
112
|
+
puts I18n.t(:gem_current_version, scope: :negroku, version: Negroku.version.colorize(:yellow))
|
|
113
|
+
|
|
114
|
+
puts "\n"
|
|
115
|
+
|
|
116
|
+
gemfile_str = "Gemfile".colorize(mode: :bold)
|
|
117
|
+
cmd_str = "bundle install".colorize(mode: :bold)
|
|
118
|
+
puts I18n.t(:gem_update_instructions, scope: :negroku, gemfile: gemfile_str, cmd: cmd_str)
|
|
119
|
+
|
|
120
|
+
puts "\n"
|
|
121
|
+
|
|
122
|
+
question = I18n.t(:continue_without_update, scope: :negroku)
|
|
123
|
+
continue = ::Ask.confirm(question, default: true)
|
|
124
|
+
|
|
125
|
+
exit 0 unless(continue)
|
|
126
|
+
|
|
127
|
+
return continue
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def check_capfile_version
|
|
132
|
+
updated = Negroku.check_capfile_version
|
|
133
|
+
|
|
134
|
+
if(updated)
|
|
135
|
+
puts I18n.t(:capfile_up_to_date, scope: :negroku).colorize(:green)
|
|
136
|
+
else
|
|
137
|
+
puts I18n.t(:capfile_new_version, scope: :negroku).colorize(:red)
|
|
138
|
+
|
|
139
|
+
puts I18n.t(:gem_current_version, scope: :negroku, version: Negroku.version.colorize(:green))
|
|
140
|
+
puts I18n.t(:capfile_current_version, scope: :negroku, version: Negroku.capfile_version.colorize(:red))
|
|
141
|
+
|
|
142
|
+
puts "\n"
|
|
143
|
+
|
|
144
|
+
capfile_str = "Capfile".colorize(mode: :bold)
|
|
145
|
+
cmd_str = "negroku app update".colorize(mode: :bold)
|
|
146
|
+
puts I18n.t(:capfile_update_instructions, scope: :negroku, capfile: capfile_str, cmd: cmd_str)
|
|
147
|
+
|
|
148
|
+
puts "\n"
|
|
149
|
+
|
|
150
|
+
question = I18n.t(:continue_without_update, scope: :negroku)
|
|
151
|
+
continue = ::Ask.confirm(question, default: false)
|
|
152
|
+
|
|
153
|
+
exit 0 unless(continue)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def check_all_versions
|
|
158
|
+
continue = self.check_version
|
|
159
|
+
|
|
160
|
+
unless(continue)
|
|
161
|
+
self.check_capfile_version
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
extend self
|
|
166
|
+
end
|
|
167
|
+
end
|