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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d77a2b3fde1139385186a6bf61a894d4e0bcc75
4
- data.tar.gz: 087070dc87ad1127e0743cab3f3a7b1043fd79e6
3
+ metadata.gz: f2b5e16173ec5a9c2a46776665016354baf4a3de
4
+ data.tar.gz: 042f04e77a941eb5d86e77d6d69dabed57031e36
5
5
  SHA512:
6
- metadata.gz: 6cc548a9940a6925b881c5f83ee5aaa9792ba8bb99838e36a6e3b5d5ec750fab85bac3306ca1768e804bff588bcd1db6d3430ebb127c2bf76c191e1b600c3327
7
- data.tar.gz: 398dfd0ab93eb0225cf9154db80bf82597b49f3eb91d8560dcb925f790be6b50f6daa2275f97156045c4c921febc4e05d23b862259fee34777935d9bb174c009
6
+ metadata.gz: 98104974808e0504c1688bd9ed0c459e51b1568abcf678e701d176519f5736ff8ab15df2d999594ade4aa07001254259ed8e0a750d1d00d195313bc49db7510c
7
+ data.tar.gz: 206a58500e0b0f759a8efa38e3c72d0681c0aba2cdbc080a55cc1e9323246ef0d9fba0e113dd828960247db9d2104e95ea722dea22b27707745a518f140ece21
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fanforce-cli (2.0.0.rc1)
4
+ fanforce-cli (2.0.0.rc2)
5
5
  activesupport
6
6
  fanforce-base (~> 1.2)
7
7
 
@@ -5,8 +5,8 @@ require 'fanforce/cli/utils'
5
5
  class Fanforce::CLI
6
6
  include Fanforce::CLI::Utils
7
7
 
8
- DIR = Shell.new.pwd
9
- TYPE = Fanforce::CLI::Utils.find_cli_type(DIR)
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-scripts"
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("%-#{122-running_as.length}s (%#{running_as.length}s)", 'USAGE: fanforce <command>', running_as)
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
 
@@ -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 = $2
17
- @dir = "#{$1}/#{$2}"
18
- @dir_root = $1
19
- @dir_name = $2
20
- @root_domain = Fanforce.apps_base_domain
21
- @name = @_id.gsub('-', ' ').titleize
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
@@ -16,16 +16,16 @@ class Fanforce::CLI::Apps
16
16
  end
17
17
 
18
18
  def self.each(&block)
19
- cur_count = 0
20
- total = dir_names.size
19
+ processed_count = 0
20
+ total_count = dir_names.size
21
21
  dir_names.each do |d|
22
- cur_count += 1
22
+ processed_count += 1
23
23
  app = Fanforce::CLI::App.load("#{Fanforce::CLI::DIR}/#{d}")
24
- Dir.chdir(app.dir) { block.call(app, cur_count, total) }
24
+ Dir.chdir(app.dir) { block.call(app, processed_count, total_count) }
25
25
  end
26
26
  end
27
27
 
28
- def self.count
28
+ def self.total_count
29
29
  dir_names.size
30
30
  end
31
31
 
@@ -24,7 +24,9 @@ module Fanforce::CLI::Utils
24
24
  end
25
25
 
26
26
  def fmt_start(*args)
27
- effect = args.include?(:bold) ? 1 : 0
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 = {
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class CLI
3
- VERSION = '2.0.0.rc1'
3
+ VERSION = '2.0.0.rc3'
4
4
  end
5
5
  end
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.rc1
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-15 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport