fanforce-cli 2.0.0.rc1 → 2.0.0.rc3
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/Gemfile.lock +1 -1
- data/lib/fanforce/cli/_load.rb +5 -6
- data/lib/fanforce/cli/app.rb +7 -6
- data/lib/fanforce/cli/apps.rb +5 -5
- data/lib/fanforce/cli/utils.rb +12 -1
- data/lib/fanforce/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2b5e16173ec5a9c2a46776665016354baf4a3de
|
4
|
+
data.tar.gz: 042f04e77a941eb5d86e77d6d69dabed57031e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98104974808e0504c1688bd9ed0c459e51b1568abcf678e701d176519f5736ff8ab15df2d999594ade4aa07001254259ed8e0a750d1d00d195313bc49db7510c
|
7
|
+
data.tar.gz: 206a58500e0b0f759a8efa38e3c72d0681c0aba2cdbc080a55cc1e9323246ef0d9fba0e113dd828960247db9d2104e95ea722dea22b27707745a518f140ece21
|
data/Gemfile.lock
CHANGED
data/lib/fanforce/cli/_load.rb
CHANGED
@@ -5,8 +5,8 @@ require 'fanforce/cli/utils'
|
|
5
5
|
class Fanforce::CLI
|
6
6
|
include Fanforce::CLI::Utils
|
7
7
|
|
8
|
-
DIR
|
9
|
-
TYPE
|
8
|
+
DIR ||= Shell.new.pwd
|
9
|
+
TYPE ||= Fanforce::CLI::Utils.find_cli_type(DIR)
|
10
10
|
|
11
11
|
@@commands = {}
|
12
12
|
@@docs = []
|
@@ -49,8 +49,6 @@ class Fanforce::CLI
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def load_cli_commands
|
52
|
-
require_relative 'scripts/version'
|
53
|
-
|
54
52
|
if TYPE == :directory_of_apps
|
55
53
|
begin
|
56
54
|
require 'fanforce/app_factory/cli_directory_of_apps'
|
@@ -67,11 +65,12 @@ class Fanforce::CLI
|
|
67
65
|
end
|
68
66
|
end
|
69
67
|
|
68
|
+
require_relative 'scripts/version'
|
70
69
|
@@has_finished_loading_internal_commands = true
|
71
70
|
|
72
71
|
dir_to_check = Dir.pwd
|
73
72
|
while dir_to_check do
|
74
|
-
cli_scripts_dir = "#{dir_to_check}/.cli
|
73
|
+
cli_scripts_dir = "#{dir_to_check}/.cli"
|
75
74
|
Dir["#{cli_scripts_dir}/*.rb"].each {|f| require f } if File.directory?(cli_scripts_dir)
|
76
75
|
break if dir_to_check == '/'
|
77
76
|
dir_to_check = get_parent_dir(dir_to_check)
|
@@ -127,7 +126,7 @@ class Fanforce::CLI
|
|
127
126
|
|
128
127
|
running_as = TYPE.to_s.gsub('_', ' ')
|
129
128
|
formatted_docs = divider '-+'
|
130
|
-
formatted_docs += sprintf("%-#{
|
129
|
+
formatted_docs += sprintf("%-#{147-running_as.length}s (%#{running_as.length}s)", 'USAGE: fanforce <command>', running_as)
|
131
130
|
|
132
131
|
formatted_docs += "\n\n\nFACTORY COMMANDS..."
|
133
132
|
|
data/lib/fanforce/cli/app.rb
CHANGED
@@ -13,12 +13,13 @@ class Fanforce::CLI::App
|
|
13
13
|
|
14
14
|
def initialize(dir)
|
15
15
|
raise "This is an invalid directory name for a fanforce addon: #{dir}" if dir !~ /^(.*)\/([a-z0-9-]+)\/?$/
|
16
|
-
@_id
|
17
|
-
@dir
|
18
|
-
@dir_root
|
19
|
-
@dir_name
|
20
|
-
@
|
21
|
-
@
|
16
|
+
@_id = $2
|
17
|
+
@dir = "#{$1}/#{$2}"
|
18
|
+
@dir_root = $1
|
19
|
+
@dir_name = $2
|
20
|
+
@dir_relative = @dir.gsub(Fanforce::CLI::DIR, '')
|
21
|
+
@root_domain = Fanforce.apps_base_domain
|
22
|
+
@name = @_id.gsub('-', ' ').titleize
|
22
23
|
end
|
23
24
|
|
24
25
|
def config
|
data/lib/fanforce/cli/apps.rb
CHANGED
@@ -16,16 +16,16 @@ class Fanforce::CLI::Apps
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.each(&block)
|
19
|
-
|
20
|
-
|
19
|
+
processed_count = 0
|
20
|
+
total_count = dir_names.size
|
21
21
|
dir_names.each do |d|
|
22
|
-
|
22
|
+
processed_count += 1
|
23
23
|
app = Fanforce::CLI::App.load("#{Fanforce::CLI::DIR}/#{d}")
|
24
|
-
Dir.chdir(app.dir) { block.call(app,
|
24
|
+
Dir.chdir(app.dir) { block.call(app, processed_count, total_count) }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.
|
28
|
+
def self.total_count
|
29
29
|
dir_names.size
|
30
30
|
end
|
31
31
|
|
data/lib/fanforce/cli/utils.rb
CHANGED
@@ -24,7 +24,9 @@ module Fanforce::CLI::Utils
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def fmt_start(*args)
|
27
|
-
effect = args.include?(:bold)
|
27
|
+
effect = if args.include?(:bold) then 1
|
28
|
+
elsif args.include?(:underline) then 4
|
29
|
+
else 0 end
|
28
30
|
color = if args.include?(:red) then 31
|
29
31
|
elsif args.include?(:green) then 32
|
30
32
|
elsif args.include?(:magenta) then 35
|
@@ -49,6 +51,15 @@ module Fanforce::CLI::Utils
|
|
49
51
|
(required && response.blank?) ? prompt(msg, required) : response
|
50
52
|
end
|
51
53
|
|
54
|
+
def require_gem(gem, file_to_require, retries=0)
|
55
|
+
require file_to_require
|
56
|
+
rescue LoadError => e
|
57
|
+
raise if retries > 0
|
58
|
+
puts `gem install #{gem}`
|
59
|
+
Gem.clear_paths
|
60
|
+
require_gem(gem, file_to_require, retries+1)
|
61
|
+
end
|
62
|
+
|
52
63
|
def find_cli_type(home_dir)
|
53
64
|
dir_names = home_dir.split('/')
|
54
65
|
types = {
|
data/lib/fanforce/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|