OSDN Git Service

Regular updates
[twpd/master.git] / divshot.md
1 ---
2 title: Divshot
3 ---
4
5 ## Getting started
6
7 ### Install divshot-cli
8
9 ```
10 $ npm install -g divshot-cli
11 $ divshot login
12 ```
13
14 ### Create divshot.json
15
16 ```json
17 {
18   "name": "yourapp",
19   "root": "./app"
20 }
21 ```
22
23 ### Push your app
24
25 ```
26 $ divshot push
27 ```
28
29 ## Configuration
30
31 See [configuration reference](https://docs.divshot.com/guides/configuration) and [routing guide](https://docs.divshot.com/guides/routing).
32
33 ```json
34 {
35   "name": "yourapp",
36   "root": "./app",
37   "clean_urls": true,
38   "clean_urls": ["/app/**", "/!components/**"],,
39   "error_page": "error.html",
40   "exclude": [ "Gruntfile.js" ],
41   "cache_control": {},
42   "routes": {
43     "/*.html": "index.html",
44     "/app/**/*.html": "app.html",
45     "**": "index.html"
46   },
47   "redirects": {
48     "/old/:segment/path": "/new/path/:segment",
49     "/some/old/path": {
50       "status": 302,
51       "url": "/some/new/path"
52     }
53   },
54   "headers": {
55     "/cors-stuff/**": {
56       "Access-Control-Allow-Origin": "*"
57     },
58     "/scripts/**": {
59       "content-type": "text/javascript"
60     }
61   }
62 }
63 ```
64
65 ## CLI
66
67 ```sh
68 divshot s   # server
69
70 divshot push [staging|production|development]
71 divshot pull [staging|production|development]
72 divshot purge   # cleans cache
73 divshot files
74
75 divshot promote development production
76
77 divshot open [<env>]
78 ```
79
80 ### Config
81 Edits `divshot.json`
82
83 ```
84
85 divshot config:add name your-app-name
86 divshot config:remove name
87 ```
88
89 ### Environment vars
90
91 ```
92 divshot env:add <env> KEY=value
93 divshot env:remove <env> KEY
94 divshot env:pull <env>
95 ```
96
97 ### App management
98
99 ```
100 divshot create <appname>
101 divshot rename <newname>
102 divshot status
103 divshot destroy
104 ```
105
106 divshot apps
107 divshot account
108 ```
109
110 ### Password protect
111
112 ```sh
113 divshot protect <env> <username:password>
114 ```
115
116 ## Custom domains
117
118 See [custom domains guide](http://docs.divshot.com/guides/domains).
119
120 ```sh
121 divshot domains:add foo.bar.com
122 ```
123
124 In your DNS create a `CNAME`: (no apex domains are supported)
125
126 ```
127 www.    CNAME    yourname.divshot.io
128 ```