digipolitan-framework-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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f11caf2d8917aab9ce7be9d990c1bc140790376b
4
+ data.tar.gz: f653a24ce2bbce142c96de0cdf2487ee78ddabd4
5
+ SHA512:
6
+ metadata.gz: f304857dcf87dab4d6d6b60dcbd78a5d281acf827442d1c1f9db056948b3acef2deb3fb52bd5fc6daee10d13400fde87c53f376e3fbd17f31c4d74ccbc9e3af9
7
+ data.tar.gz: 76f5f339b7dacbe8c5492f0ac437405bef557cd106d75d59f1c1488dca76d4fd5038f050110761cec2d9771c70220bd7828bce2ca40dfedd256f24de3440995a
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ `digipolitan-framework-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.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # framework-swift-template-cli
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/digipolitan-framework-swift-template-cli.svg)](http://badge.fury.io/rb/digipolitan-framework-swift-template-cli)
4
+
5
+ Digipolitan tools to use swift framework template
6
+
7
+ ## dg-fst
8
+
9
+ ### Common actions
10
+
11
+ This executable run the tools to integrate swift framework template in an empty directory
12
+
13
+ ````Sh
14
+ dg-fst --init
15
+ ````
16
+
17
+ Install framework swift template in the current directory
18
+
19
+ ````Sh
20
+ dg-fst --help
21
+ ````
22
+
23
+ Display the helper
24
+
25
+ ### Custom actions
26
+
27
+ ````Sh
28
+ dg-fst --init -o my_project_dir/child_path
29
+ ````
30
+
31
+ Install framework swift template in ** my_project_dir/child_path** directory
data/bin/dg-fst ADDED
@@ -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-framework-swift-template-cli'
9
+
10
+ args = Digipolitan::Argv.parse()
11
+ if args.key?("--help")
12
+ Digipolitan::FrameworkSwiftTemplate.help()
13
+ elsif args.key?("--init")
14
+ Digipolitan::FrameworkSwiftTemplate.init(args["-o"])
15
+ end
@@ -0,0 +1,14 @@
1
+ require 'digipolitan-apps-tools'
2
+
3
+ module Digipolitan
4
+
5
+ class FrameworkSwiftTemplate
6
+
7
+ def self.help()
8
+ Digipolitan::UI.message "Digipolitan Framework 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 FrameworkSwiftTemplate
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 FRAMEWORK 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 framework...";
30
+ buffer = open('https://github.com/Digipolitan/framework-swift-template/archive/master.zip').read
31
+ Digipolitan::FileUtils.write_to_file(zip_path, buffer)
32
+ Digipolitan::UI.message "Unziping Digipolitan framework...";
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 framework 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
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'digipolitan-framework-swift-template-cli/init'
4
+ require 'digipolitan-framework-swift-template-cli/help'
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: digipolitan-framework-swift-template-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bbriatte
8
+ - vbalasubramaniam
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-02-21 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.0
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.0
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 framework template
43
+
44
+ '
45
+ email: contact@digipolitan.com
46
+ executables:
47
+ - dg-fst
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - CHANGELOG.md
52
+ - LICENSE
53
+ - README.md
54
+ - bin/dg-fst
55
+ - lib/digipolitan-framework-swift-template-cli.rb
56
+ - lib/digipolitan-framework-swift-template-cli/help.rb
57
+ - lib/digipolitan-framework-swift-template-cli/init.rb
58
+ homepage: https://github.com/Digipolitan/framework-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.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Digipolitan Ruby tools to use swift framework template
82
+ test_files: []