Module: ProjectGen::Utils
- Defined in:
- lib/cocoapods-project-gen/gen/utils.rb
Class Method Summary collapse
- .absolute?(path) ⇒ Bool
- .remove_target_scope_suffix(label, scope_suffix) ⇒ Object
- .zip(product_path, zip_path) ⇒ Object
Class Method Details
.absolute?(path) ⇒ Bool
7 8 9 |
# File 'lib/cocoapods-project-gen/gen/utils.rb', line 7 def self.absolute?(path) Pathname(path).absolute? || path.to_s.start_with?('~') end |
.remove_target_scope_suffix(label, scope_suffix) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cocoapods-project-gen/gen/utils.rb', line 11 def self.remove_target_scope_suffix(label, scope_suffix) if scope_suffix.nil? || scope_suffix[0] == '.' label.delete_suffix(scope_suffix || '') else label.delete_suffix("-#{scope_suffix}") end end |
.zip(product_path, zip_path) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cocoapods-project-gen/gen/utils.rb', line 19 def self.zip(product_path, zip_path) product_name = Pathname.new(product_path).basename zip_product_name = Pathname.new(zip_path).basename FileUtils.rm_rf(zip_path) FileUtils.mkdir_p(zip_path.dirname) Dir.chdir(product_path) do out_put = `pushd #{product_name};zip -qry #{zip_path} *;popd` if out_put.downcase.include?('error') $stdout.puts(out_put.red) else $stdout.puts("#{zip_product_name}:".green) $stdout.puts(" path: #{zip_path}".green) end end end |