ptinstall 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3813809c0a06c80a6a17698bb199d5fd319f9715
4
+ data.tar.gz: 656783bb9cda6acc90f2c5ba3be5abed4bcbeb7c
5
+ SHA512:
6
+ metadata.gz: bd91e6168724fa29c121436e7186a12c4a55dc70baa993228d0ce427c045b1bed4fbf6dbc22897499188363e01d83928722f351093208d49b4cad231bfc29f25
7
+ data.tar.gz: 4d9e18b0bc3cb58c6b213e8b60c7e28ad7acf227f90443d5f1c30eff68487011164c75381bb41305efb8d6fa1685c7718b385e5b1a98b4a98515ef488e22eae1
data/bin/ptinstall ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "project_temple_installer"
3
+ ProjectInstaller.new().install
@@ -0,0 +1,49 @@
1
+ require 'pathname'
2
+ require 'xcodeproj'
3
+ class ProjectInstaller
4
+
5
+ def initialize(*args)
6
+ @current_dir = Pathname.pwd
7
+ Dir.foreach(@current_dir) do |filename|
8
+ if filename.include? 'xcodeproj'
9
+ project_path = "#{@current_dir}/#{filename}"
10
+ @project_name = File.basename(filename)
11
+ @project = Xcodeproj::Project.open project_path
12
+ break
13
+ end
14
+ end
15
+ end
16
+
17
+ def install
18
+ downloadFile
19
+ source_group = @project.main_group.children[0]
20
+ add_all_to_group "#{@current_dir}/Source", source_group
21
+ @project.save
22
+ end
23
+
24
+ def downloadFile
25
+ download_command = "svn export https://github.com/kaich/ProjectTemple/trunk/ProjectTemple/Source"
26
+ download_podfile = "svn export https://github.com/kaich/ProjectTemple/trunk/podfile"
27
+ system download_command
28
+ system download_podfile
29
+ end
30
+
31
+ def add_all_to_group(path ,target_group)
32
+ new_group = target_group.new_group(File.basename(path), path) if Dir.exist? path
33
+ Dir.foreach(path) do |filename|
34
+ next if filename == "." # 忽略当前目录
35
+ next if filename == ".." # 忽略上级目录
36
+ next if filename.start_with? "." # 忽略隐藏文件
37
+
38
+ file_path = "#{path}/#{filename}"
39
+
40
+ if File.directory? file_path
41
+ add_all_to_group file_path ,new_group
42
+ else
43
+ new_group.new_reference file_path
44
+ puts "add #{file_path}\n"
45
+ end
46
+ end
47
+ end
48
+
49
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ptinstall
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - chengkai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: fetch apple app
14
+ email: chengkai@1853.com
15
+ executables:
16
+ - ptinstall
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/ptinstall
21
+ - lib/project_temple_installer.rb
22
+ homepage: http://rubygems.org/gems/ptinstall
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.8
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: fetch app
45
+ test_files: []