fanforce-cli 1.7.1 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -65
- data/Rakefile +1 -1
- data/bin/fanforce +1 -17
- data/fanforce-cli.gemspec +10 -18
- data/lib/fanforce/cli.rb +5 -10
- data/lib/fanforce/cli/_load.rb +177 -0
- data/lib/fanforce/cli/app.rb +16 -26
- data/lib/fanforce/cli/apps.rb +10 -19
- data/lib/fanforce/cli/scripts/version.rb +12 -0
- data/lib/fanforce/cli/utils.rb +64 -44
- data/lib/fanforce/cli/version.rb +1 -1
- metadata +15 -119
- data/bin/fanforce-supercharge +0 -7
- data/lib/fanforce/cli/_base.rb +0 -263
- data/lib/fanforce/cli/commands.rb +0 -512
- data/lib/fanforce/cli/commands_support.rb +0 -205
- data/lib/fanforce/cli/env.rb +0 -41
- data/lib/fanforce/cli/files.rb +0 -290
- data/lib/fanforce/cli/help.rb +0 -99
- data/lib/fanforce/cli/run.rb +0 -53
data/lib/fanforce/cli/help.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
module Fanforce::CLI::Help
|
2
|
-
extend Fanforce::CLI::Help
|
3
|
-
|
4
|
-
def intro(executable, runtype)
|
5
|
-
response = "-----------------------------------------------------------------------------------------------------------------------\n"
|
6
|
-
response += "USAGE: #{executable} <command>\n"
|
7
|
-
end
|
8
|
-
|
9
|
-
def commands(allowed_commands)
|
10
|
-
response = "\n\nAVAILABLE COMMANDS...\n-----------------------------------------------------------------------------------------------------------------------\n"
|
11
|
-
commands = allowed_commands.inject([]) do |results, c|
|
12
|
-
results << self.send(:"#{c}_command") rescue next results
|
13
|
-
end
|
14
|
-
response += commands.join("-----------------------------------------------------------------------------------------------------------------------\n")
|
15
|
-
response += "-----------------------------------------------------------------------------------------------------------------------\n\n"
|
16
|
-
end
|
17
|
-
|
18
|
-
def for(command, allowed_commands)
|
19
|
-
response = "\n#{command.to_s.upcase} COMMAND...\n-----------------------------------------------------------------------------------------------------------------------\n"
|
20
|
-
response += self.method("#{command}_command").call
|
21
|
-
response += "-----------------------------------------------------------------------------------------------------------------------\n\n"
|
22
|
-
end
|
23
|
-
|
24
|
-
def list_command; <<-eos
|
25
|
-
list Show a list of all apps in the current directory
|
26
|
-
eos
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_command; <<-eos
|
30
|
-
create app-ID Creates a new app folder and sets up the file structure
|
31
|
-
eos
|
32
|
-
end
|
33
|
-
|
34
|
-
def delete_command; <<-eos
|
35
|
-
delete app-ID Delete the app folder and all related services
|
36
|
-
eos
|
37
|
-
end
|
38
|
-
|
39
|
-
def update_command; <<-eos
|
40
|
-
update all|OR... Similar to the create command, except it updates existing files
|
41
|
-
|files Ensure all files exist and contain correct config
|
42
|
-
|bundle Run bundle install
|
43
|
-
|pow Ensure correct pow domains are configured
|
44
|
-
|git Ensure git is initialized
|
45
|
-
|env Update ENV variables
|
46
|
-
eos
|
47
|
-
end
|
48
|
-
|
49
|
-
def push_command; <<-eos
|
50
|
-
push RACK_ENV all|OR... Push all changes to the environment specified
|
51
|
-
|env Update environment vars in remote environments
|
52
|
-
|bitbucket Push the latest commit to bitbucket
|
53
|
-
|heroku Push the latest commit to heroku and restart
|
54
|
-
|iron Push changes to workers
|
55
|
-
eos
|
56
|
-
end
|
57
|
-
|
58
|
-
def restart_command; <<-eos
|
59
|
-
restart [*development|RACK_ENV|all] Runs `touch tmp/restart` if development or else `heroku restart`
|
60
|
-
eos
|
61
|
-
end
|
62
|
-
|
63
|
-
def count_command; <<-eos
|
64
|
-
count Display the number of fanforce apps in the current directory
|
65
|
-
eos
|
66
|
-
end
|
67
|
-
|
68
|
-
def bundle_command; <<-eos
|
69
|
-
bundle install|update Run bundle on all apps in current fanforce
|
70
|
-
eos
|
71
|
-
end
|
72
|
-
|
73
|
-
def git_command; <<-eos
|
74
|
-
git [ANY GIT COMMAND] Run the same git command across all apps in current fanforce
|
75
|
-
git status:overview A custom git command that displays a simple status for each app
|
76
|
-
eos
|
77
|
-
end
|
78
|
-
|
79
|
-
def iron_command; <<-eos
|
80
|
-
iron upload|reset|delete RACK_ENV|all Updates env variables and upload one or more workers to iron.io
|
81
|
-
eos
|
82
|
-
end
|
83
|
-
|
84
|
-
def version_command; <<-eos
|
85
|
-
version Display your current Fanforce CLI version number
|
86
|
-
eos
|
87
|
-
end
|
88
|
-
|
89
|
-
def config_command; <<-eos
|
90
|
-
config Display your Fanforce CLI config in the current directory
|
91
|
-
eos
|
92
|
-
end
|
93
|
-
|
94
|
-
def cleanorgs_command; <<-eos
|
95
|
-
cleanorgs environment supercore_api_key Remove installs that are no longer valid in the db
|
96
|
-
eos
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
data/lib/fanforce/cli/run.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
module Fanforce::CLI::Run
|
2
|
-
require 'pty'
|
3
|
-
|
4
|
-
def self.bundle_install(dir)
|
5
|
-
Dir.chdir(dir) do
|
6
|
-
command('gem install bundler') if Gem::Specification::find_all_by_name('bundler').empty?
|
7
|
-
command('bundle install')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.pow_create(app, root_domain)
|
12
|
-
domain = "#{app._id}.#{root_domain}"
|
13
|
-
|
14
|
-
symbolic_link = "#{ENV['HOME']}/.pow/#{domain.gsub('.gg','')}"
|
15
|
-
File.delete(symbolic_link) if File.exists?(symbolic_link)
|
16
|
-
`ln -s #{app.dir} #{symbolic_link}`
|
17
|
-
puts "#{'Connected'.format(:bold,:green)} #{domain} to #{app.dir}/"
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.pow_destroy(app, root_domain)
|
21
|
-
domain = "#{app._id}.#{root_domain}"
|
22
|
-
symbolic_link = "#{ENV['HOME']}/.pow/#{domain.gsub('.gg','')}"
|
23
|
-
if File.exists?(symbolic_link)
|
24
|
-
File.delete(symbolic_link)
|
25
|
-
puts "#{'Removed'.format(:bold,:green)} #{domain}"
|
26
|
-
else
|
27
|
-
puts "#{'Already Removed'.format(:bold,:green)} #{domain} to #{app.dir}/"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.git_init
|
32
|
-
response = `git init`
|
33
|
-
`git config core.fileMode false`
|
34
|
-
return response
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.git_add
|
38
|
-
`git add .`
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.git_first_commit
|
42
|
-
`git commit -m "initial fanforce commit"`
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.command(command, print_now=true)
|
46
|
-
output = []
|
47
|
-
PTY.spawn(command) do |stdin, stdout, pid|
|
48
|
-
stdin.each { |line| output << line; print line if print_now }
|
49
|
-
end
|
50
|
-
output.join("\n")
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|