Class: XCFit::Main

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/XCFit/main.rb

Instance Method Summary collapse

Instance Method Details

#create_xcgherkinObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/XCFit/main.rb', line 52

def create_xcgherkin
  if File.exist?($root_gherkin_dir)
   puts "==================XXXXXXXX===========================" 
   puts 'There is already Gherkin directory in Xcode Templates. Have you tried XCFit Before? '
   puts 'Please remove/move existing ~/Library/Developer/Xcode/Templates/Gherkin directory to carry on'
   puts "==================XXXXXXXX===========================" 
   exit 1
   end
   puts "==================XXXXXXXX===========================" 
   puts 'Creating XCode Template for Gherkin'
   puts 'This Template will allow you create new Gherkin Feature file '
   puts "==================XXXXXXXX===========================" 
   FileUtils.cp_r($source_gherkin_dir, $root_template_dir)
   puts 'Now Your Xcode will have ability to creat new Gherkin Feature File'
   puts "==================XXXXXXXX===========================" 
   puts 'File -> New -->File-->Gherkin'
   puts 'You wont need to restart Xcode but do so if nesessary!'
   puts " ***************** Enjoy XCFit *****************"
end

#create_xctargetsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/XCFit/main.rb', line 31

def create_xctargets
  if File.exist?($root_xcfit_dir)
  puts "==================XXXXXXXX===========================" 
   puts 'There is already XCFit directory in Xcode Templates. Have you tried XCFit Before? '
   puts 'Please remove/move existing ~/Library/Developer/Xcode/Templates/XCFit directory to carry on'
   puts "==================XXXXXXXX===========================" 
  exit 1
 end
   puts "==================XXXXXXXX===========================" 
   puts 'Creating XCode Template for XCFit'
   puts 'This Template will allow you create Cucumberish and Fitnesse targets'
   puts "==================XXXXXXXX===========================" 
   FileUtils.cp_r($source_xcfit_dir, $root_template_dir)
   puts 'Now Your Xcode will have XCFIT iOS and macOS tagets for Cucumberish and Fitnesse'
   puts "==================XXXXXXXX===========================" 
   puts 'File -> New -->Target-->XCFit'
   puts 'You wont need to restart Xcode but do so if nesessary!'
   puts " ***************** Enjoy XCFit *****************"
end

#get_cucumberish(version = "0.0.7") ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/XCFit/main.rb', line 79

def get_cucumberish(version="0.0.7")
   puts "==================XXXXXXXX===========================" 
   puts 'Downloading Cucumberish in the current working directory'
   puts 'You Should execute this command from Cucumberish Xcode target directory'
   puts "==================XXXXXXXX===========================" 
   system("curl -sL https://github.com/Ahmed-Ali/Cucumberish/archive/v#{version}.tar.gz | tar xz")
   cucumberish_dir = "Cucumberish-#{version}" + "/Cucumberish/"
   system("mv #{cucumberish_dir}  .")
   system("rm -rf Cucumberish-#{version}")
   puts "==================XXXXXXXX===========================" 
   puts "=======Now creating Feature Directory with Demo Feature ===="
   puts "==================XXXXXXXX===========================" 
   system("mkdir -p Features")
   demo_feature_file = $source_template_dir + "/demo.feature"
   system("cp #{demo_feature_file} Features/")
   puts $source_cucumberish_template_dir
   puts "==================XXXXXXXX===========================" 
   puts "=======Created Feature Directory with Demo Feature ===="
   puts "==================XXXXXXXX===========================" 
end

#get_fitnesseObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/XCFit/main.rb', line 101

def get_fitnesse 
    puts "==================XXXXXXXX===========================" 
    puts 'Downloading Fitnesse JAR file in the current working directory'
    puts 'You Should execute this command from Fitnesse Acceptance Test  Xcode target directory'
    puts "==================XXXXXXXX===========================" 
    system('curl -H "Accept: application/zip" http://fitnesse.org/fitnesse-standalone.jar\?responder\=releaseDownload\&release\=20160618 -o fitnesse-standalone.jar')
    if File.exist?("fitnesse-standalone.jar")
    puts "==================XXXXXXXX===========================" 
    puts "=======SUccessfuly Downloaded Fitnesse JAR===="
    puts "==================XXXXXXXX===========================" 
    else 
    puts "=======Error downloading Fitnesse JAR===="   
    end   
end

#setall_templatesObject



73
74
75
76
# File 'lib/XCFit/main.rb', line 73

def setall_templates
  create_xctargets
  create_xcgherkin
end

#versionObject



26
27
28
# File 'lib/XCFit/main.rb', line 26

def version
  say XCFit::VERSION
end