branch_io_cli 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b12805e82fb366c82741249dfbe0b186dd453cd6
4
- data.tar.gz: beed4c107749da36ab0c36d31dfb77d544a083e8
3
+ metadata.gz: 6d6d029c93a40885ef2c8f619c45d550cd49a680
4
+ data.tar.gz: 3553f1e6241a02f8329f30d4ac9ab65057a78ac0
5
5
  SHA512:
6
- metadata.gz: 88ce57d3ee76c932ec1df8fea6befa753a864753f9d741d4b779b5d545e840b89af98a921e238f345a00878375678f707576185d9f22c14bdbd356c250e3057f
7
- data.tar.gz: b5a0b49080a5213523461e43ee3595bfa7a874d7de528ce4eca98e6b15efa0d240d062ad475f33e35229efb9cdad5dadcf5e5fae32d7fa24bb808bd38ca9ef55
6
+ metadata.gz: 738daf6516afbdde4902e7be83865a856031b28b565d07d1c244b5c53cc817795d3a20ecf48c2ebf9f52f306903405fbdc4784039d6b25625d4109858c3a1c3f
7
+ data.tar.gz: e861e2ceb053c93cf2ab57605856386e07767f8c36b683cb4387b3fd118cc882026a24a41d436e3840bbd13e20155df025612128771f56d2e85e97638bd75f2f
@@ -1,4 +1,5 @@
1
1
  require "branch_io_cli/cli"
2
2
  require "branch_io_cli/commands"
3
+ require "branch_io_cli/core_ext"
3
4
  require "branch_io_cli/helper"
4
5
  require "branch_io_cli/version"
@@ -17,28 +17,25 @@ module BranchIOCLI
17
17
  end
18
18
 
19
19
  File.open config_helper.report_path, "w" do |report|
20
- report.write "Branch.io Xcode build report v #{VERSION}\n\n"
20
+ report.write "Branch.io Xcode build report v #{VERSION} #{DateTime.now}\n\n"
21
21
  # TODO: Write out command-line options or configuration from helper
22
22
  report.write "#{report_header}\n"
23
23
 
24
- show_build_settings_cmd = "#{base_xcodebuild_cmd} -showBuildSettings"
25
- report.write "$ #{show_build_settings_cmd}\n\n"
26
- report.write `#{show_build_settings_cmd}`
24
+ report.report_command "#{base_xcodebuild_cmd} -list"
25
+ report.report_command "#{base_xcodebuild_cmd} -showBuildSettings"
27
26
 
28
27
  if config_helper.clean
29
28
  say "Cleaning"
30
- clean_cmd = "#{base_xcodebuild_cmd} clean"
31
- report.write "$ #{clean_cmd}\n\n"
32
- report.write `#{clean_cmd}`
29
+ report.report_command "#{base_xcodebuild_cmd} clean"
33
30
  end
34
31
 
35
32
  say "Building"
36
- build_cmd = "#{base_xcodebuild_cmd} -verbose"
37
- report.write "$ #{build_cmd}\n\n"
38
- report.write `#{build_cmd}`
33
+ report.report_command "#{base_xcodebuild_cmd} -verbose"
39
34
 
40
35
  say "Done ✅"
41
36
  end
37
+ @report = nil
38
+
42
39
  say "Report generated in #{config_helper.report_path}"
43
40
  end
44
41
 
@@ -0,0 +1 @@
1
+ require "branch_io_cli/core_ext/io.rb"
@@ -0,0 +1,48 @@
1
+ require "open3"
2
+
3
+ class IO
4
+ # Report the command. Execute the command, capture stdout
5
+ # and stderr and report line by line. Report the exit
6
+ # status at the end in case of error. Returns a Process::Status
7
+ # object.
8
+ #
9
+ # :command: [String] a shell command to execute and report
10
+ def report_command(command)
11
+ write "$ #{command}\n\n"
12
+
13
+ Open3.popen2e(command) do |stdin, output, thread|
14
+ # output is stdout and stderr merged
15
+ while (line = output.gets)
16
+ puts line
17
+ end
18
+
19
+ status = thread.value
20
+ if status == 0
21
+ write "Success.\n\n"
22
+ else
23
+ write "#{status}\n\n"
24
+ end
25
+ return status
26
+ end
27
+ end
28
+ end
29
+
30
+ # Report the command. Execute the command. Stdout and stderr are
31
+ # not redirected. Report the exit status at the end if nonzero.
32
+ # Returns a Process::Status object.
33
+ #
34
+ # :command: [String] a shell command to execute and report
35
+ def STDOUT.report_command(command)
36
+ # TODO: Improve this?
37
+ say "<%= color('$ #{command}', BOLD) %>\n\n"
38
+ # May also write to stderr
39
+ # Could try system "#{command} 2>&1", but that might depend on the shell.
40
+ system command
41
+
42
+ status = $?
43
+ if status == 0
44
+ write "Success.\n\n"
45
+ else
46
+ write "#{status}\n\n"
47
+ end
48
+ end
@@ -1,2 +1,3 @@
1
1
  require "branch_io_cli/helper/branch_helper"
2
2
  require "branch_io_cli/helper/configuration_helper"
3
+ require "branch_io_cli/helper/methods"
@@ -6,9 +6,13 @@ require "plist"
6
6
  require "tmpdir"
7
7
  require "zip"
8
8
 
9
+ require "branch_io_cli/helper/methods"
10
+
9
11
  module BranchIOCLI
10
12
  module Helper
11
13
  module IOSHelper
14
+ include Methods
15
+
12
16
  APPLINKS = "applinks"
13
17
  ASSOCIATED_DOMAINS = "com.apple.developer.associated-domains"
14
18
  CODE_SIGN_ENTITLEMENTS = "CODE_SIGN_ENTITLEMENTS"
@@ -789,7 +793,7 @@ EOF
789
793
  install_command = "pod install"
790
794
  install_command += " --repo-update" if options.pod_repo_update
791
795
  Dir.chdir(File.dirname(podfile_path)) do
792
- system_command "pod init"
796
+ report_command "pod init"
793
797
  apply_patch(
794
798
  files: podfile_path,
795
799
  regexp: /^(\s*)# Pods for #{ConfigurationHelper.target.name}$/,
@@ -797,7 +801,7 @@ EOF
797
801
  text: "\n\\1pod \"Branch\"",
798
802
  global: false
799
803
  )
800
- system_command install_command
804
+ report_command install_command
801
805
  end
802
806
 
803
807
  add_change podfile_path
@@ -826,7 +830,7 @@ EOF
826
830
 
827
831
  # 2. carthage update
828
832
  Dir.chdir(File.dirname(cartfile_path)) do
829
- system_command "carthage #{ConfigurationHelper.carthage_command}"
833
+ report_command "carthage #{ConfigurationHelper.carthage_command}"
830
834
  end
831
835
 
832
836
  # 3. Add Cartfile and Cartfile.resolved to commit (in case :commit param specified)
@@ -939,7 +943,7 @@ EOF
939
943
  command += ' --repo-update' if options.pod_repo_update
940
944
 
941
945
  Dir.chdir(File.dirname(podfile_path)) do
942
- system_command command
946
+ report_command command
943
947
  end
944
948
 
945
949
  # 3. Add Podfile and Podfile.lock to commit (in case :commit param specified)
@@ -969,7 +973,7 @@ EOF
969
973
 
970
974
  # 2. carthage update
971
975
  Dir.chdir(File.dirname(cartfile_path)) do
972
- system_command "carthage #{ConfigurationHelper.carthage_command}"
976
+ report_command "carthage #{ConfigurationHelper.carthage_command}"
973
977
  end
974
978
 
975
979
  # 3. Add Cartfile and Cartfile.resolved to commit (in case :commit param specified)
@@ -1027,13 +1031,13 @@ EOF
1027
1031
 
1028
1032
  gem_home = ENV["GEM_HOME"]
1029
1033
  if gem_home && File.writable?(gem_home)
1030
- system_command "gem install cocoapods"
1034
+ report_command "gem install cocoapods"
1031
1035
  else
1032
- system_command "sudo gem install cocoapods"
1036
+ report_command "sudo gem install cocoapods"
1033
1037
  end
1034
1038
 
1035
1039
  # Ensure master podspec repo is set up (will update if it exists).
1036
- system_command "pod setup"
1040
+ report_command "pod setup"
1037
1041
  end
1038
1042
 
1039
1043
  def verify_carthage
@@ -1052,7 +1056,7 @@ EOF
1052
1056
  exit(-1)
1053
1057
  end
1054
1058
 
1055
- system_command "brew install carthage"
1059
+ report_command "brew install carthage"
1056
1060
  end
1057
1061
 
1058
1062
  def verify_git
@@ -1073,13 +1077,7 @@ EOF
1073
1077
  exit(-1)
1074
1078
  end
1075
1079
 
1076
- system_command "xcode-select --install"
1077
- end
1078
-
1079
- def system_command(command)
1080
- # TODO: Not working well with bundle exec atm.
1081
- say "<%= color(\"$ #{command}\", BOLD) %>"
1082
- system command
1080
+ report_command "xcode-select --install"
1083
1081
  end
1084
1082
  end
1085
1083
  end
@@ -0,0 +1,9 @@
1
+ module BranchIOCLI
2
+ module Helper
3
+ module Methods
4
+ def report_command(command)
5
+ STDOUT.report_command command
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module BranchIOCLI
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: branch_io_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Branch
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-01 00:00:00.000000000 Z
12
+ date: 2017-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: CFPropertyList
@@ -257,11 +257,14 @@ files:
257
257
  - lib/branch_io_cli/commands/report_command.rb
258
258
  - lib/branch_io_cli/commands/setup_command.rb
259
259
  - lib/branch_io_cli/commands/validate_command.rb
260
+ - lib/branch_io_cli/core_ext.rb
261
+ - lib/branch_io_cli/core_ext/io.rb
260
262
  - lib/branch_io_cli/helper.rb
261
263
  - lib/branch_io_cli/helper/android_helper.rb
262
264
  - lib/branch_io_cli/helper/branch_helper.rb
263
265
  - lib/branch_io_cli/helper/configuration_helper.rb
264
266
  - lib/branch_io_cli/helper/ios_helper.rb
267
+ - lib/branch_io_cli/helper/methods.rb
265
268
  - lib/branch_io_cli/version.rb
266
269
  homepage: http://github.com/BranchMetrics/branch_io_cli
267
270
  licenses: