doc05 - KoreaSenchaUserGroup/Lab1 GitHub Wiki

DOC 5. [Overview] Using Sencha Command

์›๋ฌธ : http://docs.sencha.com/touch/2-0/#!/guide/command

๋ฒˆ์—ญ : ์ •๊ฑด์šฐ [Github:NangChun]

Using Sencha Command

Sencha Command is a cross-platform command line tool that helps make developing applications with Sencha SDKs full of enjoyment. The tool consists of many useful automated tasks around the full life-cycle of your applications, from generating a fresh new project to deploying for production.

์„ผ์ฐจ ๋ช…๋ น์–ด ์‚ฌ์šฉํ•˜๊ธฐ

์„ผ์ฐจ ๋ช…๋ น์–ด๋Š” ๊ฐœ๋ฐœํ•˜๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“œ๋Š”๋ฐ ๋„์›€์ด ๋˜๋Š” ๋™์‹œ์— ์„ผ์ฐจ SDKs๋ฅผ ์ตœ๋Œ€ํ•œ ์ฆ๊ธธ์ˆ˜ ์žˆ๋Š” ํฌ๋กœ์Šค ํ”Œ๋žซํผ ์ปค๋งจ๋“œ ๋ผ์ธ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ์ด ๋„๊ตฌ๋Š” ์ œ์ž‘์„ ์œ„ํ•œ ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑ์—์„œ ๋ฐฐํฌํ•˜๊ธฐ๊นŒ์ง€์˜, ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ๋‘˜๋Ÿฌ์‹ผ ์ƒ๋ช…์ฃผ๊ธฐ ์ „์ฒด์— ์œ ์šฉํ•œ ๋งŽ์€ ์ž๋™ํ™”๋œ ์ž‘์—…์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

Requirements

Please note that all commands only apply to Sencha Touch 2. Only OS X or Windows operating systems are currently supported.

Step 1: Setup an HTTP server on your computer if you don't have one running. This guide assumes that the host name is localhost, and the document root is at /path/to/www

Step 2: Download and install the latest SDK Tools on your development machine. The latest version as of this writing is 2.0.0 beta.

Step 3: Download the latest Sencha Touch 2 SDK. Extract the SDK to a local directory.

Step 4: Verify that Sencha Command is working properly onp your machine:

Open a command line terminal, and run the following commands. Replace /path/to/sencha-touch-2-sdk with the actual path to the SDK that you extracted to previously, as mentioned in Step 2.

cd /path/to/sencha-touch-2-sdk
sencha

If a help message appears with the first line that says: "Sencha Command v2.0.0 for Sencha Touch 2", you are all set.

์ž๊ฒฉ์š”๊ฑด

๋ชจ๋“  ๋ช…๋ น์ด ์„ผ์ฐจํ„ฐ์น˜ 2๋กœ ์ ์šฉ ๋œ๋‹ค๋Š” ์ ์— ์œ ์˜ํ•˜์‹ญ์‹œ์˜ค. ํ˜„์žฌ OS X ๋˜๋Š” Windows ์šด์˜์ฒด์ œ๋งŒ ์ง€์›๋ฉ๋‹ˆ๋‹ค.

1 ๋‹จ๊ณ„ : ๋งŒ์•ฝ ์‹คํ–‰์ด ๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์ปดํ“จํ„ฐ์— http์„œ๋ฒ„๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ๋ณธ ๊ฐ€์ด๋“œ๋Š” ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์ด '๋กœ์ปฌํ˜ธ์ŠคํŠธ' ์ž„์„ ๊ฐ€์ •ํ•˜๊ณ , ๋ฌธ์„œ ๋ฃจํŠธ๋Š” /path/to/www์— ์žˆ์Šต๋‹ˆ๋‹ค.

2 ๋‹จ๊ณ„ : (http://www.sencha.com/products/sdk-tools) ๊ฐœ๋ฐœ ์ปดํ“จํ„ฐ์— ๋‹ค์šด๋กœ๋“œ [์ตœ์‹  SDK ๋„๊ตฌ]๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

3 ๋‹จ๊ณ„ : [์ตœ์‹  Sencha ํ„ฐ์น˜ 2 SDK] (http://www.sencha.com/products/touch/)์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค. ๋กœ์ปฌ ๋””๋ ‰ํ† ๋ฆฌ์— SDK๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.

4 ๋‹จ๊ณ„ : ์„ผ์ฐจ ๋ช…๋ น์ด ์ปดํ“จํ„ฐ์—์„œ ์ œ๋Œ€๋กœ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:

์ปค๋งจ๋“œ ๋ผ์ธ ํ„ฐ๋ฏธ๋„์„ ์—ด๊ณ  ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. 2 ๋‹จ๊ณ„ ์—์„œ์™€ ๊ฐ™์ด ์–ธ๊ธ‰ํ•œ, ์ด์ „์— ์ถ”์ถœํ•œ ๊ฒƒ์œผ๋กœ SDK์˜ ์‹ค์ œ ๊ฒฝ๋กœ์™€/path/to/sencha-touch-2-sdk๋ฅผ ๊ต์ฒดํ•ฉ๋‹ˆ๋‹ค.

cd /path/to/sencha-touch-2-sdk
sencha

์ฒซ ๋ฒˆ์งธ ๋ผ์ธ๊ณผ ํ•จ๊ป˜ ๋„์›€๋ง ๋ฉ”์‹œ์ง€๊ฐ€ : "Sencha Command v2.0.0 Sencha Touch 2 '์ด๋ผ๊ณ  ๋‚˜ํƒ€๋‚˜๋ฉด, ๋ชจ๋‘ ์„ค์ •๋ฉ๋‹ˆ๋‹ค.

Getting Started

All commands have the exact same syntax as follows:

sencha [module] [action] [arguments...]

Some typical examples:

# Minify app.js and write the output to app.minified.js
sencha fs minify app.js app.minified.js

# Create a new project based on the current SDK with namespace 'MyApp' and store inside '/path/to/www/myapp'
sencha app create MyApp /path/to/www/myapp

To see a list of all available modules, simply type: sencha (when the current working directory is either the SDK directory or a project directory)

Similarly, to see a list of all available actions for a specific module, run: sencha [module], for example: sencha app

Lastly, typing sencha [module] [action] prints out the full list of arguments for that typical action, for example: sencha app create

์‹œ์ž‘ํ•˜๊ธฐ

๋ชจ๋“  ๋ช…๋ น์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌ๋ฌธ์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค :

sencha [module] [action] [arguments...]

์ „ํ˜•์ ์ธ ๋ช‡๊ฐ€์ง€ ์˜ˆ์ž…๋‹ˆ๋‹ค :

# app.js๋ฅผ ์ถ•์†Œํ•˜๊ณ  app.minified.js์œผ๋กœ ์ถœ๋ ฅํ•˜๋„๋ก ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.
sencha fs minify app.js app.minified.js

# ์ง€๊ธˆ์˜ SDK๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ๋ฅผ ๋„ค์ž„์ŠคํŽ˜์ด์Šค 'MyApp'๊ณผ '/path/to/www/myapp' ์—์„œ์˜ ์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
sencha app create MyApp /path/to/www/myapp

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ๋ชจ๋“ˆ์˜ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด, ๊ฐ„๋‹จํžˆ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค : 'sencha' (ํ˜„์žฌ ์ž‘์—…์ค‘์ธ ๋””ํ…ํ„ฐ๋ฆฌ๋Š” sdk๋””ํ…ํ„ฐ๋ฆฌ ๋˜๋Š” ํ”„๋กœ์ ํŠธ ํ‹ฐํ…ํ„ฐ๋ฆฌ ์ค‘ ํ•˜๋‚˜)

์œ ์‚ฌํ•˜๊ฒŒ, ํŠน์ • ๋ชจ๋“ˆ์— ๋Œ€ํ•œ ๋ชจ๋“  ๊ฐ€๋Šฅํ•œ ๋™์ž‘์˜ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด, ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค : sencha [module], ์˜ˆ๋ฅผ ๋“ค๋ฉด : sencha app

๋งˆ์ง€๋ง‰์œผ๋กœ, ์ž…๋ ฅ sencha [module] [action] ์ „ํ˜•์ ์ธ ๋™์ž‘์— ๋Œ€ํ•œ ์ธ์ˆ˜์˜ ์ „์ฒด ๋ชฉ๋ก์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค, ์˜ˆ๋ฅผ๋“ค๋ฉด : sencha app create

Creating a New Application

The following command generates a new application with the namespace MyApp to /path/to/www/myapp:

#  Make sure the current working directory is the Sencha Touch 2 SDK
cd /path/to/sencha-touch-2-sdk
sencha app create MyApp /path/to/www/myapp

To try it out, simply point your (WebKit-based) browser to http://localhost/myapp.

Congratulations, you have just created a fully working Sencha Touch 2 application in seconds!

์ƒˆ ์‘์šฉํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“ค๊ธฐ

๋‹ค์Œ ๋ช…๋ น์€ /path/to/www/myapp๋กœ ๋„ค์ž„์ŠคํŽ˜์ด์Šค MyApp๊ณผ ์ƒˆ๋กœ์šด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค :

#  ์„ผ์ฐจํ„ฐ์น˜ 2SDK ๋””ํ…ํ„ฐ๋ฆฌ๊ฐ€ ํ˜„์žฌ ์ž‘์—…์ค‘์ธ์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค
	cd /path/to/sencha-touch-2-sdk
sencha app create MyApp /path/to/www/myapp

์‹œ๋„ํ–ˆ๋‹ค๋ฉด, ๊ฐ„๋‹จํ•˜๊ฒŒ http://localhost/myapp๋กœ (์›นํ‚ท-๊ธฐ๋ฐ˜) ๋ธŒ๋ผ์šฐ์ €๋กœ ์ง€์ •๋ฉ๋‹ˆ๋‹ค.

์ถ•ํ•˜ํ•ฉ๋‹ˆ๋‹ค, ๋ฐฉ๊ธˆ ๋‘๋ฒˆ์งธ๋กœ ์™„๋ฒฝํ•˜๊ฒŒ ์ž‘๋™ํ•˜๋Š” ์„ผ์ฐจํ„ฐ์น˜2 ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค!

Understanding Your Application's Structure

The generated application should have the following file structure:

app						# Your application's source code in MVC structure
	controller
	model
	profile
	store
	view
		Main.js			# The main view of the application

resources
	css
		app.css			# The main stylesheet, compiled from app.scss

	sass
		app.scss		# The SASS file which compiles to app.css above,
						# includes Sencha Touch 2 theme by default

	icons				# Application icons for all mobile devices
						# When replacing these default images with your own,
						# make sure the file name and the dimension stays exactly the same
		...
	loading				# Application start-up screens for iOS devices
						# Similarly to icons, make sure the file names and
						# dimension stays the same
		...
	images				# Put other images used by your application here

sdk						# A copy of the SDK from which this application was generated
	...

index.html
app.js					# Contains application's initialization logics
app.json				# Configuration for deployment
packager.json			# Configuration for native packaging

Both app.json and packager.json have inline documentation for each configurable item. Simply open the files and edit them as you need.

์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๊ตฌ์กฐ ์ดํ•ดํ•˜๊ธฐ

์ƒ์„ฑ๋œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํŒŒ์ผ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค :

app						#  MVC ๊ตฌ์กฐ์•ˆ์—์„œ์˜ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ์†Œ์Šค์ฝ”๋“œ
	controller
	model
	profile
	store
	view
		Main.js			# ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๋ฉ”์ธ ๋ทฐ

resources
	css
		app.css			# app.scss์—์„œ ์ปดํŒŒ์ผ๋œ ๊ธฐ๋ณธ ์Šคํƒ€์ผ ์‹œํŠธ

	sass
		app.scss		# ์œ„์˜ app.scss๋ฅผ sassํŒŒ์ผ๋กœ ์ปดํŒŒ์ผ
						# ๊ธฐ๋ณธ์ ์œผ๋กœ ์„ผ์ฐจํ„ฐ์น˜2 ํ…Œ๋งˆ๋ฅผ ํฌํ•จ

	icons				# ๋ชจ๋“  ๋ชจ๋ฐ”์ผ ์žฅ์น˜๋ฅผ์œ„ํ•œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ ์•„์ด์ฝ˜
						# ํ˜ผ์ž์„œ ๊ธฐ๋ณธ์ ์ธ ์ด๋ฏธ์ง€๋ฅผ ๋Œ€์ฒดํ• ๋•Œ,
						# ํŒŒ์ผ ์ด๋ฆ„๊ณผ ํฌ๊ธฐ๊ฐ€ ์™„์ „ํžˆ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋Š”์ง€ ํ™•์ธ
		...
	loading				# iOS์žฅ์น˜๋ฅผ ์œ„ํ•œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ ์‹œ๋™ํ™”๋ฉด
						# ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์•„์ด์ฝ˜์—์„œ, ํŒŒ์ผ์ด๋ฆ„์„ ํ™•์ธ
						# ํฌ๊ธฐ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€
		...
	images				# ์—ฌ๊ธฐ์—์„œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์— ์˜ํ•ด ์‚ฌ์šฉ๋˜๋Š” ๋‹ค๋ฅธ ์ด๋ฏธ์ง€ ๋„ฃ๊ธฐ

sdk						# ์‘์šฉํ”„๋กœ๊ทธ๋žจ์ด ์ƒ์„ฑ๋˜์–ด์žˆ๋Š” SDK์˜ ์‚ฌ๋ณธ
	...

index.html
app.js					# ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ์ดˆ๊ธฐํ™” logics์„ ํฌํ•จ
app.json				# ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ๊ตฌ์„ฑ
packager.json			# ๋„ค์ดํ‹ฐ๋ธŒ ํฌ์žฅ์„ ์œ„ํ•œ ๊ตฌ์„ฑ

app.json๊ณผ packager.json ๋‘˜๋‹ค ๊ฐ๊ฐ ์„ค์ • ๊ฐ€๋Šฅํ•œ ํ•ญ๋ชฉ์„ ์œ„ํ•œ ๋ณธ๋ฌธ ์„ค๋ช…์„œ๋ฅผ ๊ฐ€์กŒ์Šต๋‹ˆ๋‹ค. ๊ฐ„๋‹จํžˆ ์—ด๊ณ  ํ•„์š”ํ•œ๋Œ€๋กœ ํŽธ์ง‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Developing Your Application

sencha generate helps you quickly generate common MVC components such as: Controller, Model and Profile.

For example:

#  Make sure the current working directory is the application's directory, i.e 'cd /path/to/www/myapp'
sencha generate model User --fields=id:int,name,email

The command above will automatically generate a new Model class named User with 3 fields of id, name and email to app/model/User.js, and add its reference to your app.js.

์‘์šฉํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœํ•˜๊ธฐ

'sencha generate'๋Š” ๋น ๋ฅด๊ณ  ๊ณตํ†ต์ ์ธ MVC ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋Š”๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค : ์ปจํŠธ๋กค๋Ÿฌ, ๋ชจ๋ธ ๊ทธ๋ฆฌ๊ณ  ํ”„๋กœํŒŒ์ผ ๋“ฑ.

์˜ˆ๋ฅผ๋“ค์–ด:

#  ํ˜„์žฌ ์ž‘์—… ๋””ํ…ํ„ฐ๋ฆฌ๊ฐ€ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๋””ํ…ํ† ๋ฆฌ ์ธ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค,  i.e 'cd /path/to/www/myapp'
sencha generate model User --fields=id:int,name,email

์œ„์˜ ๋ช…๋ น์€ ์ž๋™์œผ๋กœ ์ƒˆ ํด๋ž˜์Šค ๋ชจ๋ธ์„ app/model/User.js ์—์„œ 'User' ํ•จ๊ป˜ 'id', 'name' ๊ทธ๋ฆฌ๊ณ  'email'์˜ ์ด๋ฆ„์œผ๋กœ 3๊ฐ€์ง€ ์ž…๋ ฅ๋ž€์ด ์ƒ์„ฑ๋ ๊ฒƒ์ด๋ฉฐ, app.js์˜ ์ฐธ์กฐ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

Deploying Your Application

Developing your application simply means editing source code and refreshing the browser. All source files are dynamically loaded on demand. There's no building process involved.

When it comes to deployment, Sencha Command provides 4 different build environment options, namely 'testing', 'package', 'production' and 'native':

  • 'testing' is meant for QA prior to production. All JavaScript and CSS source Files are bundled, but not minified, which makes it easier for debugging if needed

  • 'package' creates a self-contained, re-distributable production build that normally runs from local file system without the need for a web server

  • 'production' creates a production build that is normally hosted on a web server and serves multiple clients (devices). The build is offline-capable using HTML 5 application cache, and has built-in over-the-air delta updating feature

  • 'native' first generates a 'package' build, then packages it as a native application, ready to be deployed to native platforms

As an example, the following command generates a 'testing' build for your application:

#  Make sure the current working directory is the application's directory you're deploying, i.e 'cd /path/to/www/myapp'
sencha app build testing

And similarly when you're ready for production deployment:

sencha app build production

The default deployment paths are taken from the buildPaths item inside app.json. For more details on optional arguments, run

Sencha Command automates all optimizations for your application, including but not limited to:

  • Resolving dependencies required by the application and only including exactly what is used for optimal file size / performance
  • Enabling HTML 5 application cache via automatic generation of cache.manifest and resources checksum
  • Minifying all JavaScript and CSS assets
  • Storing all JavaScript and CSS assets inside Local Storage on first load, and patches them via delta updates between releases

As a result, your production build can load instantly on subsequent access and updates on-the-fly with minimal network transfer.

Important Note: The cache.manifest file is automatically generated for you. However, please make sure that your web server serves it with the correct Content-Type header of text/cache-manifest. To learn more about HTML 5 application cache, please refer to this article.

์‘์šฉํ”„๋กœ๊ทธ๋žจ ๋ฐฐํฌํ•˜๊ธฐ

์‘์šฉํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœ์€ ๋‹จ์ˆœํžˆ ์†Œ์Šค์ฝ”๋“œ ํŽธ์ง‘ํ•˜๊ธฐ์™€ ๋ธŒ๋ผ์šฐ์ €์˜ ์ƒˆ๋กœ๊ณ ์นจ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์†Œ์ŠคํŒŒ์ผ์€ ์š”๊ตฌ๋˜๋ฉด ๋™์ ์œผ๋กœ ๋กœ๋“œ๋ฉ๋‹ˆ๋‹ค. ๋ณต์žกํ•œ ๋นŒ๋”ฉ๊ณผ์ •์€ ์—†์Šต๋‹ˆ๋‹ค.

๋ฐฐํฌ๋˜๋ฉด, ์„ผ์ฐจ ์ปค๋งจ๋“œ๋Š” 4๊ฐ€์ง€์˜ ์„œ๋กœ ๋‹ค๋ฅธ ๋นŒ๋“œ ํ™˜๊ฒฝ ์˜ต์…˜์„ ์ œ๊ณต ํ•ฉ๋‹ˆ๋‹ค, ์ฆ‰ 'testing', 'package', 'production' ๊ทธ๋ฆฌ๊ณ  'native' ์ž…๋‹ˆ๋‹ค :

  • 'testing'์€ ์ œ์ž‘ ์ด์ „์˜ QA๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ๋ชจ๋“  ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์™€ CSS ์†Œ์Šค ํŒŒ์ผ์€ ๋ฒˆ๋“ค๋กœ ์ œ๊ณต๋˜๊ณ , ๊ทธ๋Ÿฌ๋‚˜ ์ถ•์†Œํ•˜์ง€ ์•Š์œผ๋ฉฐ, ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๋””๋ฒ„๊น…์„ ์œ„ํ•ด ์‰ฌ์›Œ์ง€๊ฒŒ ๋œ๋‹ค.

  • 'ํŒจํ‚ค์ง€'๋Š” ๋…๋ฆฝ์ ์œผ๋กœ ๋งŒ๋“ค์–ด์ง€๋ฉฐ, ์ผ๋ฐ˜์ ์œผ๋กœ ์›น์„œ๋ฒ„ ์—†์ด ๋กœ์ปฌ ํŒŒ์ผ ์‹œ์Šคํ…œ์—์„œ ์žฌ ๋ฐฐํฌํ•˜์—ฌ ์ œ์ž‘๋˜๋Š” ๋นŒ๋“œ.

  • 'production'์€ ์›น ์„œ๋ฒ„์—์„œ ์ •์ƒ์ ์œผ๋กœ ํ˜ธ์ŠคํŠธ๋œ ๋นŒ๋“œ๋ฅผ ์ œ์ž‘ํ•˜์—ฌ ๋งŒ๋“ค์–ด์ง€๋ฉฐ ์—ฌ๋Ÿฌ ํด๋ผ์ด์–ธํŠธ(์žฅ์น˜)๋ฅผ ์ œ๊ณต. ๋นŒ๋“œ๋Š” HTML 5์˜ ์‘์šฉํ”„๋กœ๊ทธ๋žจ ์บ์‹œ๋กœ ์˜คํ”„๋ผ์ธ ์ƒํƒœ์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ๋ฌด์„  ๋ธํƒ€ ์—…๋ฐ์ดํŠธ ๊ธฐ๋Šฅ์„ ๋‚ด์žฅ.

  • 'native' ๋จผ์ € 'package'๋นŒ๋“œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค, ๊ทธ๋ฆฌ๊ณ  ๋„ค์ดํ‹ฐ๋ธŒ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ํฌ์žฅํ•˜๊ณ , ๋„ค์ดํ‹ฐ๋ธŒ ํ”Œ๋žซํผ์—์„œ ๋ฐฐํฌํ•  ์ค€๋น„.

์˜ˆ๋ฅผ ๋“ค์–ด, ๋‹ค์Œ ๋ช…๋ น์€ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ์œ„ํ•ด 'testing' ๋นŒ๋“œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค :

# ํ˜„์žฌ ์ž‘์—…ํ•˜๋Š” ๋””ํ…ํ† ๋ฆฌ๋Š” ๋ฐฐํฌํ•˜๋Š” ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๋””ํ…ํ† ๋ฆฌ์— ์žˆ๋Š”์ง€ ํ™•์ธ, i.e 'cd /path/to/www/myapp' 
sencha app build testing

๊ทธ๋ฆฌ๊ณ  ์ œ์ž‘ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ์ค€๋น„๊ฐ€ ๋น„์Šทํ•˜๊ฒŒ ๋˜์—ˆ์„๋•Œ ์ž…๋‹ˆ๋‹ค :

sencha app build production

๊ธฐ๋ณธ ๋ฐฐํฌ ๊ฒฝ๋กœ๋Š” 'app.js' ๋‚ด๋ถ€ 'buildPaths' ํ•ญ๋ชฉ์—์„œ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ์„ ํƒ์  ์ธ์ˆ˜์— ๋Œ€ํ•œ ๋” ์ž์„ธํ•œ ๋‚ด์šฉ์„ ์›ํ•˜๋ฉด, ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์„ผ์ฐจ ๋ช…๋ น์„ ํฌํ•จํ•œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๋ชจ๋“  ์ตœ์ ํ™”๋ฅผ ์ž๋™ํ™”, ํฌํ•จํ•˜์ง€๋งŒ ์ œํ•œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค :

  • ์‘์šฉํ”„๋กœ๊ทธ๋žจ์— ํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ํ•ด๊ฒฐ์—๋งŒ ์ตœ์ ํ™”๋œ ํŒŒ์ผ ํฌ๊ธฐ / ์„ฑ๋Šฅ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” ์ •ํ™•ํ•œ ํฌํ•จ.
  • cache.manifest ๋ฐ ์ž์› ๊ฒ€์‚ฌ๊ฐ’ ์ž๋™ ์ƒ์„ฑ์„ ํ†ตํ•ด HTML 5์˜ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ์บ์‹œ๋ฅผ ํ™œ์„ฑํ™”.
  • ๋ชจ๋“  JavaScript์™€ CSS์˜ ์ž์‚ฐ์„ ์ถ•์†Œ.
  • ๋จผ์ € ๋ถ€ํ•˜์— ๋Œ€ํ•œ ๋กœ์ปฌ ์ €์žฅ์†Œ ์•ˆ์—์„œ ๋ชจ๋“  JavaScript์™€ CSS์˜ ์ž์‚ฐ์„ ์ €์žฅํ•˜๊ณ  ํ•˜๋Š” ๊ฒƒ์€ ๋ฆด๋ฆฌ์Šค ์‚ฌ์ด ๋ธํƒ€ ์—…๋ฐ์ดํŠธ๋ฅผ ํ†ตํ•ด ๊ทธ๋“ค์„ ํŒจ์น˜.

๊ฒฐ๊ณผ์ ์œผ๋กœ ์ œ์ž‘ ๋นŒ๋“œ๋Š” ์ตœ์†Œํ•œ์˜ ๋„คํŠธ์›Œํฌ ์ „์†ก๊ณผ-The-Fly ๋ฐฉ์‹์— ๋Œ€ํ•œ ํ›„์† ์•ก์„ธ์Šค ๋ฐ ์—…๋ฐ์ดํŠธ๋ฅผ ์ฆ‰์‹œ ๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ค‘์š” ** ์ฐธ๊ณ  ** : cache.manifestํŒŒ์ผ์ด ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜, ์›น ์„œ๋ฒ„๊ฐ€ text/cache-manifest์˜ ์˜ฌ๋ฐ”๋ฅธ Content-Type์˜ ํ—ค๋”์™€ ํ•จ๊ป˜ ์ œ๊ณตํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค. HTML 5 ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ์บ์‹œ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์„ ๋ณด๋ ค๋ฉด, [๋ฌธ์„œ] (http://www.html5rocks.com/en/tutorials/appcache/beginner/)๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.

Packaging Your Application for Distribution on App Stores

packager.json contains all configurable values to package your application.

If you are using OS X and have Xcode installed, this one-liner will automatically package your application and run it on iOS Simulator:

sencha app build native

For more details on working with packager.json, please refer to the Native Package guide

์•ฑ ์Šคํ† ์–ด๋กœ์˜ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ ํฌ์žฅ

packager.json์€ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ํฌ์žฅํ•˜๊ธฐ์œ„ํ•œ ๋ชจ๋“  ๊ตฌ์„ฑ ๊ฐ’์ด ๋“ค์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

OS X์„ ์‚ฌ์šฉํ•˜๊ณ  Xcode๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ๋‹ค๋ฉด, ์ด ๋‹จ์ผ ๋ผ์ด๋„ˆ๋Š” ์ž๋™์œผ๋กœ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ํŒจํ‚ค์ง€ ๋ฐ iOS ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์—์„œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค :

sencha app build native

packager.json๊ณผ ์ž‘์—…์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€, [๋„ค์ดํ‹ฐ๋ธŒ ํŒจํ‚ค์ง€ ๊ฐ€์ด๋“œ] (#! / ๊ฐ€์ด๋“œ / native_packaging)๋ฅผ ์ฐธ์กฐํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.