swift_lib_templater 1.0.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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +20 -0
  6. data/README.md +11 -0
  7. data/Rakefile +2 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/exe/swift_lib_templater +4 -0
  11. data/lib/swift_lib_templater.rb +36 -0
  12. data/lib/swift_lib_templater/copy_template_command.rb +15 -0
  13. data/lib/swift_lib_templater/get_framework_name_command.rb +9 -0
  14. data/lib/swift_lib_templater/initialize_git_repository_command.rb +17 -0
  15. data/lib/swift_lib_templater/open_projet_command.rb +12 -0
  16. data/lib/swift_lib_templater/rename_files_command.rb +33 -0
  17. data/lib/swift_lib_templater/version.rb +3 -0
  18. data/lib/templates/framework/.gitignore +67 -0
  19. data/lib/templates/framework/.travis.yml +31 -0
  20. data/lib/templates/framework/CHANGELOG.md +0 -0
  21. data/lib/templates/framework/LICENSE +23 -0
  22. data/lib/templates/framework/README.md +29 -0
  23. data/lib/templates/framework/Source/Classes/EmptyFile.swift +7 -0
  24. data/lib/templates/framework/Source/Info.plist +22 -0
  25. data/lib/templates/framework/Source/TEMPLATE.h +19 -0
  26. data/lib/templates/framework/TEMPLATE.podspec +24 -0
  27. data/lib/templates/framework/TEMPLATE.xcodeproj/project.pbxproj +474 -0
  28. data/lib/templates/framework/TEMPLATE.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  29. data/lib/templates/framework/TEMPLATE.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  30. data/lib/templates/framework/TEMPLATE.xcworkspace/contents.xcworkspacedata +10 -0
  31. data/lib/templates/framework/TEMPLATE.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  32. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example.xcodeproj/project.pbxproj +370 -0
  33. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  34. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  35. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Classes/AppDelegate.swift +22 -0
  36. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Classes/ViewController.swift +20 -0
  37. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Configuration/Info.plist +45 -0
  38. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
  39. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Resources/Assets.xcassets/Contents.json +6 -0
  40. data/lib/templates/framework/TEMPLATE_Example/TEMPLATE_Example/Resources/Base.lproj/LaunchScreen.storyboard +29 -0
  41. data/lib/templates/framework/Tests/Info.plist +22 -0
  42. data/lib/templates/framework/Tests/TEMPLATETests.swift +33 -0
  43. data/swift_lib_templater.gemspec +39 -0
  44. metadata +118 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fbaaf7640783a33fd6bfb47fe2db3d28099767e1
4
+ data.tar.gz: d1d3c20ac3bfe910d7af9426efb91824f25ba17c
5
+ SHA512:
6
+ metadata.gz: 6d04307af2907451a316cac2ad789776411e677be9f8dfdf75524595cfc7892ae0b5eabe7e56e8badfc7cab3e1c8a7f0cc76c04db661da7f74d448123b64a8d2
7
+ data.tar.gz: 770d461cc8c1213f03e898e63723ddbc539447adf9fd6bf6b2baba02cd777e1270a40d6a22999abee7350e2f29114fc1c1ca624e7b9237e97f9bfff70b58418b
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 1.0.0 (22 March 2019)
2
+
3
+ First release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in swift_lib_templater.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ swift_lib_templater (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.5.0)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 2.0)
16
+ rake (~> 10.0)
17
+ swift_lib_templater!
18
+
19
+ BUNDLED WITH
20
+ 2.0.1
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # swift_lib_templater
2
+
3
+ `swift_lib_templater` generates templates for open source ios libraries. It integrates `cocopoads` & `Carthage`.
4
+
5
+ ## Installation
6
+
7
+ $ gem install swift_lib_templater
8
+
9
+ ## Usage
10
+
11
+ $ swift_lib_templater
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "swift_lib_templater"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'swift_lib_templater'
@@ -0,0 +1,36 @@
1
+ require 'optparse'
2
+ require 'find'
3
+
4
+ require 'swift_lib_templater/copy_template_command.rb'
5
+ require 'swift_lib_templater/get_framework_name_command.rb'
6
+ require 'swift_lib_templater/rename_files_command.rb'
7
+ require 'swift_lib_templater/initialize_git_repository_command.rb'
8
+
9
+ module SwiftLibTemplater
10
+ def systemWithoutOutput(command)
11
+ system command, ">/dev/null 2>&1"
12
+ end
13
+
14
+ begin
15
+ puts "Framework name ?"
16
+ project_name = GetFrameworkNameCommand.new.execute
17
+
18
+ project_dest = Dir.pwd
19
+ project_folder = File.expand_path("#{project_dest}/#{project_name}")
20
+
21
+ print "\nGenerating files... "
22
+ CopyTemplateCommand.new(project_folder).execute
23
+ RenameFilesCommand.new(project_folder, project_name).execute
24
+ puts "✅"
25
+
26
+ print "Initializing git... "
27
+ InitializeGitRepositoryCommand.new(project_folder).execute
28
+ puts "✅"
29
+
30
+ puts "\nProject #{project_name} successfully bootstraped ! 🎉"
31
+ rescue => e
32
+ puts "\n\n🚨 Failed with error:"
33
+ puts e.message
34
+ end
35
+ end
36
+
@@ -0,0 +1,15 @@
1
+ module SwiftLibTemplater
2
+ class CopyTemplateCommand
3
+ def initialize(dest)
4
+ @dest = dest
5
+ end
6
+
7
+ def execute()
8
+ if File.exists?(@dest)
9
+ raise "Path #{@dest} already exists"
10
+ end
11
+ Dir.chdir(File.dirname(__FILE__))
12
+ FileUtils.cp_r("../../lib/templates/framework", @dest)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module SwiftLibTemplater
2
+ class GetFrameworkNameCommand
3
+ def execute()
4
+ name_regexp = /[A-Z][A-Za-z0-9]*/
5
+ project_name = gets.chomp until project_name =~ name_regexp
6
+ project_name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module SwiftLibTemplater
2
+ class InitializeGitRepositoryCommand
3
+
4
+ def initialize(dir)
5
+ @dir = dir
6
+ end
7
+
8
+ def execute()
9
+ Dir.chdir(@dir)
10
+ systemWithoutOutput "git init ."
11
+ systemWithoutOutput "git commit -m 'Initial commit' --allow-empty"
12
+ systemWithoutOutput "git checkout -b develop"
13
+ systemWithoutOutput "git add ."
14
+ systemWithoutOutput "git commit -m 'Initial import'"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module SwiftLibTemplater
2
+ class CopyTemplateCommand
3
+
4
+ def initialize(dir)
5
+ @dir = dir
6
+ end
7
+
8
+ def execute()
9
+ systemWithoutOutput("open '#{@dir}'")
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,33 @@
1
+ module SwiftLibTemplater
2
+ class RenameFilesCommand
3
+
4
+ def initialize(dir, project_name)
5
+ @dir = dir
6
+ @project_name = project_name
7
+ end
8
+
9
+ def execute()
10
+ Dir.chdir(@dir)
11
+ # We need to list all the files before renaming the files because
12
+ # Find.find doesn't like that we mess with the files that are being
13
+ # enumerated
14
+ paths = []
15
+ Find.find(".") do |path|
16
+ paths << path
17
+ end
18
+ paths.each do |path|
19
+ base = File.basename(path)
20
+ new_path = path.gsub('TEMPLATE', @project_name)
21
+ new_dir, new_base = File.split(new_path)
22
+ next unless base =~ /(TEMPLATE|TP)/
23
+ File.rename(File.join(new_dir, base), new_path)
24
+ end
25
+ Find.find(".") do |path|
26
+ next unless File.file?(path)
27
+ next if File.extname(path) == ".png"
28
+ next if File.extname(path) == ".mobileprovision"
29
+ systemWithoutOutput("sed -i '' 's/TEMPLATE/#{@project_name}/g' '#{path}'")
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module SwiftLibTemplater
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,67 @@
1
+ # Xcode
2
+ #
3
+ # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4
+
5
+ ## Build generated
6
+ build/
7
+ DerivedData
8
+
9
+ ## Various settings
10
+ *.pbxuser
11
+ !default.pbxuser
12
+ *.mode1v3
13
+ !default.mode1v3
14
+ *.mode2v3
15
+ !default.mode2v3
16
+ *.perspectivev3
17
+ !default.perspectivev3
18
+ xcuserdata
19
+
20
+ ## Other
21
+ *.xccheckout
22
+ *.moved-aside
23
+ *.xcuserstate
24
+ *.xcscmblueprint
25
+ *.DS_Store
26
+
27
+ ## Obj-C/Swift specific
28
+ *.hmap
29
+ *.ipa
30
+ *.xcarchive
31
+ *.app.dSYM.zip
32
+
33
+ # CocoaPods
34
+ #
35
+ # We recommend against adding the Pods directory to your .gitignore. However
36
+ # you should judge for yourself, the pros and cons are mentioned at:
37
+ # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
38
+
39
+ Pods/
40
+
41
+ ##Fastlane
42
+ # fastlane specific
43
+ fastlane/report.xml
44
+
45
+ # deliver temporary files
46
+ fastlane/Preview.html
47
+
48
+ # scan/snapshot temporary files (default values)
49
+ /metrics
50
+ /tests_derived_data
51
+ /screenshots
52
+
53
+ #fastlane plugins
54
+ Pluginfile_fastlane
55
+ Gemfile_fastlane
56
+ Gemfile_fastlane.lock
57
+
58
+ #fastlane build artifacts
59
+ /build
60
+ /derived_data
61
+
62
+ #metadata
63
+ /fastlane/**/metadata/**/*
64
+ /fastlane/**/screenshots/**/*
65
+
66
+ ##AppCode
67
+ .idea/
@@ -0,0 +1,31 @@
1
+ os: osx
2
+ osx_image: xcode10.1
3
+ language: swift
4
+
5
+ branches:
6
+ only:
7
+ - master
8
+
9
+ env:
10
+ global:
11
+ - LANG=en_US.UTF-8
12
+ - LC_ALL=en_US.UTF-8
13
+ - DESTINATION="OS=12.1,name=iPhone XS"
14
+ - SCHEME="TEMPLATE"
15
+ - WORKSPACE="TEMPLATE.xcworkspace"
16
+ skip_cleanup: true
17
+
18
+ jobs:
19
+ include:
20
+
21
+ - stage: podspec
22
+ script:
23
+ - pod spec lint
24
+
25
+ - stage: Build
26
+ script:
27
+ - set -o pipefail && xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO | xcpretty
28
+
29
+ - stage: Tests
30
+ script:
31
+ - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO | xcpretty
File without changes
@@ -0,0 +1,23 @@
1
+ * Copyright (c) 2018, Applidium
2
+ * All rights reserved.
3
+ * Redistribution and use in source and binary forms, with or without
4
+ * modification, are permitted provided that the following conditions are met:
5
+ *
6
+ * * Redistributions of source code must retain the above copyright
7
+ * notice, this list of conditions and the following disclaimer.
8
+ * * Redistributions in binary form must reproduce the above copyright
9
+ * notice, this list of conditions and the following disclaimer in the
10
+ * documentation and/or other materials provided with the distribution.
11
+ * * Neither the name of Applidium nor the names of its contributors may
12
+ * be used to endorse or promote products derived from this software
13
+ * without specific prior written permission.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
16
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
19
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
@@ -0,0 +1,29 @@
1
+ # TEMPLATE
2
+
3
+ [![Version](https://img.shields.io/cocoapods/v/TEMPLATE.svg?style=flat)](https://cocoapods.org/pods/TEMPLATE)
4
+ [![License](https://img.shields.io/cocoapods/l/TEMPLATE.svg?style=flat)](https://cocoapods.org/pods/TEMPLATE)
5
+ <!-- [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -->
6
+ <!-- [![Platform](https://img.shields.io/cocoapods/p/OverlayContainer.svg?style=flat)](https://cocoapods.org/pods/OverlayContainer) -->
7
+ <!-- [![Build Status](https://api.travis-ci.org/applidium/TEMPLATE.svg?branch=master)](https://travis-ci.org/applidium/TEMPLATE) -->
8
+
9
+ ## Installation
10
+
11
+ TEMPLATE is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:
12
+
13
+ ### Cocoapods
14
+
15
+ ```ruby
16
+ pod 'TEMPLATE'
17
+ ```
18
+
19
+ <!-- ### Carthage
20
+
21
+ Add the following to your Cartfile:
22
+
23
+ ```ruby
24
+ github "https://github.com/applidium/TEMPLATE"
25
+ ``` -->
26
+
27
+ ## License
28
+
29
+ TEMPLATE is available under the MIT license. See the LICENSE file for more info.
@@ -0,0 +1,7 @@
1
+ //
2
+ // EmptyFile.swift
3
+ // TEMPLATE
4
+ //
5
+ // Created by Gaétan Zanella on 05/03/2019.
6
+ // Copyright © 2019 Fabernovel. All rights reserved.
7
+ //
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ </dict>
22
+ </plist>
@@ -0,0 +1,19 @@
1
+ //
2
+ // TEMPLATE.h
3
+ // TEMPLATE
4
+ //
5
+ // Created by Gaétan Zanella on 05/03/2019.
6
+ // Copyright © 2019 Fabernovel. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ //! Project version number for TEMPLATE.
12
+ FOUNDATION_EXPORT double TEMPLATEVersionNumber;
13
+
14
+ //! Project version string for TEMPLATE.
15
+ FOUNDATION_EXPORT const unsigned char TEMPLATEVersionString[];
16
+
17
+ // In this header, you should import all the public headers of your framework using statements like #import <TEMPLATE/PublicHeader.h>
18
+
19
+