venice-chr 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 888a882f6953f7f52ee7cef5896f8ea5d40ee126
4
- data.tar.gz: 76b47098de3a2458f596f654f8cd5e382a250795
3
+ metadata.gz: 01bbfd402de87da9749feb81d738fe6a7a1fba7d
4
+ data.tar.gz: 9b9188703f9c07ea372232f4c8b6dfee2c2cbf7b
5
5
  SHA512:
6
- metadata.gz: a56b4ad7247edb8938ba103ed84c5cf2212a71d34aae7d11577d8f19ef149948b86f00cbcc9c0081662960361cb966e0d75183eaa824176cbe41d2d227e7f7d5
7
- data.tar.gz: 55576b85a662d47e9d4b684e074e50c299a61df0854fda6506a605e42916ade2300f75853d02e6ef73dab24867051d8bd69f21cee1abc072da3feb6cdecbb937
6
+ metadata.gz: d92cc80a569e355c3bd86a8f8668cbe639e5c700959758f885366d3ac7751764c9aa1bd84734b6b9f3f0679b8438f530b6031b48c06c422db95146e0bdb4e2e0
7
+ data.tar.gz: 48da91c330a9c6a77d6b590000ba2b7e3a0f30a4bca6b97b011feeb6172ab75f1a76a700a244932550b145663ce92ebd7bccdaf9089bf1da16c387aa8abb5d33
@@ -59,9 +59,9 @@ linters:
59
59
  enabled: true
60
60
  force_nesting: true
61
61
  NameFormat:
62
- enabled: true
63
- allow_leading_underscore: true
64
- convention: hyphenated_lowercase
62
+ enabled: false
63
+ # allow_leading_underscore: true
64
+ # convention: hyphenated_lowercase
65
65
  NestingDepth:
66
66
  enabled: true
67
67
  max_depth: 4
@@ -0,0 +1,24 @@
1
+ We love pull requests. Here’s a quick guide:
2
+
3
+ 1. Fork the repository.
4
+ 2. Make your changes in a topic branch.
5
+ 3. Squash your commits into a single one (more on that [here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)).
6
+ 4. Rebase against `origin/master`, push to your fork and submit a pull request.
7
+ 5. If you are writing a new feature please add documentation for it by making another pull request to the `gh-pages` branch.
8
+
9
+ At this point you’re waiting on us. We like to at least comment on, if not
10
+ accept, pull requests within three business days (and, typically, one business
11
+ day). We may suggest some changes or improvements or alternatives.
12
+
13
+ Some things that will increase the chance that your pull request is accepted:
14
+
15
+ * Fix a bug, refactor code or expand an existing feature.
16
+ * Use the right syntax and naming conventions.
17
+ * Update parts of the documentation that are affected by your contribution.
18
+
19
+ **Git Commit Messages**
20
+
21
+ * Capitalize your commit messages.
22
+ * Start your message with a verb.
23
+ * Use present tense.
24
+ * Refer to the issue/PR number in your squashed commit message.
data/Gemfile CHANGED
@@ -23,6 +23,7 @@ group :development do
23
23
  gem "spring"
24
24
  gem "web-console"
25
25
  gem "heroku"
26
+ gem "aws-sdk"
26
27
  end
27
28
 
28
29
  group :development, :test do
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- venice-chr (0.1.4)
4
+ venice-chr (0.1.5)
5
5
  thor
6
6
 
7
7
  GEM
@@ -43,17 +43,21 @@ GEM
43
43
  minitest (~> 5.1)
44
44
  thread_safe (~> 0.3, >= 0.3.4)
45
45
  tzinfo (~> 1.1)
46
- addressable (2.3.8)
47
- ants (0.3.13)
46
+ addressable (2.4.0)
47
+ ants (0.3.14)
48
48
  devise
49
49
  meta-tags
50
50
  mongoid (>= 4.0)
51
51
  mongoid-slug (>= 4.0.0)
52
52
  arel (6.0.3)
53
53
  awesome_print (1.6.1)
54
+ aws-sdk (2.2.8)
55
+ aws-sdk-resources (= 2.2.8)
56
+ aws-sdk-core (2.2.8)
57
+ jmespath (~> 1.0)
58
+ aws-sdk-resources (2.2.8)
59
+ aws-sdk-core (= 2.2.8)
54
60
  bcrypt (3.1.10)
55
- binding_of_caller (0.7.2)
56
- debug_inspector (>= 0.0.1)
57
61
  bourbon (4.2.6)
58
62
  sass (~> 3.4)
59
63
  thor (~> 0.19)
@@ -73,11 +77,11 @@ GEM
73
77
  carrierwave (>= 0.8.0, < 0.11.0)
74
78
  mongoid (>= 3.0, < 6.0)
75
79
  mongoid-grid_fs (>= 1.3, < 3.0)
76
- chr (0.5.7)
80
+ chr (0.5.8)
77
81
  bourbon
78
82
  coffee-rails (>= 4.0)
79
83
  font-awesome-rails
80
- formagic (>= 0.3.9)
84
+ formagic (>= 0.3.10)
81
85
  jquery-rails
82
86
  rails (~> 4.2.5)
83
87
  sass-rails
@@ -97,8 +101,6 @@ GEM
97
101
  responders
98
102
  thread_safe (~> 0.1)
99
103
  warden (~> 1.2.3)
100
- domain_name (0.5.25)
101
- unf (>= 0.0.5, < 1.0.0)
102
104
  dotenv (2.0.2)
103
105
  dotenv-rails (2.0.2)
104
106
  dotenv (= 2.0.2)
@@ -126,7 +128,7 @@ GEM
126
128
  thor (~> 0.14)
127
129
  fission (0.5.0)
128
130
  CFPropertyList (~> 2.2)
129
- fog (1.36.0)
131
+ fog (1.37.0)
130
132
  fog-aliyun (>= 0.1.0)
131
133
  fog-atmos
132
134
  fog-aws (>= 0.6.0)
@@ -148,10 +150,10 @@ GEM
148
150
  fog-terremark
149
151
  fog-vmfusion
150
152
  fog-voxel
153
+ fog-vsphere (>= 0.4.0)
151
154
  fog-xenserver
152
155
  fog-xml (~> 0.1.1)
153
156
  ipaddress (~> 0.5)
154
- nokogiri (~> 1.5, >= 1.5.11)
155
157
  fog-aliyun (0.1.0)
156
158
  fog-core (~> 1.27)
157
159
  fog-json (~> 1.0)
@@ -165,7 +167,7 @@ GEM
165
167
  fog-json (~> 1.0)
166
168
  fog-xml (~> 0.1)
167
169
  ipaddress (~> 0.8)
168
- fog-brightbox (0.10.0)
170
+ fog-brightbox (0.10.1)
169
171
  fog-core (~> 1.22)
170
172
  fog-json
171
173
  inflecto (~> 0.0.2)
@@ -205,7 +207,7 @@ GEM
205
207
  fog-core
206
208
  fog-json
207
209
  fog-xml
208
- fog-sakuracloud (1.4.0)
210
+ fog-sakuracloud (1.7.3)
209
211
  fog-core
210
212
  fog-json
211
213
  fog-serverlove (0.1.2)
@@ -226,6 +228,9 @@ GEM
226
228
  fog-voxel (0.1.0)
227
229
  fog-core
228
230
  fog-xml
231
+ fog-vsphere (0.4.0)
232
+ fog-core
233
+ rbvmomi (~> 1.8)
229
234
  fog-xenserver (0.2.2)
230
235
  fog-core
231
236
  fog-xml
@@ -234,7 +239,7 @@ GEM
234
239
  nokogiri (~> 1.5, >= 1.5.11)
235
240
  font-awesome-rails (4.5.0.0)
236
241
  railties (>= 3.2, < 5.0)
237
- formagic (0.3.9)
242
+ formagic (0.3.10)
238
243
  bourbon (>= 3.2)
239
244
  normalize-rails (>= 3.0)
240
245
  formatador (0.2.5)
@@ -243,19 +248,18 @@ GEM
243
248
  has_scope (0.6.0)
244
249
  actionpack (>= 3.2, < 5)
245
250
  activesupport (>= 3.2, < 5)
246
- heroku (3.41.5)
247
- heroku-api (>= 0.3.19)
248
- launchy (>= 0.3.2)
249
- multi_json (>= 1.10)
250
- net-ssh-gateway (>= 1.2.0)
251
- netrc (>= 0.10.0)
252
- rest-client (>= 1.6.0)
253
- rubyzip (>= 0.9.9)
251
+ heroku (3.42.25)
252
+ heroku-api (= 0.3.23)
253
+ launchy (= 2.4.3)
254
+ multi_json (= 1.11.2)
255
+ net-ssh (= 2.9.2)
256
+ net-ssh-gateway (= 1.2.0)
257
+ netrc (= 0.10.3)
258
+ rest-client (= 1.6.8)
259
+ rubyzip (= 1.1.7)
254
260
  heroku-api (0.3.23)
255
261
  excon (~> 0.44)
256
262
  multi_json (~> 1.8)
257
- http-cookie (1.0.2)
258
- domain_name (~> 0.5)
259
263
  i18n (0.7.0)
260
264
  inflecto (0.0.2)
261
265
  inherited_resources (1.6.0)
@@ -264,10 +268,10 @@ GEM
264
268
  railties (>= 3.2, < 5)
265
269
  responders
266
270
  ipaddress (0.8.0)
267
- journal-chr (0.3.8)
268
- ants (>= 0.3.13)
269
- chr (>= 0.5.7)
270
- loft (>= 0.3.1)
271
+ jmespath (1.1.3)
272
+ journal-chr (0.4.0)
273
+ chr (>= 0.5.8)
274
+ loft (>= 0.4.1)
271
275
  mongosteen (>= 0.2.0)
272
276
  jquery-rails (4.0.5)
273
277
  rails-dom-testing (~> 1.0)
@@ -280,22 +284,22 @@ GEM
280
284
  kgio (2.10.0)
281
285
  launchy (2.4.3)
282
286
  addressable (~> 2.3)
283
- loft (0.3.1)
284
- ants (>= 0.3.10)
287
+ loft (0.4.1)
288
+ ants (>= 0.3.14)
285
289
  carrierwave-mongoid (>= 0.7.1)
286
- chr (>= 0.5.4)
290
+ chr (>= 0.5.8)
287
291
  mini_magick (>= 4.1.0)
288
292
  mongoid-autoinc (>= 4.0.0)
289
293
  mongoid-grid_fs (>= 2.1.0)
290
294
  mongoid_search (>= 0.3)
291
- mongosteen (>= 0.1.8)
295
+ mongosteen (>= 0.2.0)
292
296
  loofah (2.0.3)
293
297
  nokogiri (>= 1.5.9)
294
298
  mail (2.6.3)
295
299
  mime-types (>= 1.16, < 3)
296
300
  meta-tags (2.1.0)
297
301
  actionpack (>= 3.0.0)
298
- mime-types (2.99)
302
+ mime-types (1.25.1)
299
303
  mini_magick (4.3.6)
300
304
  mini_portile2 (2.0.0)
301
305
  minitest (5.8.3)
@@ -335,10 +339,10 @@ GEM
335
339
  mongoid_search (>= 0.3)
336
340
  multi_json (1.11.2)
337
341
  multipart-post (2.0.0)
338
- net-ssh (3.0.1)
342
+ net-ssh (2.9.2)
339
343
  net-ssh-gateway (1.2.0)
340
344
  net-ssh (>= 2.6.5)
341
- netrc (0.11.0)
345
+ netrc (0.10.3)
342
346
  nokogiri (1.6.7.1)
343
347
  mini_portile2 (~> 2.0.0.rc2)
344
348
  normalize-rails (3.0.3)
@@ -386,14 +390,19 @@ GEM
386
390
  thor (>= 0.18.1, < 2.0)
387
391
  raindrops (0.15.0)
388
392
  rake (10.4.2)
393
+ rbvmomi (1.8.2)
394
+ builder
395
+ nokogiri (>= 1.4.1)
396
+ trollop
397
+ rdoc (4.2.1)
398
+ json (~> 1.4)
389
399
  recipient_interceptor (0.1.2)
390
400
  mail
391
401
  responders (2.1.1)
392
402
  railties (>= 4.2.0, < 5.1)
393
- rest-client (1.8.0)
394
- http-cookie (>= 1.0.2, < 2.0)
395
- mime-types (>= 1.16, < 3.0)
396
- netrc (~> 0.7)
403
+ rest-client (1.6.8)
404
+ mime-types (~> 1.16)
405
+ rdoc (>= 2.4.2)
397
406
  rubyzip (1.1.7)
398
407
  sass (3.4.20)
399
408
  sass-rails (5.0.4)
@@ -403,7 +412,7 @@ GEM
403
412
  sprockets-rails (>= 2.0, < 4.0)
404
413
  tilt (>= 1.1, < 3)
405
414
  sax-machine (1.3.2)
406
- spring (1.5.0)
415
+ spring (1.6.1)
407
416
  sprockets (3.5.2)
408
417
  concurrent-ruby (~> 1.0)
409
418
  rack (> 1, < 3)
@@ -421,25 +430,22 @@ GEM
421
430
  thor (0.19.1)
422
431
  thread_safe (0.3.5)
423
432
  tilt (2.0.1)
433
+ trollop (2.1.2)
424
434
  tzinfo (1.2.2)
425
435
  thread_safe (~> 0.1)
426
436
  uglifier (2.7.2)
427
437
  execjs (>= 0.3.0)
428
438
  json (>= 1.8.0)
429
- unf (0.1.4)
430
- unf_ext
431
- unf_ext (0.0.7.1)
432
439
  unicorn (5.0.1)
433
440
  kgio (~> 2.6)
434
441
  rack
435
442
  raindrops (~> 0.7)
436
443
  warden (1.2.4)
437
444
  rack (>= 1.0)
438
- web-console (2.2.1)
439
- activemodel (>= 4.0)
440
- binding_of_caller (>= 0.7.2)
441
- railties (>= 4.0)
442
- sprockets-rails (>= 2.0, < 4.0)
445
+ web-console (3.0.0)
446
+ activemodel (>= 4.2)
447
+ debug_inspector
448
+ railties (>= 4.2)
443
449
  xml-simple (1.1.5)
444
450
 
445
451
  PLATFORMS
@@ -447,6 +453,7 @@ PLATFORMS
447
453
 
448
454
  DEPENDENCIES
449
455
  awesome_print
456
+ aws-sdk
450
457
  bson_ext
451
458
  bundler (~> 1.7)
452
459
  bundler-audit
@@ -478,4 +485,4 @@ DEPENDENCIES
478
485
  web-console
479
486
 
480
487
  BUNDLED WITH
481
- 1.10.6
488
+ 1.11.2
data/README.md CHANGED
@@ -4,12 +4,13 @@
4
4
 
5
5
  *Where art meets technology.*
6
6
 
7
- `v` `e` `n` `i` `c` `e` is boilderplate website & blog implementation based on
7
+ `v` `e` `n` `i` `c` `e` website boilerplate and blog implementation based on
8
8
  [Character](https://github.com/slate-studio/chr) library. It's used as
9
- boilerplate for new Rails projects or quick prototypes.
9
+ foundation for new Rails projects or quick prototypes.
10
10
 
11
11
  Homepage: https://github.com/alexkravets/venice
12
12
 
13
+
13
14
  ## Installation
14
15
 
15
16
  It assumes you have a machine equipped with Ruby & Mongodb.
@@ -21,40 +22,110 @@ manager:
21
22
  gem install venice-chr
22
23
  ```
23
24
 
24
- 2. Then kick off a new project:
25
+ 2. Then kick off a new project & start local server:
25
26
 
26
27
  ```bash
27
28
  venice new your-project-name
29
+ cd your-project-name
30
+ venice setup
31
+ rails s
28
32
  ```
29
33
 
30
- ## Shortcuts
34
+ *Default admin account is `user@example.com`:`password`.*
35
+
31
36
 
32
- We’ve also included some handy shortcuts with Venice:
37
+ ## Deploy to Heroku
33
38
 
34
- - Install dependencies and clear the Git remote:
39
+ 1. Create Heroku account
40
+ - [Heroku | Sign up](https://signup.heroku.com/)
41
+
42
+ 2. Login to Heroku
35
43
 
36
44
  ```bash
37
- venice setup
45
+ heroku login
38
46
  ```
39
47
 
40
- Default admin account is `user@example.com`:`password`.
48
+ 3. Generate local ssh keys (if you don't have ones)
49
+ - [Generating SSH keys](https://help.github.com/articles/generating-ssh-keys)
50
+
51
+ ```bash
52
+ ssh-keygen -t rsa
53
+ ```
41
54
 
42
- - Run the deploy (supported platforms: Heroku):
55
+ 4. Add local ssh keys to Heroku
56
+ - [Heroku | Managing Your SSH Keys](https://devcenter.heroku.com/articles/keys)
43
57
 
44
58
  ```bash
45
- venice deploy
59
+ heroku keys:add
46
60
  ```
47
61
 
48
- Default admin account: is `user@example.com`:`password`. After deploy is
49
- finished, please login and create a new account, then remove default one.
62
+ 5. Choose available `APPLICATION_NAME` on heroku, check using url
63
+ `APPLICATION_NAME`.herokuapp.com
64
+
65
+ 6. Create AWS account
66
+ - [AWS | Sign up](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html)
67
+
68
+ 7. Create access `KEY` and `SECRET` for AWS account
69
+ - [AWS | Getting Your Access Key ID and Secret Access Key](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html)
70
+
71
+ 8. Add AWS S3 service to your AWS account
72
+ - [AWS | Console](http://console.aws.amazon.com/console/home)
50
73
 
51
- - Start Venice server:
74
+ 9. Pick `REGION` for Heroku application and S3 bucket:
75
+ `us-east-1` (default) or `eu-west-1`
76
+ - [Heroku | Regions](https://devcenter.heroku.com/articles/regions#data-center-locations)
77
+ - [AWS | S3 Regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region)
78
+
79
+ 10. Deploy application to Heroku
52
80
 
53
81
  ```bash
54
- rails s
82
+ venice deploy heroku APPLICATION_NAME [REGION]
83
+ bin/heroku/add-s3 KEY SECRET BUCKET [REGION]
55
84
  ```
56
85
 
57
- ## Related Gems
86
+ **IMPORTANT:** *Default admin account: is `user@example.com`:`password`. After
87
+ deploy is finished, please login and create a new account, then remove default
88
+ one.*
89
+
90
+
91
+ ## Deploy to Digital Ocean
92
+
93
+ 1. Create Digital Ocean account
94
+ - [Digital Ocean | Sign up](https://cloud.digitalocean.com/registrations/new)
95
+
96
+ 2. Generate local ssh keys (if you don't have ones)
97
+ - [Generating SSH keys](https://help.github.com/articles/generating-ssh-keys)
98
+
99
+ ```bash
100
+ ssh-keygen -t rsa
101
+ ```
102
+
103
+ 3. Add local ssh keys to Digital Ocean account
104
+
105
+ ```bash
106
+ pbcopy < ~/.ssh/id_rsa.pub
107
+ ```
108
+
109
+ - [Digital Ocean | Security](https://cloud.digitalocean.com/settings/security)
110
+
111
+ 4. Create `Ubuntu 14.04` droplet, use `Add your SSH keys` option
112
+ - [Digital Ocean | Create Droplet](https://cloud.digitalocean.com/droplets/new)
113
+
114
+ 5. Get `DROPLET_IP`
115
+ - [Digital Ocean | Droplets](https://cloud.digitalocean.com/droplets)
116
+
117
+ 6. Deploy application to Digital Ocean
118
+
119
+ ```bash
120
+ venice deploy digital-ocean DROPLET_IP
121
+ ```
122
+
123
+ **IMPORTANT:** *Default admin account: is `user@example.com`:`password`. After
124
+ deploy is finished, please login and create a new account, then remove default
125
+ one.*
126
+
127
+
128
+ ## Under the Hood
58
129
 
59
130
  Venice is based on a bunch of open source gems. You might be interested to have
60
131
  a look into those to get better understanding of how things do work inside:
@@ -73,6 +144,8 @@ concerns that are used on the backend and CMS
73
144
  Character CMS
74
145
  - [Mongosteen](https://github.com/slate-studio/mongosteen): An easy way to add
75
146
  CRUD actions for Mongoid models
147
+ - [Devise](https://github.com/plataformatec/devise): Flexible authentication
148
+ solution for Rails with Warden
76
149
 
77
150
 
78
151
  ## Contributing
@@ -87,4 +160,4 @@ guidelines:
87
160
  4. Post a [pull request](https://github.com/alexkravets/venice/compare).
88
161
 
89
162
  Thank you to all
90
- [the contributors](https://github.com/alexkraves/venice/contributors)!
163
+ [the contributors](https://github.com/alexkravets/venice/contributors)!
@@ -6,6 +6,8 @@
6
6
  #= require ants
7
7
  #= require tape
8
8
  #= require journal
9
+ #= require formagic/inputs/ace-css
10
+ #= require formagic/inputs/ace-js
9
11
 
10
12
  #= require_tree ./admin
11
13
 
@@ -7,3 +7,5 @@
7
7
  categories: new JournalCategories()
8
8
  admins: new AntsAdminUsers()
9
9
  redirects: new AntsRedirects()
10
+ css: cssSettingsConfig()
11
+ js: jsSettingsConfig()
@@ -0,0 +1,11 @@
1
+ @cssSettingsConfig = ->
2
+ formSchema =
3
+ css_editor_panel:
4
+ type: "group"
5
+ title: "CSS"
6
+ groupClass: "group-panel"
7
+ inputs:
8
+ css:
9
+ type: "css"
10
+
11
+ new AntsSettings('Styles', 'styles', formSchema)
@@ -1,10 +1,3 @@
1
- class @GroupHeader
2
- constructor: (@form, @group, name) ->
3
- @$title =$ "<span>#{ name }</span>"
4
- @$header =$ """<header class='group-header'></header>"""
5
- @$header.append @$title
6
- @group.$el.prepend @$header
7
-
8
1
  @generalSettingsConfig = ->
9
2
  formSchema =
10
3
  website_settings:
@@ -0,0 +1,11 @@
1
+ @jsSettingsConfig = ->
2
+ formSchema =
3
+ js_editor_panel:
4
+ type: "group"
5
+ title: "JavaScript"
6
+ groupClass: "group-panel"
7
+ inputs:
8
+ javascript:
9
+ type: "js"
10
+
11
+ new AntsSettings('Scripts', 'scripts', formSchema)
@@ -18,7 +18,21 @@ $proxima-nova-family: "Proxima Nova", 'Helvetica Neue', Helvetica, Arial, 'Lucid
18
18
  @include no-bottom-border;
19
19
  padding-left: 6em;
20
20
 
21
- .label { display: none; }
21
+ .label {
22
+ display: none;
23
+ }
24
+ }
25
+ }
26
+
27
+ .js_editor_panel,
28
+ .css_editor_panel {
29
+ .input-css,
30
+ .input-js {
31
+ padding-top: 0.9em;
32
+ }
33
+
34
+ .label {
35
+ display: none;
22
36
  }
23
37
  }
24
38
 
@@ -11,12 +11,18 @@ module LoadSettings
11
11
  end
12
12
 
13
13
  def build_settings_defaults
14
- SettingsObject.create(title: 'general', values: {
15
- website_title: '',
16
- website_tagline: '',
17
- website_description: '',
18
- website_logo_url: '',
19
- website_url: ''
14
+ SettingsObject.create(title: "general", values: {
15
+ website_title: "",
16
+ website_tagline: "",
17
+ website_description: "",
18
+ website_logo_url: "",
19
+ website_url: ""
20
+ })
21
+ SettingsObject.create(title: "styles", values: {
22
+ css: ""
23
+ })
24
+ SettingsObject.create(title: "scripts", values: {
25
+ javascript: ""
20
26
  })
21
27
  end
22
28
  end
@@ -1,4 +1,7 @@
1
1
  <%= javascript_include_tag :application %>
2
+ <%= javascript_tag do %>
3
+ <%= @settings[:scripts]["javascript"].html_safe %>
4
+ <% end %>
2
5
 
3
6
  <%= yield :javascript %>
4
7
 
@@ -7,6 +7,9 @@
7
7
  <!-- ====================================================================== -->
8
8
  <meta name="viewport" content="initial-scale=1" />
9
9
  <%= stylesheet_link_tag :application, media: "all" %>
10
+ <style>
11
+ <%= @settings[:styles]["css"].html_safe %>
12
+ </style>
10
13
  </head>
11
14
  <body class="<%= body_class %>">
12
15
  <%= render 'header' %>
@@ -16,7 +19,6 @@
16
19
  </div>
17
20
 
18
21
  <%= render 'footer' %>
19
-
20
22
  <%= render 'javascript' %>
21
23
  </body>
22
24
  </html>
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ if [ "$*" == "" ]; then
4
+ echo "Please provide server host/ip, see: https://cloud.digitalocean.com/droplets"
5
+ exit 1
6
+ fi
7
+
8
+ HOST="$1"
9
+ GIT_URL=$(git config --get remote.origin.url)
10
+ SAFE_GIT_URL="${GIT_URL/git\@github.com\:/https://github.com/}"
11
+
12
+ if (ssh root@$HOST '[ -d ~rails/rails_project ]' ); then
13
+ ssh root@$HOST "bash -s" < ./bin/digital-ocean/update
14
+ else
15
+ ssh root@$HOST "bash -s" < ./bin/digital-ocean/setup "$SAFE_GIT_URL" "$HOST"
16
+ fi
@@ -0,0 +1,287 @@
1
+ #!/bin/sh
2
+
3
+ # -----------------------------------------------------------------------------
4
+ # Parameters
5
+ # -----------------------------------------------------------------------------
6
+ GIT_URL="$1"
7
+ HOST="$2"
8
+ MONGO_PASS=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
9
+
10
+ # -----------------------------------------------------------------------------
11
+ # Swap
12
+ # -----------------------------------------------------------------------------
13
+ echo "Adding swap"
14
+ fallocate -l 1G /swapfile
15
+ chmod 600 /swapfile
16
+ mkswap /swapfile
17
+ swapon /swapfile
18
+ echo "/swapfile none swap sw 0 0" >> /etc/fstab
19
+
20
+ apt-get update
21
+ locale-gen en_US.UTF-8
22
+ apt-get -y install libgmp3-dev
23
+ apt-get -y install imagemagick
24
+ apt-get -y install git-core
25
+ apt-get -y install nodejs
26
+
27
+ # -----------------------------------------------------------------------------
28
+ # MongoDB 3
29
+ # -----------------------------------------------------------------------------
30
+ # Add public key:
31
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
32
+ # Create a list file for MongoDB:
33
+ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
34
+ # ​Reload local package database:
35
+ apt-get update
36
+ echo "Installing Mongo DB"
37
+ apt-get install -y mongodb-org
38
+ export LC_ALL=C
39
+ # Create `rails` mongodb user in venice db:
40
+ mongo --eval "conn = new Mongo(); db = conn.getDB('venice'); db.createUser({user:'rails', pwd:'$MONGO_PASS', roles:['readWrite']})"
41
+
42
+ adduser rails --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-login
43
+
44
+ # -----------------------------------------------------------------------------
45
+ # Repository
46
+ # -----------------------------------------------------------------------------
47
+ # Clone git
48
+ cd ~rails
49
+ git clone $GIT_URL rails_project
50
+ cd ~rails/rails_project
51
+ # Fetch ruby version
52
+ RUBY_VERSION=$(grep 'ruby ' Gemfile | cut -d '"' -f 2)
53
+
54
+ # -----------------------------------------------------------------------------
55
+ # RVM
56
+ # -----------------------------------------------------------------------------
57
+ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
58
+ command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
59
+ curl -L get.rvm.io | bash -s stable
60
+ source /usr/local/rvm/scripts/rvm
61
+ rvm requirements
62
+ rvm install $RUBY_VERSION
63
+ rvm use $RUBY_VERSION --default
64
+ rvm rubygems current
65
+
66
+
67
+ gem install bundler
68
+ bundle install
69
+ ## Compile assets:
70
+ bundle exec rake assets:precompile
71
+
72
+ chown -R rails: /home/rails/rails_project
73
+
74
+ # -----------------------------------------------------------------------------
75
+ # Nginx
76
+ # -----------------------------------------------------------------------------
77
+ apt-get -y install nginx
78
+ cat <<EOT >> /etc/nginx/sites-available/rails
79
+ upstream app_server {
80
+ server unix:/var/run/unicorn.sock fail_timeout=0;
81
+ }
82
+
83
+ server {
84
+ listen 80;
85
+ root /home/rails/rails_project/public;
86
+ server_name _;
87
+ index index.htm index.html;
88
+
89
+ location / {
90
+ try_files \$uri/index.html \$uri.html \$uri @app;
91
+ }
92
+
93
+ location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)\$ {
94
+ try_files \$uri @app;
95
+ }
96
+
97
+ location @app {
98
+ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
99
+ proxy_set_header Host \$http_host;
100
+ proxy_redirect off;
101
+ proxy_pass http://app_server;
102
+ }
103
+ }
104
+ EOT
105
+ rm /etc/nginx/sites-enabled/default
106
+ ln -s /etc/nginx/sites-available/rails /etc/nginx/sites-enabled/rails
107
+
108
+ # -----------------------------------------------------------------------------
109
+ # Unicorn
110
+ # -----------------------------------------------------------------------------
111
+ mkdir /var/log/unicorn/
112
+ cat <<EOT >> /etc/unicorn.conf
113
+ listen "unix:/var/run/unicorn.sock"
114
+ worker_processes 4
115
+ user "rails"
116
+ working_directory "/home/rails/rails_project"
117
+ pid "/var/run/unicorn.pid"
118
+ stderr_path "/var/log/unicorn/unicorn.log"
119
+ stdout_path "/var/log/unicorn/unicorn.log"
120
+ EOT
121
+
122
+ SECRET_KEY_BASE=$(rake -f /home/rails/rails_project/Rakefile secret)
123
+ cat <<EOT >> /etc/default/rails_project
124
+ # Generate by running \`rake -f /home/rails/rails_project/Rakefile secret\`
125
+ export SECRET_KEY_BASE=$SECRET_KEY_BASE
126
+ export MONGODB_URI=mongodb://rails:$MONGO_PASS@127.0.0.1:27017/venice
127
+ export HOST=$HOST
128
+ export SMTP_ADDRESS=placeholder
129
+ export SMTP_DOMAIN=placeholder
130
+ export SMTP_PASSWORD=placeholder
131
+ export SMTP_USERNAME=placeholder
132
+ EOT
133
+ chmod +x /etc/default/rails_project
134
+
135
+ cat <<EOT >> /etc/default/unicorn
136
+ # Change paramentres below to appropriate values and set CONFIGURED to yes.
137
+ CONFIGURED=yes
138
+
139
+ # Default timeout until child process is killed during server upgrade,
140
+ # it has *no* relation to option "timeout" in server's config.rb.
141
+ TIMEOUT=30
142
+
143
+ # Path to your web application, sh'ld be also set in server's config.rb,
144
+ # option "working_directory". Rack's config.ru is located here.
145
+ APP_ROOT=/home/rails/rails_project
146
+
147
+ # Server's config.rb, it's not a rack's config.ru
148
+ CONFIG_RB=/etc/unicorn.conf
149
+
150
+ # Where to store PID, sh'ld be also set in server's config.rb, option "pid".
151
+ PID=/var/run/unicorn.pid
152
+ RAILS_ENV="production"
153
+ UNICORN_OPTS="-D -c \$CONFIG_RB -E \$RAILS_ENV"
154
+
155
+ RUBY_VERSION=$RUBY_VERSION
156
+ PATH=/usr/local/rvm/rubies/\$RUBY_VERSION/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/local/rvm/bin:/usr/local/rvm/gems/\$RUBY_VERSION@global/bin:/usr/local/rvm/gems/\$RUBY_VERSION/bin/
157
+ export GEM_HOME=/usr/local/rvm/gems/\$RUBY_VERSION
158
+ export GEM_PATH=/usr/local/rvm/gems/\$RUBY_VERSION:/usr/local/rvm/gems/\$RUBY_VERSION@global
159
+ DAEMON="\$APP_ROOT/bin/bundle exec unicorn"
160
+
161
+ . /etc/default/rails_project
162
+ EOT
163
+
164
+ cat <<EOT >> /etc/init.d/unicorn
165
+ #!/bin/sh
166
+ ### BEGIN INIT INFO
167
+ # Provides: unicorn
168
+ # Required-Start: \$local_fs \$remote_fs
169
+ # Required-Stop: \$local_fs \$remote_fs
170
+ # Default-Start: 2 3 4 5
171
+ # Default-Stop: 0 1 6
172
+ # Short-Description: unicorn initscript
173
+ # Description: unicorn
174
+ ### END INIT INFO
175
+
176
+ set -e
177
+ NAME=unicorn
178
+ DESC="Unicorn web server"
179
+
180
+ . /lib/lsb/init-functions
181
+
182
+ if [ -f /etc/default/unicorn ]; then
183
+ . /etc/default/unicorn
184
+ fi
185
+
186
+ PID=\${PID-/run/unicorn.pid}
187
+
188
+ run_by_init() {
189
+ ([ "\${previous-}" ] && [ "\${runlevel-}" ]) || [ "\${runlevel-}" = S ]
190
+ }
191
+
192
+ exit_with_message() {
193
+ if ! run_by_init; then
194
+ log_action_msg "\$1 Not starting."
195
+ fi
196
+ exit 0
197
+ }
198
+
199
+ check_config() {
200
+ if [ \$CONFIGURED != "yes" ]; then
201
+ exit_with_message "Unicorn is not configured (see /etc/default/unicorn)."
202
+ fi
203
+ }
204
+
205
+ check_app_root() {
206
+ if ! [ -d \$APP_ROOT ]; then
207
+ exit_with_message "Application directory \$APP_ROOT is not exist."
208
+ fi
209
+ }
210
+
211
+ set -u
212
+
213
+ case "\$1" in
214
+ start)
215
+ check_config
216
+ check_app_root
217
+
218
+ log_daemon_msg "Starting \$DESC" \$NAME || true
219
+ if start-stop-daemon --start --quiet --oknodo --pidfile \$PID --exec \$DAEMON -- \$UNICORN_OPTS; then
220
+ log_end_msg 0 || true
221
+ else
222
+ log_end_msg 1 || true
223
+ fi
224
+ ;;
225
+ stop)
226
+ log_daemon_msg "Stopping \$DESC" \$NAME || true
227
+ if start-stop-daemon --stop --signal QUIT --quiet --oknodo --pidfile \$PID; then
228
+ log_end_msg 0 || true
229
+ else
230
+ log_end_msg 1 || true
231
+ fi
232
+ ;;
233
+ force-stop)
234
+ log_daemon_msg "Forcing stop of \$DESC" \$NAME || true
235
+ if start-stop-daemon --stop --quiet --oknodo --pidfile \$PID; then
236
+ log_end_msg 0 || true
237
+ else
238
+ log_end_msg 1 || true
239
+ fi
240
+ ;;
241
+ restart|force-reload)
242
+ log_daemon_msg "Restarting \$DESC" \$NAME || true
243
+ start-stop-daemon --stop --quiet --oknodo --pidfile \$PID
244
+ sleep 1
245
+ if start-stop-daemon --start --quiet --oknodo --pidfile \$PID --exec \$DAEMON -- \$UNICORN_OPTS; then
246
+ log_end_msg 0 || true
247
+ else
248
+ log_end_msg 1 || true
249
+ fi
250
+ ;;
251
+ reload)
252
+ log_daemon_msg "Reloading \$DESC" \$NAME || true
253
+ if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile \$PID; then
254
+ log_end_msg 0 || true
255
+ else
256
+ log_end_msg 1 || true
257
+ fi
258
+ ;;
259
+ reopen-logs)
260
+ log_daemon_msg "Relopening log files of \$DESC" \$NAME || true
261
+ if start-stop-daemon --stop --signal USR1 --quiet --oknodo --pidfile \$PID; then
262
+ log_end_msg 0 || true
263
+ else
264
+ log_end_msg 1 || true
265
+ fi
266
+ ;;
267
+ status)
268
+ status_of_proc -p \$PID \$DAEMON \$NAME && exit 0 || exit \$?
269
+ ;;
270
+ *)
271
+ log_action_msg "Usage: \$0 <start|stop|restart|force-reload|reload|force-stop|reopen-logs|status>" || true
272
+ exit 1
273
+ ;;
274
+ esac
275
+ EOT
276
+
277
+ chmod +x /etc/init.d/unicorn
278
+ # adds unicorn to rc.d links
279
+ update-rc.d unicorn defaults
280
+ service unicorn start
281
+ service nginx restart
282
+
283
+ # -----------------------------------------------------------------------------
284
+ # Seed
285
+ # -----------------------------------------------------------------------------
286
+ source /etc/default/unicorn
287
+ RAILS_ENV=production rake db:seed
@@ -0,0 +1,13 @@
1
+ #!/bin/sh
2
+
3
+ source /etc/default/unicorn
4
+
5
+ cd ~rails/rails_project
6
+ git pull
7
+
8
+ bin/bundle install
9
+ bin/bundle exec rake assets:precompile
10
+
11
+ chown -R rails ./
12
+
13
+ service unicorn restart
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env sh
2
+
3
+ if [ "$1" == "" ] || [ "$2" == "" ]; then
4
+ echo "Usage: add-s3 <aws_key> <aws_secret> [aws_region]"
5
+ exit 1
6
+ fi
7
+
8
+ HOST=$(heroku config:get HOST)
9
+ BUCKET="${HOST/.herokuapp.com/}"
10
+ KEY="$1"
11
+ SECRET="$2"
12
+ REGION="$3"
13
+
14
+ echo "Creating S3 bucket: $BUCKET"
15
+ VARS=$(rake deploy:create_s3_bucket key="${KEY}" secret="${SECRET}" bucket="${BUCKET}" region="${REGION}")
16
+ arr=(${VARS//\\n/ })
17
+ AWS_ACCESS_KEY_ID="${arr[0]}"
18
+ AWS_SECRET_ACCESS_KEY="${arr[1]}"
19
+
20
+ echo "Adding S3 credentials to Heroku app ENV"
21
+ heroku config:set AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
22
+ AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
23
+ FOG_DIRECTORY="${BUCKET}"
@@ -3,14 +3,18 @@
3
3
  if git remote | grep heroku > /dev/null; then
4
4
  git push heroku master
5
5
  else
6
- read -p "Please provide Heroku application name: " APP_NAME
6
+ APP_NAME="$1"
7
+ REGION="$2"
7
8
 
8
9
  if [ APP_NAME == "" ]; then
9
- echo "¯\_(ツ)_/¯"
10
- exit 1
10
+ read -p "Please provide Heroku application name: " APP_NAME
11
+ if [ APP_NAME == "" ]; then
12
+ echo "¯\_(ツ)_/¯"
13
+ exit 1
14
+ fi
11
15
  fi
12
16
 
13
- heroku create "${APP_NAME}"
17
+ heroku apps:create "${APP_NAME}" --region "${REGION}"
14
18
  heroku git:remote -a "${APP_NAME}"
15
19
  heroku config:set SMTP_ADDRESS=smtp.sendgrid.net \
16
20
  SMTP_DOMAIN=heroku.com \
data/bin/setup CHANGED
@@ -18,7 +18,7 @@ sed -i.bak "s/venice_development/${DEV_DB_NAME}/g" config/mongoid.yml
18
18
  rm config/mongoid.yml.bak
19
19
 
20
20
  # Seed data
21
- rake db:seed
21
+ bundle exec rake db:seed
22
22
 
23
23
  # Remove Git remote if it's still the venice repo (after cloning)
24
24
  if [ "$(git config --get remote.origin.url)" = "git@github.com:alexkravets/venice.git" ]; then
@@ -0,0 +1,93 @@
1
+ namespace :deploy do
2
+ desc "Create new AWS S3 bucket"
3
+ task :create_s3_bucket => :environment do
4
+ require 'aws-sdk'
5
+
6
+ @access_key_id = ENV["key"]
7
+ @secret_access_key = ENV["secret"]
8
+ @bucket_name = ENV["bucket"]
9
+ @region = ENV["region"].presence || "us-east-1"
10
+ @user_name = @bucket_name
11
+
12
+ connect_aws
13
+ create_bucket
14
+ add_cors_to_bucket
15
+ create_aws_user
16
+ create_user_access_key
17
+ add_user_policy
18
+
19
+ ## Results
20
+ puts @new_access_key_id
21
+ puts @new_secret_access_key
22
+ end
23
+
24
+ def connect_aws
25
+ credentials = Aws::Credentials.new(@access_key_id, @secret_access_key)
26
+ Aws.config.update(region: @region, credentials: credentials)
27
+ @iam = Aws::IAM::Client.new
28
+ @s3 = Aws::S3::Client.new
29
+ end
30
+
31
+ def create_bucket
32
+ @s3.create_bucket(
33
+ bucket: @bucket_name,
34
+ create_bucket_configuration: { location_constraint: @region }
35
+ )
36
+ end
37
+
38
+ def add_cors_to_bucket
39
+ @s3.put_bucket_cors(
40
+ bucket: @bucket_name,
41
+ cors_configuration: {
42
+ cors_rules: [
43
+ {
44
+ allowed_headers: ["Authorization", "content"],
45
+ allowed_methods: ["GET"],
46
+ allowed_origins: ["*"],
47
+ max_age_seconds: 3000
48
+ }
49
+ ]
50
+ }
51
+ )
52
+ end
53
+
54
+ def create_aws_user
55
+ @iam.create_user(user_name: @user_name)
56
+ end
57
+
58
+ def create_user_access_key
59
+ resp = @iam.create_access_key(user_name: @user_name)
60
+ @new_access_key_id = resp.access_key.access_key_id
61
+ @new_secret_access_key = resp.access_key.secret_access_key
62
+ end
63
+
64
+ def add_user_policy
65
+ policy = {
66
+ "Statement": [
67
+ {
68
+ "Action": [
69
+ "s3:ListAllMyBuckets"
70
+ ],
71
+ "Effect": "Allow",
72
+ "Resource": "arn:aws:s3:::*"
73
+ },
74
+ {
75
+ "Action": "s3:*",
76
+ "Effect": "Allow",
77
+ "Resource": "arn:aws:s3:::#{@bucket_name}"
78
+ },
79
+ {
80
+ "Action": "s3:*",
81
+ "Effect": "Allow",
82
+ "Resource": "arn:aws:s3:::#{@bucket_name}/*"
83
+ }
84
+ ]
85
+ }
86
+
87
+ @iam.put_user_policy(
88
+ user_name: @user_name,
89
+ policy_name: "#{@bucket_name}_heroku",
90
+ policy_document: policy.to_json
91
+ )
92
+ end
93
+ end
@@ -0,0 +1,6 @@
1
+ namespace :settings do
2
+ desc "Clear settings objects"
3
+ task :clear => :environment do
4
+ SettingsObject.delete_all
5
+ end
6
+ end
@@ -25,10 +25,25 @@ module Venice
25
25
  system "bin/setup"
26
26
  end
27
27
 
28
- desc "deploy", "Deploys the site to Heroku"
29
- def deploy(platform = "heroku")
30
- puts "Deploying the site to Heroku"
31
- system "bin/deploy-#{platform}"
28
+ desc "deploy", "Deploys the project to heroku or digital-ocean"
29
+ def deploy(platform = "heroku", target = "")
30
+ puts "Deploying the project"
31
+ if platform == "heroku"
32
+ target = {
33
+ "" => "us",
34
+ "us-east-1" => "us",
35
+ "eu-west-1" => "eu"
36
+ }[target]
37
+
38
+ if target.nil?
39
+ puts "Please provide correct target parameter."
40
+ puts "Available options are:"
41
+ puts " us-east-1"
42
+ puts " eu-west-1"
43
+ exit
44
+ end
45
+ end
46
+ system "bin/#{platform}/deploy #{target}".strip
32
47
  end
33
48
 
34
49
  desc "version", "Show Venice version"
@@ -1,3 +1,3 @@
1
1
  module Venice
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venice-chr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-23 00:00:00.000000000 Z
11
+ date: 2015-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - ".hound.yml"
66
66
  - ".ruby-style.yml"
67
67
  - ".scss-style.yml"
68
+ - CONTRIBUTING.md
68
69
  - Gemfile
69
70
  - Gemfile.lock
70
71
  - Procfile
@@ -79,7 +80,9 @@ files:
79
80
  - app/assets/images/.keep
80
81
  - app/assets/javascripts/admin.coffee
81
82
  - app/assets/javascripts/admin/settings/config.coffee
83
+ - app/assets/javascripts/admin/settings/css.coffee
82
84
  - app/assets/javascripts/admin/settings/general.coffee
85
+ - app/assets/javascripts/admin/settings/js.coffee
83
86
  - app/assets/javascripts/application.coffee
84
87
  - app/assets/stylesheets/admin.scss
85
88
  - app/assets/stylesheets/application.scss
@@ -115,7 +118,11 @@ files:
115
118
  - app/views/layouts/admin.html.erb
116
119
  - app/views/layouts/application.html.erb
117
120
  - bin/bundle
118
- - bin/deploy-heroku
121
+ - bin/digital-ocean/deploy
122
+ - bin/digital-ocean/setup
123
+ - bin/digital-ocean/update
124
+ - bin/heroku/add-s3
125
+ - bin/heroku/deploy
119
126
  - bin/rails
120
127
  - bin/rake
121
128
  - bin/setup
@@ -152,7 +159,8 @@ files:
152
159
  - config/unicorn.rb
153
160
  - db/seeds.rb
154
161
  - lib/assets/.keep
155
- - lib/tasks/.keep
162
+ - lib/tasks/deploy/create_s3_bucket.rake
163
+ - lib/tasks/settings_clear.rake
156
164
  - lib/venice.rb
157
165
  - lib/venice/kit.rb
158
166
  - lib/venice/version.rb
@@ -184,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
192
  version: '0'
185
193
  requirements: []
186
194
  rubyforge_project:
187
- rubygems_version: 2.4.5.1
195
+ rubygems_version: 2.5.1
188
196
  signing_key:
189
197
  specification_version: 4
190
198
  summary: Blog boilerplate for Character based website
File without changes