Class: LessPainful::CLI
- Inherits:
-
Thor
- Object
- Thor
- LessPainful::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/lesspainful/cli.rb
Constant Summary collapse
- FILE_UPLOAD_ENDPOINT =
"upload2"
- FORM_URL_ENCODED_ENDPOINT =
"upload"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app ⇒ Object
Returns the value of attribute app.
-
#config ⇒ Object
Returns the value of attribute config.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#endpoint_path ⇒ Object
Returns the value of attribute endpoint_path.
-
#features_zip ⇒ Object
Returns the value of attribute features_zip.
-
#host ⇒ Object
Returns the value of attribute host.
-
#pretty ⇒ Object
Returns the value of attribute pretty.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#reset_between_scenarios ⇒ Object
Returns the value of attribute reset_between_scenarios.
-
#skip_check ⇒ Object
Returns the value of attribute skip_check.
-
#workspace ⇒ Object
Returns the value of attribute workspace.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def api_key @api_key end |
#app ⇒ Object
Returns the value of attribute app.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def app @app end |
#config ⇒ Object
Returns the value of attribute config.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def config @config end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def dry_run @dry_run end |
#endpoint_path ⇒ Object
Returns the value of attribute endpoint_path.
18 19 20 |
# File 'lib/lesspainful/cli.rb', line 18 def endpoint_path @endpoint_path end |
#features_zip ⇒ Object
Returns the value of attribute features_zip.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def features_zip @features_zip end |
#host ⇒ Object
Returns the value of attribute host.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def host @host end |
#pretty ⇒ Object
Returns the value of attribute pretty.
17 18 19 |
# File 'lib/lesspainful/cli.rb', line 17 def pretty @pretty end |
#profile ⇒ Object
Returns the value of attribute profile.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def profile @profile end |
#reset_between_scenarios ⇒ Object
Returns the value of attribute reset_between_scenarios.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def reset_between_scenarios @reset_between_scenarios end |
#skip_check ⇒ Object
Returns the value of attribute skip_check.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def skip_check @skip_check end |
#workspace ⇒ Object
Returns the value of attribute workspace.
16 17 18 |
# File 'lib/lesspainful/cli.rb', line 16 def workspace @workspace end |
Class Method Details
.source_root ⇒ Object
24 25 26 |
# File 'lib/lesspainful/cli.rb', line 24 def self.source_root File.join(File.dirname(__FILE__), '..') end |
Instance Method Details
#submit(app, api_key, *args) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/lesspainful/cli.rb', line 81 def submit(app, api_key, *args) self.host = [:host] self.pretty = [:pretty] || false unless self.host #if invoked though old-style self.host = ENV["LP_HOST"] || 'https://www.lesspainful.com' else end app_path = File.(app) unless File.exist?(app_path) raise "App is not a file: #{app_path}" end self.app = app_path self.dry_run = ["dry-run"] self.api_key = api_key self.skip_check = ENV['CHECK_IPA'] == '0' self.skip_check = ["skip-check"] unless ["skip-check"].nil? self.reset_between_scenarios = ["reset-between-scenarios"] parse_and_set_config_and_profile workspace_path = [:workspace] || File.(".") if args[0] workspace_path = args[0] end unless File.directory?(workspace_path) raise "Provided workspace: #{workspace_path} is not a directory." end self.workspace = File.join(File.(workspace_path), File::Separator) features_path = [:features] features_path = args[1] if args[1] unless features_path.nil? if File.exist?(features_path) self.features_zip = File.(features_path) else raise "Provided features file does not exist #{features_path}" end end if ENV['DEBUG'] puts "Host = #{self.host}" puts "App = #{self.app}" puts "API Key = #{self.api_key}" puts "Workspace = #{self.workspace}" puts "Features Zip = #{self.features_zip}" puts "Config = #{self.config}" puts "Profile = #{self.profile}" puts "Skip Check = #{self.skip_check}" puts "Reset Between Scenarios = #{self.reset_between_scenarios}" end #Argument parsing done json = submit_test_job unless dry_run if pretty and JSON.respond_to?(:pretty_generate) puts JSON.pretty_generate(json) else puts json.to_json end end end |
#version ⇒ Object
29 30 31 |
# File 'lib/lesspainful/cli.rb', line 29 def version puts LessPainful::VERSION end |