digipolitan-app-swift-template-cli 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6b6d769398b175fdecd63c65c6bdfac24c88ef0a
4
+ data.tar.gz: 46a3f59d219c2142088e24c8b9ed86d57fc2d064
5
+ SHA512:
6
+ metadata.gz: d47bc461416a799f880a532943e4123a1c46ba061cf1c9993928e4cf995bc0319640f6022b21471cb8563f2a07d667f0d31fde6445627b377806b5253f123771
7
+ data.tar.gz: 64b5262a4c1fe64657618b1d4c9a7977d8e7bddbeead97d1e8409bf25ca64288f778949b41014f692dcaf9fdb3e83d40236be3afb063742d13d034c9dae90124
@@ -0,0 +1,4 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ `digipolitan-app-swift-template-cli` adheres to [Semantic Versioning](http://semver.org/).
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2017, Digipolitan
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,31 @@
1
+ # app-swift-template-cli
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/digipolitan-app-swift-template-cli.svg)](http://badge.fury.io/rb/digipolitan-app-swift-template-cli)
4
+
5
+ Digipolitan tools to use swift app template
6
+
7
+ ## dg-ast
8
+
9
+ ### Common actions
10
+
11
+ This executable run the tools to integrate swift app template in an empty directory
12
+
13
+ ````Sh
14
+ dg-ast --init
15
+ ````
16
+
17
+ Install app swift template in the current directory
18
+
19
+ ````Sh
20
+ dg-ast --help
21
+ ````
22
+
23
+ Display the helper
24
+
25
+ ### Custom actions
26
+
27
+ ````Sh
28
+ dg-ast --init -o my_project_dir/child_path
29
+ ````
30
+
31
+ Install app swift template in ** my_project_dir/child_path** directory
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if $PROGRAM_NAME == __FILE__
4
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
5
+ require 'bundler/setup'
6
+ end
7
+
8
+ require 'digipolitan-app-swift-template-cli'
9
+
10
+ args = Digipolitan::Argv.parse()
11
+ if args.key?("--help")
12
+ Digipolitan::AppSwiftTemplate.help()
13
+ elsif args.key?("--init")
14
+ Digipolitan::AppSwiftTemplate.init(args["-o"])
15
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'digipolitan-app-swift-template-cli/init'
4
+ require 'digipolitan-app-swift-template-cli/help'
@@ -0,0 +1,14 @@
1
+ require 'digipolitan-apps-tools'
2
+
3
+ module Digipolitan
4
+
5
+ class AppSwiftTemplate
6
+
7
+ def self.help()
8
+ Digipolitan::UI.message "Digipolitan App Swift Template CLI"
9
+ Digipolitan::UI.message "Available options :"
10
+ Digipolitan::UI.message "--init : Download and install the template"
11
+ Digipolitan::UI.message "--help : Print this help"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,74 @@
1
+ require 'open-uri'
2
+ require 'digipolitan-apps-tools'
3
+ require 'zip'
4
+
5
+ module Digipolitan
6
+
7
+ class AppSwiftTemplate
8
+
9
+ def self.init(target_path = nil)
10
+
11
+ zip_path = ".template.zip"
12
+ unzip_destination_path = ".template"
13
+
14
+ Digipolitan::UI.success "*** DIGIPOLITAN TEMPLATE APP WIZARD ***";
15
+
16
+ absolute_target_path = Dir.pwd
17
+ if target_path != nil && target_path != "."
18
+ absolute_target_path = File.join(absolute_target_path, target_path)
19
+ end
20
+ if Digipolitan::UI.confirm "Are you sure to install the Digipolitan template in the directory '#{absolute_target_path}'"
21
+ Digipolitan::UI.message "Preparing...";
22
+ Digipolitan::FileUtils.mkdir_p(absolute_target_path)
23
+ pattern = File.join(absolute_target_path, "*.xcodeproj")
24
+ projects = Dir[pattern]
25
+ if projects.length > 0
26
+ Digipolitan::UI.crash "The target directory contains an xcodeproj, please select another one or clear the directory."
27
+ end
28
+
29
+ Digipolitan::UI.message "Downloading Digipolitan app...";
30
+ buffer = open('https://github.com/Digipolitan/app-swift-template/archive/master.zip').read
31
+ Digipolitan::FileUtils.write_to_file(zip_path, buffer)
32
+ Digipolitan::UI.message "Unziping Digipolitan app...";
33
+
34
+ template_path = nil
35
+ Digipolitan::FileUtils.remove_dir(unzip_destination_path)
36
+ Zip::InputStream.open(zip_path) { |zip_file|
37
+ while (entry = zip_file.get_next_entry)
38
+ f_path = File.join(unzip_destination_path, entry.name)
39
+ if template_path == nil
40
+ template_path = f_path
41
+ end
42
+ if entry.name_is_directory?
43
+ Digipolitan::FileUtils.mkdir_p(f_path)
44
+ else
45
+ Digipolitan::FileUtils.mkdir_p(File.dirname(f_path))
46
+ entry.extract(f_path)
47
+ end
48
+ end
49
+ }
50
+ Digipolitan::UI.message "Moving..."
51
+
52
+ entries = Dir.entries(template_path)
53
+ entries.each do |entry|
54
+ if entry != "." && entry != ".."
55
+ File.rename(File.join(template_path, entry), File.join(absolute_target_path, entry))
56
+ end
57
+ end
58
+
59
+ Digipolitan::FileUtils.remove_dir(zip_path)
60
+ Digipolitan::FileUtils.remove_dir(unzip_destination_path)
61
+
62
+ Digipolitan::UI.success "Successfully download Digipolitan app template"
63
+
64
+ if Digipolitan::UI.confirm "Would you like to install the template ?"
65
+ gemfile = File.join(absolute_target_path, "Gemfile")
66
+ Dir.chdir(absolute_target_path) {
67
+ system("bundle install --gemfile '#{gemfile}'")
68
+ system("BUNDLE_GEMFILE='#{gemfile}' bundle exec ruby install.rb")
69
+ }
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: digipolitan-app-swift-template-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bbriatte
8
+ - LinharesDavid
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-10-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: digipolitan-apps-tools
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.2'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.2'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubyzip
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.2'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.2'
42
+ description: 'This module help you to install / use swift app template
43
+
44
+ '
45
+ email: contact@digipolitan.com
46
+ executables:
47
+ - dg-ast
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - CHANGELOG.md
52
+ - LICENSE
53
+ - README.md
54
+ - bin/dg-ast
55
+ - lib/digipolitan-app-swift-template-cli.rb
56
+ - lib/digipolitan-app-swift-template-cli/help.rb
57
+ - lib/digipolitan-app-swift-template-cli/init.rb
58
+ homepage: https://github.com/Digipolitan/app-swift-template-cli
59
+ licenses:
60
+ - BSD-3-Clause
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.9.3
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.5.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Digipolitan Ruby tools to use swift app template
82
+ test_files: []