xcapp 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 40c92842d7076b4c7cae9fc6c87f2a110785be05
4
+ data.tar.gz: 81646ff236436dce408afd4772f881fbcadb2669
5
+ SHA512:
6
+ metadata.gz: 495c0e5f3a5f6edc853593afb11c4ea71f384a1f36e2c0df1e99988f155aac315a6bcd4a7e071d1d39618706fed3f0b05307c28b7f4bfe1c6bd603b908389820
7
+ data.tar.gz: 2cd41f59ad5b39914974037356efb4981f09227f0e6edf66b36329b2d4af1d0881136151f1cfd84939ed327ae74c881f159bca72516a55510058991b3283d13e
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at maurobender@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in test.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ xcapp (0.1.1)
5
+ commander (~> 4.3)
6
+ xcodeproj (~> 0.28)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.2.6)
12
+ i18n (~> 0.7)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
16
+ tzinfo (~> 1.1)
17
+ claide (0.9.1)
18
+ colored (1.2)
19
+ commander (4.4.0)
20
+ highline (~> 1.7.2)
21
+ diff-lcs (1.2.5)
22
+ highline (1.7.8)
23
+ i18n (0.7.0)
24
+ json (1.8.3)
25
+ minitest (5.8.4)
26
+ rake (10.5.0)
27
+ rspec (3.4.0)
28
+ rspec-core (~> 3.4.0)
29
+ rspec-expectations (~> 3.4.0)
30
+ rspec-mocks (~> 3.4.0)
31
+ rspec-core (3.4.4)
32
+ rspec-support (~> 3.4.0)
33
+ rspec-expectations (3.4.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.4.0)
36
+ rspec-mocks (3.4.1)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.4.0)
39
+ rspec-support (3.4.1)
40
+ thread_safe (0.3.5)
41
+ tzinfo (1.2.2)
42
+ thread_safe (~> 0.1)
43
+ xcodeproj (0.28.2)
44
+ activesupport (>= 3)
45
+ claide (~> 0.9.1)
46
+ colored (~> 1.2)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ bundler (~> 1.11)
53
+ rake (~> 10.0)
54
+ rspec (~> 3.0)
55
+ xcapp!
56
+
57
+ BUNDLED WITH
58
+ 1.11.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Mauro E. Bender
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # xcapp
2
+
3
+ ```xcapp``` is a command line tool for creating iOS XCode projects with a set of common files included in a really easy way.
4
+
5
+ ## Commands
6
+
7
+ ### create
8
+ Creates a new iOS Xcode project
9
+
10
+ ```sh
11
+ xcapp create [App Name]
12
+ ```
13
+
14
+ #### Options
15
+ - ```--lang LANGUAGE```: Sets __LANGUAGE__ as the project language. Available options are ```swift``` and ```objc```.
16
+ - ```--bundle-identifier IDENTIFIER```: Sets the Bundle Identifier for the app (e.g. ```com.company.MyApp```).
17
+
18
+ If neither the _App Name_ nor the options are provided they will be asked interactively once the command is run.
19
+
20
+ #### Examples
21
+
22
+ Create the MyApp project:
23
+
24
+ ```sh
25
+ xcapp create MyApp
26
+ ```
27
+
28
+ Creates "MyApp" project inside the MyApp directory. The bundle identifier and language options will be asked when the command is run.
29
+
30
+ # TODO
31
+ - Integrate with ```cocoapods```
32
+ - Integrate with ```fastlane```
33
+ - Opt-in/out testing:
34
+ - Add the tests files
35
+ - Add the tests target
36
+ - Add cocoapods dependencies for testing
37
+ - __Quick__ and __Nimble__ for Swift projects
38
+ - __Kiwi__ for Objective-C projects
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "xcapp"
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
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
data/bin/xcapp ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'rubygems'
5
+ require 'commander'
6
+ require 'xcapp'
7
+
8
+ class XCAppApplication
9
+ include Commander::Methods
10
+
11
+ def run
12
+ program :name, 'XCApp'
13
+ program :version, XCApp::VERSION
14
+ program :description, 'Create XCode projects in a easy way'
15
+
16
+ command :create do |c|
17
+ c.syntax = 'xcapp create [appname]'
18
+ c.description = 'Creates a new project for your app'
19
+ c.option '--bundle-identifier IDENTIFIER', String, 'Bundle identifier of the app (e.g. com.company.MyApp)'
20
+ c.option '--lang LANGUAGE', XCApp::ProjectCreator::SUPPORTED_LANGUAGES, 'Language for the app'
21
+
22
+ c.action do |args, options|
23
+ name = args.first if args.first
24
+ XCApp::CreateCommand.new.run name, options.bundle_identifier, options.lang
25
+ end
26
+ end
27
+
28
+ run!
29
+ end
30
+ end
31
+
32
+ XCAppApplication.new.run
@@ -0,0 +1,12 @@
1
+ module XCApp
2
+ module Helper
3
+ module GitHelper
4
+ def self.get_current_user_email
5
+ current_dir_user_email = `git config user.email`
6
+ return current_dir_user_email if current_dir_user_email
7
+
8
+ `git config --global user.email`
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,68 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "iphone",
5
+ "size" : "29x29",
6
+ "scale" : "2x"
7
+ },
8
+ {
9
+ "idiom" : "iphone",
10
+ "size" : "29x29",
11
+ "scale" : "3x"
12
+ },
13
+ {
14
+ "idiom" : "iphone",
15
+ "size" : "40x40",
16
+ "scale" : "2x"
17
+ },
18
+ {
19
+ "idiom" : "iphone",
20
+ "size" : "40x40",
21
+ "scale" : "3x"
22
+ },
23
+ {
24
+ "idiom" : "iphone",
25
+ "size" : "60x60",
26
+ "scale" : "2x"
27
+ },
28
+ {
29
+ "idiom" : "iphone",
30
+ "size" : "60x60",
31
+ "scale" : "3x"
32
+ },
33
+ {
34
+ "idiom" : "ipad",
35
+ "size" : "29x29",
36
+ "scale" : "1x"
37
+ },
38
+ {
39
+ "idiom" : "ipad",
40
+ "size" : "29x29",
41
+ "scale" : "2x"
42
+ },
43
+ {
44
+ "idiom" : "ipad",
45
+ "size" : "40x40",
46
+ "scale" : "1x"
47
+ },
48
+ {
49
+ "idiom" : "ipad",
50
+ "size" : "40x40",
51
+ "scale" : "2x"
52
+ },
53
+ {
54
+ "idiom" : "ipad",
55
+ "size" : "76x76",
56
+ "scale" : "1x"
57
+ },
58
+ {
59
+ "idiom" : "ipad",
60
+ "size" : "76x76",
61
+ "scale" : "2x"
62
+ }
63
+ ],
64
+ "info" : {
65
+ "version" : 1,
66
+ "author" : "xcode"
67
+ }
68
+ }
@@ -0,0 +1,45 @@
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>en</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>APPL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ <key>LSRequiresIPhoneOS</key>
24
+ <true/>
25
+ <key>UILaunchStoryboardName</key>
26
+ <string>LaunchScreen</string>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ <string>UIInterfaceOrientationLandscapeLeft</string>
35
+ <string>UIInterfaceOrientationLandscapeRight</string>
36
+ </array>
37
+ <key>UISupportedInterfaceOrientations~ipad</key>
38
+ <array>
39
+ <string>UIInterfaceOrientationPortrait</string>
40
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
41
+ <string>UIInterfaceOrientationLandscapeLeft</string>
42
+ <string>UIInterfaceOrientationLandscapeRight</string>
43
+ </array>
44
+ </dict>
45
+ </plist>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
5
+ </dependencies>
6
+ <objects>
7
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
8
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
9
+ <view contentMode="scaleToFill" id="iN0-l3-epB">
10
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
11
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
12
+ <subviews>
13
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="App Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MgW-yZ-L7z">
14
+ <rect key="frame" x="20" y="280.5" width="560" height="38.5"/>
15
+ <fontDescription key="fontDescription" type="system" pointSize="32"/>
16
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
17
+ <nil key="highlightedColor"/>
18
+ </label>
19
+ </subviews>
20
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
21
+ <constraints>
22
+ <constraint firstItem="MgW-yZ-L7z" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="Bti-sy-fzs"/>
23
+ <constraint firstItem="MgW-yZ-L7z" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" id="GLm-Yu-vID"/>
24
+ <constraint firstAttribute="trailing" secondItem="MgW-yZ-L7z" secondAttribute="trailing" constant="20" id="fqp-LO-wXv"/>
25
+ </constraints>
26
+ </view>
27
+ </objects>
28
+ </document>
@@ -0,0 +1,24 @@
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>en</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>BNDL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,13 @@
1
+ //
2
+ // AppDelegate.h
3
+ //
4
+
5
+ #import <UIKit/UIKit.h>
6
+
7
+ @interface AppDelegate : UIResponder <UIApplicationDelegate>
8
+
9
+ @property (strong, nonatomic) UIWindow *window;
10
+
11
+
12
+ @end
13
+
@@ -0,0 +1,41 @@
1
+ //
2
+ // AppDelegate.m
3
+ //
4
+
5
+ #import "AppDelegate.h"
6
+
7
+ @interface AppDelegate ()
8
+
9
+ @end
10
+
11
+ @implementation AppDelegate
12
+
13
+
14
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
15
+ // Override point for customization after application launch.
16
+ return YES;
17
+ }
18
+
19
+ - (void)applicationWillResignActive:(UIApplication *)application {
20
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
21
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
22
+ }
23
+
24
+ - (void)applicationDidEnterBackground:(UIApplication *)application {
25
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
26
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
27
+ }
28
+
29
+ - (void)applicationWillEnterForeground:(UIApplication *)application {
30
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
31
+ }
32
+
33
+ - (void)applicationDidBecomeActive:(UIApplication *)application {
34
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
35
+ }
36
+
37
+ - (void)applicationWillTerminate:(UIApplication *)application {
38
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
39
+ }
40
+
41
+ @end
@@ -0,0 +1,12 @@
1
+ //
2
+ // main.m
3
+ //
4
+
5
+ #import <UIKit/UIKit.h>
6
+ #import "AppDelegate.h"
7
+
8
+ int main(int argc, char * argv[]) {
9
+ @autoreleasepool {
10
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
11
+ }
12
+ }
@@ -0,0 +1,37 @@
1
+ //
2
+ // AppDelegate.swift
3
+ //
4
+
5
+ import UIKit
6
+
7
+ @UIApplicationMain
8
+ class AppDelegate: UIResponder, UIApplicationDelegate {
9
+ var window: UIWindow?
10
+
11
+ func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
12
+ // Override point for customization after application launch.
13
+ return true
14
+ }
15
+
16
+ func applicationWillResignActive(application: UIApplication) {
17
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
18
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
19
+ }
20
+
21
+ func applicationDidEnterBackground(application: UIApplication) {
22
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
23
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
24
+ }
25
+
26
+ func applicationWillEnterForeground(application: UIApplication) {
27
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
28
+ }
29
+
30
+ func applicationDidBecomeActive(application: UIApplication) {
31
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
32
+ }
33
+
34
+ func applicationWillTerminate(application: UIApplication) {
35
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
36
+ }
37
+ }
@@ -0,0 +1,24 @@
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>en</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>BNDL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,10 @@
1
+ require 'highline/import'
2
+
3
+ def choose_inline prompt, items, default
4
+ prompt = prompt + '(' + items.map(&:to_s).join(', ') + ') '
5
+
6
+ ask prompt do |q|
7
+ q.default = default.to_s if default
8
+ q.in = items.map &:to_s
9
+ end
10
+ end
@@ -0,0 +1,64 @@
1
+ require 'fileutils'
2
+ require 'utils/highline'
3
+ require 'helper/git_helper'
4
+
5
+ module XCApp
6
+ class CreateCommand
7
+ def run name, bundle_identifier, language
8
+ name = ask_for_project_name unless name
9
+ bundle_identifier = ask_for_bundle_identifier name unless bundle_identifier
10
+ language = ask_for_language unless language
11
+
12
+ create_project_directory name
13
+
14
+ creator = ProjectCreator.new
15
+ creator.create_project name, name, bundle_identifier, language.to_sym
16
+ say "Project created."
17
+ end
18
+
19
+ def ask_for_project_name
20
+ name = ask('App name: ')
21
+ while !name or name.length == 0
22
+ name = ask('You must input a name for the app: ')
23
+ end
24
+
25
+ name
26
+ end
27
+
28
+ def ask_for_bundle_identifier project_name
29
+ guessed_bundle_id = guess_bundle_identifier project_name
30
+ prompt = "Bundle identifier (e.g. com.company.#{project_name}): "
31
+
32
+ if guessed_bundle_id
33
+ ask(prompt) { |q| q.default = guessed_bundle_id }
34
+ else
35
+ ask prompt
36
+ end
37
+ end
38
+
39
+ def ask_for_language
40
+ choose_inline 'Language for the app? ', ProjectCreator::SUPPORTED_LANGUAGES, :swift
41
+ end
42
+
43
+ def guess_bundle_identifier project_name
44
+ git_user_email = Helper::GitHelper.get_current_user_email
45
+ return nil unless git_user_email
46
+
47
+ domain = git_user_email.partition('@').last.chomp
48
+ return nil unless (domain and domain.length > 0)
49
+
50
+ domain.split('.').reverse.join('.') + ".#{project_name}"
51
+ end
52
+
53
+ def create_project_directory project_name
54
+ if Dir.exists? project_name
55
+ overwrite = agree("#{project_name} directory already exist, overwrite? (yes/no) ") { |q| q.default = 'no' }
56
+ XCApp.exit_gracefully nil unless overwrite
57
+
58
+ FileUtils.rm_rf project_name
59
+ end
60
+
61
+ FileUtils.mkdir_p project_name
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,122 @@
1
+ require 'xcodeproj'
2
+
3
+ class Xcodeproj::Project
4
+ def set_common_build_setting key, value
5
+ root_object.build_configuration_list.build_configurations.each { |config| config.build_settings[key] = value }
6
+ end
7
+
8
+ def self.project_shared_schemes project_path
9
+ schemes_path = File.join(project_path, 'xcshareddata', 'xcschemes')
10
+ Dir[File.join(schemes_path, '*.xcscheme')].map { |scheme| Xcodeproj::XCScheme.new(scheme) }
11
+ end
12
+ end
13
+
14
+ module XCApp
15
+ class ProjectCreator
16
+ SUPPORTED_LANGUAGES = [:swift, :objc]
17
+ TEMPLATES_DIR_NAME = 'templates'
18
+
19
+ def initialize
20
+ @templates_folder = File.expand_path('../../' + TEMPLATES_DIR_NAME, __FILE__)
21
+ end
22
+
23
+ def create_project name, path, bundle_identifier, language
24
+ raise 'Language must be :objc or :swift' unless ProjectCreator::SUPPORTED_LANGUAGES.include? language
25
+
26
+ project_path = File.join(path, "#{name}.xcodeproj")
27
+ project = Xcodeproj::Project.new project_path
28
+
29
+ app_files = copy_template_app_files_to_project project, name, path, language
30
+ tests_files = copy_template_tests_files_to_project project, name, path, language
31
+
32
+ app_target = create_app_target project, name, language, app_files
33
+ test_target = create_test_target project, name, language, tests_files
34
+
35
+ create_default_build_configurations project
36
+
37
+ set_default_build_settings project, name, bundle_identifier
38
+
39
+ project.save
40
+
41
+ create_default_scheme project_path, name, app_target, test_target
42
+ end
43
+
44
+ def copy_template_app_files_to_project project, project_name, path, language
45
+ app_group = project.new_group project_name, project_name
46
+ dest_folder = File.join(path, project_name)
47
+
48
+ copy_template_files_to_project :common, :app, dest_folder
49
+ copy_template_files_to_project language, :app, dest_folder
50
+
51
+ add_references_to_project_group dest_folder, app_group
52
+ end
53
+
54
+ def copy_template_tests_files_to_project project, project_name, path, language
55
+ tests_group = project.new_group "#{project_name}Tests", "#{project_name}Tests"
56
+ dest_folder = File.join(path, "#{project_name}Tests")
57
+
58
+ copy_template_files_to_project :common, :tests, dest_folder
59
+ copy_template_files_to_project language, :tests, dest_folder
60
+
61
+ add_references_to_project_group dest_folder, tests_group
62
+ end
63
+
64
+ def copy_template_files_to_project language, type, dest_folder
65
+ raise 'Type is not valid. Available types: :app, :tests.' unless [:app, :tests].include? type
66
+ raise 'Language must be :objc or :swift' unless [:common, :objc, :swift].include? language
67
+
68
+ source_folder = "#{@templates_folder}/#{language.to_s}/#{type.to_s}"
69
+ copy_template_files source_folder, dest_folder
70
+ end
71
+
72
+ def copy_template_files template_source_folder, dest_folder
73
+ FileUtils.copy_entry template_source_folder, dest_folder, false, false, true
74
+ end
75
+
76
+ def add_references_to_project_group project_folder, project_group
77
+ add_folder_files_to_project_group project_folder, project_group
78
+ end
79
+
80
+ def add_folder_files_to_project_group folder, group
81
+ Dir.entries(folder).select { |file| !(['.', '..'].include? file) }.map { |file| group.new_file file }
82
+ end
83
+
84
+ def create_app_target project, project_name, language, files
85
+ files = files.reject { |file| file.path == "Info.plist" } # Skips Info.plist
86
+ create_project_target project, project_name, :application, language, files
87
+ end
88
+
89
+ def create_test_target project, project_name, language, files
90
+ create_project_target project, "#{project_name}Tests", :unit_test_bundle, language, files
91
+ end
92
+
93
+ def create_project_target project, target_name, target_type, language, files
94
+ target = project.new_target target_type, target_name, :ios, nil, nil, language
95
+ target.add_file_references files
96
+
97
+ target
98
+ end
99
+
100
+ def create_default_build_configurations project
101
+ project.add_build_configuration 'Staging', :release
102
+ end
103
+
104
+ def set_default_build_settings project, project_name, bundle_identifier
105
+ project.set_common_build_setting 'PRODUCT_BUNDLE_IDENTIFIER', bundle_identifier
106
+ project.set_common_build_setting 'EXECUTABLE_NAME', project_name
107
+ project.set_common_build_setting 'VERSIONING_SYSTEM', 'apple-generic'
108
+ project.set_common_build_setting 'CURRENT_PROJECT_VERSION', '1'
109
+ project.set_common_build_setting 'INFOPLIST_FILE', "$(SRCROOT)/#{project_name}/Info.plist";
110
+ end
111
+
112
+ def create_default_scheme project_path, project_name, app_target, test_target
113
+ default_scheme = Xcodeproj::XCScheme.new
114
+
115
+ default_scheme.add_build_target app_target
116
+ default_scheme.add_test_target test_target
117
+ default_scheme.set_launch_target app_target
118
+
119
+ default_scheme.save_as project_path, project_name
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,3 @@
1
+ module XCApp
2
+ VERSION = "0.1.1"
3
+ end
data/lib/xcapp.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'commander'
2
+
3
+ require 'xcapp/version'
4
+ require 'xcapp/project_creator'
5
+ require 'xcapp/create_command'
6
+
7
+ module XCApp
8
+ def self.exit_gracefully reason
9
+ say reason if reason
10
+ say 'Exiting...'
11
+ exit
12
+ end
13
+ end
data/xcapp.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcapp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xcapp"
8
+ spec.version = XCApp::VERSION
9
+ spec.authors = ["Mauro E. Bender"]
10
+ spec.email = ["maurobender@gmail.com"]
11
+
12
+ spec.summary = "Command line tool for creating iOS XCode projects."
13
+ spec.description = "Command line tool for creating iOS XCode projects with a set of common files included in a really easy way."
14
+ spec.homepage = "https://github.com/maurobender/xcapp"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "bin"
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "commander", "~> 4.3"
23
+ spec.add_dependency "xcodeproj", "~> 0.28"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.11"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcapp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Mauro E. Bender
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: xcodeproj
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.28'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.28'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: Command line tool for creating iOS XCode projects with a set of common
84
+ files included in a really easy way.
85
+ email:
86
+ - maurobender@gmail.com
87
+ executables:
88
+ - console
89
+ - setup
90
+ - xcapp
91
+ extensions: []
92
+ extra_rdoc_files: []
93
+ files:
94
+ - ".gitignore"
95
+ - ".rspec"
96
+ - ".travis.yml"
97
+ - CODE_OF_CONDUCT.md
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - LICENSE
101
+ - README.md
102
+ - Rakefile
103
+ - bin/console
104
+ - bin/setup
105
+ - bin/xcapp
106
+ - lib/helper/git_helper.rb
107
+ - lib/templates/common/app/Assets.xcassets/AppIcon.appiconset/Contents.json
108
+ - lib/templates/common/app/Info.plist
109
+ - lib/templates/common/app/LaunchScreen.xib
110
+ - lib/templates/common/tests/Info.plist
111
+ - lib/templates/objc/app/AppDelegate.h
112
+ - lib/templates/objc/app/AppDelegate.m
113
+ - lib/templates/objc/app/main.m
114
+ - lib/templates/swift/app/AppDelegate.swift
115
+ - lib/templates/swift/tests/Info.plist
116
+ - lib/utils/highline.rb
117
+ - lib/xcapp.rb
118
+ - lib/xcapp/create_command.rb
119
+ - lib/xcapp/project_creator.rb
120
+ - lib/xcapp/version.rb
121
+ - xcapp.gemspec
122
+ homepage: https://github.com/maurobender/xcapp
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.4.6
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Command line tool for creating iOS XCode projects.
146
+ test_files: []