-
Notifications
You must be signed in to change notification settings - Fork 3
/
atom.xml
2267 lines (1624 loc) · 125 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Cahyadi Triyansyah (SunDi3yansyah)]]></title>
<link href="http://sundi3yansyah.github.io/atom.xml" rel="self"/>
<link href="http://sundi3yansyah.github.io/"/>
<updated>2023-12-28T22:07:32+07:00</updated>
<id>http://sundi3yansyah.github.io/</id>
<author>
<name><![CDATA[Cahyadi Triyansyah]]></name>
<email><![CDATA[[email protected]]]></email>
</author>
<generator uri="https://ruby-lang.org/">Ruby</generator>
<entry>
<title type="html"><![CDATA[Perkenalan Dengan Gemfile Pada Ruby Atau Ruby on Rails]]></title>
<link href="http://sundi3yansyah.github.io/article/2017/07/26/perkenalan-dengan-gemfile-pada-ruby-atau-ruby-on-rails/"/>
<updated>2017-07-26T17:55:42+07:00</updated>
<id>http://sundi3yansyah.github.io/article/2017/07/26/perkenalan-dengan-gemfile-pada-ruby-atau-ruby-on-rails</id>
<content type="html"><![CDATA[<h3>Apa itu Gemfile?</h3>
<p>Gemfile adalah file konfigurasi pada bahasa pemrograman ruby, semua dependensi gem atau kebanyakan orang menyebutnya adalah library atau perpustakaan yang dapat kita temukan di <a href="https://rubygems.org">RubyGems</a>. Siapaun dapat membuat, menambah, mengolah gem milik kalian bahkan kita juga dapat berkolaborasi di hosting git. Sedangkan pengoprasiannya dapat dilakukan dengan <a href="http://bundler.io">bundler</a> dan perintahnya menggunakan <code>bundle</code>.</p>
<!-- more -->
<p>Jika kita ingin membuat sebuah proyek berbasis bahasa ruby biasanya Gemfile akan selalu dipakai mungkin malah harus menggunakannya.</p>
<p>Saya disini tidak akan membahasa tentang cara penggunaan gem pada situs rubygems.org, tapi lebih bagaimana mendefinisikan isi dari Gemfile pada bahasa ruby.</p>
<p>Yang pertama kita harus menginisialiasi sumber atau source alamat yang akan kita gunakan, sebagai contoh:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>source 'https://rubygems.org'</span></code></pre></td></tr></table></div></figure>
<p>Yang selenjutnya adalah bagaimana kita mendefinisikan gem yang akan kita gunakan, jadi misal kita ingin menggunakan gem <a href="https://rubygems.org/gems/json"><strong>json</strong></a> maka:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>gem 'json'</span></code></pre></td></tr></table></div></figure>
<ul>
<li><strong>gem</strong> adalah perintah untuk memanggila nama gem tersebut</li>
<li><strong>json</strong> dari mana? json adalah nama yang diambil dari situs resminya rubygems.org disini <a href="https://rubygems.org/gems/json">https://rubygems.org/gems/json</a></li>
</ul>
<p>Yang selanjutnya adalah bagaimana jika kita ingin mendefinisikan versinya juga? karena setiap gem itu memiliki versi, contoh diatas tidak mendefinisikan versi maka akan menggunakan versi yang terbaru. Jika kita ingin mendefinisikan dengan versinya maka:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>gem 'json', '2.1.0'</span></code></pre></td></tr></table></div></figure>
<p>atau</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>gem 'json', '~> 2.1.0'</span></code></pre></td></tr></table></div></figure>
<ul>
<li><strong>~></strong> adalah operator yang berarti sama dengan</li>
<li><strong>2.1.0</strong> adalah nilai dari versinya, nilai versi ini harus tersedia di <a href="https://rubygems.org/gems/json,">https://rubygems.org/gems/json,</a> kalian bisa melihat dibagian <strong>VERSION</strong>, saya mengambil versi yang terbaru saat ini.</li>
</ul>
<p>Adapun operator lain yang dapat digunakan:</p>
<ul>
<li><strong>>=</strong> adalah operator yang berarti lebih besar atau sama dengan</li>
<li><strong><</strong> adalah operator yang berarti lebih kecil</li>
</ul>
<p>Yang selanjutnya kita mengenal group, mungkin kalian akan langsung paham jika melihat kode dibawah:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>group :development do
</span><span class='line'> gem 'json'
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>
<p>Kita bisa melihat kode diatas bahwa <code>gem 'json'</code> diapit oleh <code>group :development</code>, development yang artinya bahwa gem json hanya dapat digunakan pada environment development.</p>
<p>Selain group <strong>development</strong> kita bisa juga menggunakan group <strong>production</strong> dan <strong>test</strong></p>
<p>Sekarang saya kenalkan Gemfile milik Rails versi 5.1.2</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>source 'https://rubygems.org'
</span><span class='line'>
</span><span class='line'>git_source(:github) do |repo_name|
</span><span class='line'> repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
</span><span class='line'> "https://github.com/#{repo_name}.git"
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>
</span><span class='line'># Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
</span><span class='line'>gem 'rails', '~> 5.1.2'
</span><span class='line'># Use sqlite3 as the database for Active Record
</span><span class='line'>gem 'sqlite3'
</span><span class='line'># Use Puma as the app server
</span><span class='line'>gem 'puma', '~> 3.7'
</span><span class='line'># Use SCSS for stylesheets
</span><span class='line'>gem 'sass-rails', '~> 5.0'
</span><span class='line'># Use Uglifier as compressor for JavaScript assets
</span><span class='line'>gem 'uglifier', '>= 1.3.0'
</span><span class='line'># See https://github.com/rails/execjs#readme for more supported runtimes
</span><span class='line'># gem 'therubyracer', platforms: :ruby
</span><span class='line'>
</span><span class='line'># Use CoffeeScript for .coffee assets and views
</span><span class='line'>gem 'coffee-rails', '~> 4.2'
</span><span class='line'># Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
</span><span class='line'>gem 'turbolinks', '~> 5'
</span><span class='line'># Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
</span><span class='line'>gem 'jbuilder', '~> 2.5'
</span><span class='line'># Use Redis adapter to run Action Cable in production
</span><span class='line'># gem 'redis', '~> 3.0'
</span><span class='line'># Use ActiveModel has_secure_password
</span><span class='line'># gem 'bcrypt', '~> 3.1.7'
</span><span class='line'>
</span><span class='line'># Use Capistrano for deployment
</span><span class='line'># gem 'capistrano-rails', group: :development
</span><span class='line'>
</span><span class='line'>group :development, :test do
</span><span class='line'> # Call 'byebug' anywhere in the code to stop execution and get a debugger console
</span><span class='line'> gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
</span><span class='line'> # Adds support for Capybara system testing and selenium driver
</span><span class='line'> gem 'capybara', '~> 2.13'
</span><span class='line'> gem 'selenium-webdriver'
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>group :development do
</span><span class='line'> # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
</span><span class='line'> gem 'web-console', '>= 3.3.0'
</span><span class='line'> gem 'listen', '>= 3.0.5', '< 3.2'
</span><span class='line'> # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
</span><span class='line'> gem 'spring'
</span><span class='line'> gem 'spring-watcher-listen', '~> 2.0.0'
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'># Windows does not include zoneinfo files, so bundle the tzinfo-data gem
</span><span class='line'>gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]</span></code></pre></td></tr></table></div></figure>
<p>Maka dari sini saya rasa anda cukup bisa memahaminya, ya kan? Yes…</p>
<p>Namun kita lihat disana ada <strong>platforms</strong> yang belum kita definisikan, kita ambil kutipan kode diatas:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>group :development, :test do
</span><span class='line'> gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>
<p>Gem <strong>byebug</strong> akan digunakan oleh nilai array yang ada didalam <strong>platforms</strong>.</p>
<p>Dan satu lagi, dari kutipan kode dibawah ini:</p>
<figure class='code'><figcaption><span>Gemfile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git_source(:github) do |repo_name|
</span><span class='line'> repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
</span><span class='line'> "https://github.com/#{repo_name}.git"
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>
<p>Bahwa source dapat diambil dari hosting git langsung yaitu GitHub. Revisi kode pada Gemfile ini baru muncul di Rails versi 5 keatas.</p>
<p>Sebenarnya masih ada beberapa fungsi yang bisa digunakan di Gemfile ini, tapi saya rasa bacaan ini cukup sekian dulu lah ya ^_^, nantikan bacaan saya selanjutnya tentang Ruby / Ruby on Rails ataupun pengetahuan lainnya.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Menggunakan Subdomain Untuk Assets Pada Rails]]></title>
<link href="http://sundi3yansyah.github.io/article/2017/07/25/menggunakan-subdomain-untuk-assets-pada-rails/"/>
<updated>2017-07-25T14:47:25+07:00</updated>
<id>http://sundi3yansyah.github.io/article/2017/07/25/menggunakan-subdomain-untuk-assets-pada-rails</id>
<content type="html"><![CDATA[<p>Disini saya akan mencoba memberikan pengalaman saya bagaimana cara menggunakan subdomain untuk assets pada Rails, saya selalu menggunakan subdomain untuk memisahkan asset file pada aplikasi Rails tentunya untuk production, kebetulan ada beberapa teman saya yang minta panduan gimana sih caranya bikin kaya gitu.</p>
<!-- more -->
<p>Loh keuntunganya apa? Sebaiknya kalian cari tau dulu gih…</p>
<p>Saya enggak tau mau cerita apa lagi ;v langsung ke langkah-langkahnya aja ya.</p>
<p>Asumsikan ini untuk:</p>
<ul>
<li>Environment production.</li>
<li>Aplikasi rails yang sudah siap disajikan.</li>
</ul>
<p>Buka file <code>config/environments/production.rb</code> dan cari bagian baris seperti ini:</p>
<figure class='code'><figcaption><span>Editor </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># config.action_controller.asset_host = 'http://assets.example.com'</span></code></pre></td></tr></table></div></figure>
<p>Rubahlah menjadi seperti ini:</p>
<figure class='code'><figcaption><span>Editor </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>config.action_controller.asset_host = 'http://assets.domain.tld'</span></code></pre></td></tr></table></div></figure>
<ul>
<li>Tentukan protokol apakah menggunkan SSL atau tidak.</li>
<li>Tentukan domain TLD dan string subdomain yang digunakan.</li>
</ul>
<p>Jadi jika kalian masih dalam development maka akan tetap menggunakan <a href="http://localhost:port,">http://localhost:port,</a> sedangkan jika sudah dalam production akan menjadi <a href="http://assets.domain.tld">http://assets.domain.tld</a> secara otomatis dengan syarat kalian harus selalu menggunakan helper assets bawaan Rails.</p>
<p>Sebagai contoh untuk memanggil assets CSS menggunakan tag <code>stylesheet_link_tag</code>, memanggil assets JS menggunakan tag <code>javascript_include_tag</code> dan tag-tag asset lainnya. Kalian tidak boleh memanggil alamat assets tanpa menggunakan tag helper bawaan Rails.</p>
<p>Untuk tahap production assets harus di precompile, kan perintahnya seperti ini:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>bundle exec rake assets:precompile RAILS_ENV=production</span></code></pre></td></tr></table></div></figure>
<p>Atau</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails assets:precompile RAILS_ENV=production</span></code></pre></td></tr></table></div></figure>
<p>Nah sampai disini destinasi assets akan berada di <code>public/assets/</code></p>
<p>Tugas kita selanjutnya hanya memindahkan assets tersebut ke document root untuk subdomain yang sudah kita tentukan, dengan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>mv public/assets/ ../assets-domain-tld/ -f</span></code></pre></td></tr></table></div></figure>
<p>Perintah bash diatas adalah asumsi jika document root assets setara dengan direktori root rails.
Untuk codeblock konfigurasi virtual host web server yang kita gunakan adalah statis.</p>
<p>Karena saya sudah terbiasa dengan web server nginx maka saya akan kasih contoh server block sebagai berikut:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>server {
</span><span class='line'> listen 80;
</span><span class='line'> server_name assets.domain.tld;
</span><span class='line'>
</span><span class='line'> add_header X-Frame-Options SAMEORIGIN;
</span><span class='line'> add_header X-Content-Type-Options nosniff;
</span><span class='line'> add_header X-XSS-Protection "1; mode=block";
</span><span class='line'>
</span><span class='line'> root /path/assets-domain-tld;
</span><span class='line'> index index.html;
</span><span class='line'>
</span><span class='line'> location / {
</span><span class='line'> try_files $uri $uri/ =404;
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'> location ~ \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
</span><span class='line'> expires 30d;
</span><span class='line'> add_header Pragma public;
</span><span class='line'> add_header Cache-Control "public";
</span><span class='line'> add_header ETag "";
</span><span class='line'> log_not_found off;
</span><span class='line'> access_log off;
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'> location ~ \.(eot|ttf|woff|woff2|svg|json)$ {
</span><span class='line'> add_header Access-Control-Allow-Origin *;
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'> location ~ \.(git|sh)?$ {
</span><span class='line'> deny all;
</span><span class='line'> log_not_found off;
</span><span class='line'> access_log off;
</span><span class='line'> }
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
<p>Untuk selanjutnya silakan kalian kembangkan sendiri cara praktis deployement untuk cara-cara diatas, karena saya tidak tau keterbiasaan kalian itu gimana jadi ya silakan gunakan metode kalian sendiri.</p>
<p>Tutorial selanjutnya adalah bagaimana jika untuk file upload dijadikan subdomain juga ^_^</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Memulai Dengan Rails]]></title>
<link href="http://sundi3yansyah.github.io/article/2017/07/25/memulai-dengan-rails/"/>
<updated>2017-07-25T14:43:55+07:00</updated>
<id>http://sundi3yansyah.github.io/article/2017/07/25/memulai-dengan-rails</id>
<content type="html"><![CDATA[<p>Sebelumnya kita udah tau bagaimana cara instal Ruby, bagaimana cara instal Rails, nah kali ini bagaimana cara memulai menggunakan Rails intinya artikel ini menganalkan struktur komponen yang ada di Rails.</p>
<!-- more -->
<p>Pada dasarnya Rails memiliki struktur kerangka kerja sebagai berikut:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>.
</span><span class='line'>├── app
</span><span class='line'>│ ├── assets
</span><span class='line'>│ │ ├── config
</span><span class='line'>│ │ ├── images
</span><span class='line'>│ │ ├── javascripts
</span><span class='line'>│ │ │ └── channels
</span><span class='line'>│ │ └── stylesheets
</span><span class='line'>│ ├── channels
</span><span class='line'>│ │ └── application_cable
</span><span class='line'>│ ├── controllers
</span><span class='line'>│ │ └── concerns
</span><span class='line'>│ ├── helpers
</span><span class='line'>│ ├── jobs
</span><span class='line'>│ ├── mailers
</span><span class='line'>│ ├── models
</span><span class='line'>│ │ └── concerns
</span><span class='line'>│ └── views
</span><span class='line'>│ └── layouts
</span><span class='line'>├── bin
</span><span class='line'>├── config
</span><span class='line'>│ ├── environments
</span><span class='line'>│ ├── initializers
</span><span class='line'>│ └── locales
</span><span class='line'>├── db
</span><span class='line'>├── lib
</span><span class='line'>│ ├── assets
</span><span class='line'>│ └── tasks
</span><span class='line'>├── log
</span><span class='line'>├── public
</span><span class='line'>├── test
</span><span class='line'>│ ├── controllers
</span><span class='line'>│ ├── fixtures
</span><span class='line'>│ │ └── files
</span><span class='line'>│ ├── helpers
</span><span class='line'>│ ├── integration
</span><span class='line'>│ ├── mailers
</span><span class='line'>│ ├── models
</span><span class='line'>│ └── system
</span><span class='line'>├── tmp
</span><span class='line'>│ └── cache
</span><span class='line'>│ └── assets
</span><span class='line'>└── vendor</span></code></pre></td></tr></table></div></figure>
<p>Secara keseluruhan memiliki struktur sebagai berikut:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
<span class='line-number'>56</span>
<span class='line-number'>57</span>
<span class='line-number'>58</span>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
<span class='line-number'>62</span>
<span class='line-number'>63</span>
<span class='line-number'>64</span>
<span class='line-number'>65</span>
<span class='line-number'>66</span>
<span class='line-number'>67</span>
<span class='line-number'>68</span>
<span class='line-number'>69</span>
<span class='line-number'>70</span>
<span class='line-number'>71</span>
<span class='line-number'>72</span>
<span class='line-number'>73</span>
<span class='line-number'>74</span>
<span class='line-number'>75</span>
<span class='line-number'>76</span>
<span class='line-number'>77</span>
<span class='line-number'>78</span>
<span class='line-number'>79</span>
<span class='line-number'>80</span>
<span class='line-number'>81</span>
<span class='line-number'>82</span>
<span class='line-number'>83</span>
<span class='line-number'>84</span>
<span class='line-number'>85</span>
<span class='line-number'>86</span>
<span class='line-number'>87</span>
<span class='line-number'>88</span>
<span class='line-number'>89</span>
<span class='line-number'>90</span>
<span class='line-number'>91</span>
<span class='line-number'>92</span>
<span class='line-number'>93</span>
<span class='line-number'>94</span>
<span class='line-number'>95</span>
<span class='line-number'>96</span>
<span class='line-number'>97</span>
<span class='line-number'>98</span>
<span class='line-number'>99</span>
<span class='line-number'>100</span>
<span class='line-number'>101</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>.
</span><span class='line'>├── app
</span><span class='line'>│ ├── assets
</span><span class='line'>│ │ ├── config
</span><span class='line'>│ │ │ └── manifest.js
</span><span class='line'>│ │ ├── images
</span><span class='line'>│ │ ├── javascripts
</span><span class='line'>│ │ │ ├── application.js
</span><span class='line'>│ │ │ ├── cable.js
</span><span class='line'>│ │ │ └── channels
</span><span class='line'>│ │ └── stylesheets
</span><span class='line'>│ │ └── application.css
</span><span class='line'>│ ├── channels
</span><span class='line'>│ │ └── application_cable
</span><span class='line'>│ │ ├── channel.rb
</span><span class='line'>│ │ └── connection.rb
</span><span class='line'>│ ├── controllers
</span><span class='line'>│ │ ├── application_controller.rb
</span><span class='line'>│ │ └── concerns
</span><span class='line'>│ ├── helpers
</span><span class='line'>│ │ └── application_helper.rb
</span><span class='line'>│ ├── jobs
</span><span class='line'>│ │ └── application_job.rb
</span><span class='line'>│ ├── mailers
</span><span class='line'>│ │ └── application_mailer.rb
</span><span class='line'>│ ├── models
</span><span class='line'>│ │ ├── application_record.rb
</span><span class='line'>│ │ └── concerns
</span><span class='line'>│ └── views
</span><span class='line'>│ └── layouts
</span><span class='line'>│ ├── application.html.erb
</span><span class='line'>│ ├── mailer.html.erb
</span><span class='line'>│ └── mailer.text.erb
</span><span class='line'>├── bin
</span><span class='line'>│ ├── bundle
</span><span class='line'>│ ├── rails
</span><span class='line'>│ ├── rake
</span><span class='line'>│ ├── setup
</span><span class='line'>│ ├── spring
</span><span class='line'>│ ├── update
</span><span class='line'>│ └── yarn
</span><span class='line'>├── config
</span><span class='line'>│ ├── application.rb
</span><span class='line'>│ ├── boot.rb
</span><span class='line'>│ ├── cable.yml
</span><span class='line'>│ ├── database.yml
</span><span class='line'>│ ├── environment.rb
</span><span class='line'>│ ├── environments
</span><span class='line'>│ │ ├── development.rb
</span><span class='line'>│ │ ├── production.rb
</span><span class='line'>│ │ └── test.rb
</span><span class='line'>│ ├── initializers
</span><span class='line'>│ │ ├── application_controller_renderer.rb
</span><span class='line'>│ │ ├── assets.rb
</span><span class='line'>│ │ ├── backtrace_silencers.rb
</span><span class='line'>│ │ ├── cookies_serializer.rb
</span><span class='line'>│ │ ├── filter_parameter_logging.rb
</span><span class='line'>│ │ ├── inflections.rb
</span><span class='line'>│ │ ├── mime_types.rb
</span><span class='line'>│ │ └── wrap_parameters.rb
</span><span class='line'>│ ├── locales
</span><span class='line'>│ │ └── en.yml
</span><span class='line'>│ ├── puma.rb
</span><span class='line'>│ ├── routes.rb
</span><span class='line'>│ ├── secrets.yml
</span><span class='line'>│ └── spring.rb
</span><span class='line'>├── config.ru
</span><span class='line'>├── db
</span><span class='line'>│ └── seeds.rb
</span><span class='line'>├── Gemfile
</span><span class='line'>├── Gemfile.lock
</span><span class='line'>├── lib
</span><span class='line'>│ ├── assets
</span><span class='line'>│ └── tasks
</span><span class='line'>├── log
</span><span class='line'>├── package.json
</span><span class='line'>├── public
</span><span class='line'>│ ├── 404.html
</span><span class='line'>│ ├── 422.html
</span><span class='line'>│ ├── 500.html
</span><span class='line'>│ ├── apple-touch-icon.png
</span><span class='line'>│ ├── apple-touch-icon-precomposed.png
</span><span class='line'>│ ├── favicon.ico
</span><span class='line'>│ └── robots.txt
</span><span class='line'>├── Rakefile
</span><span class='line'>├── README.md
</span><span class='line'>├── test
</span><span class='line'>│ ├── application_system_test_case.rb
</span><span class='line'>│ ├── controllers
</span><span class='line'>│ ├── fixtures
</span><span class='line'>│ │ └── files
</span><span class='line'>│ ├── helpers
</span><span class='line'>│ ├── integration
</span><span class='line'>│ ├── mailers
</span><span class='line'>│ ├── models
</span><span class='line'>│ ├── system
</span><span class='line'>│ └── test_helper.rb
</span><span class='line'>├── tmp
</span><span class='line'>│ └── cache
</span><span class='line'>│ └── assets
</span><span class='line'>└── vendor</span></code></pre></td></tr></table></div></figure>
<p>Ini adalah untuk versi <strong>Rails 5.1.2</strong>, akan saya jabarkan sedikit tentang fungsi sebagaian file atau folder yang berada di root dokumen Rails tersebut.</p>
<ul>
<li><strong>app</strong> berisi assets, channels, controllers, helpers, jobs, mailers, models, views. Kalian akan lebih banyak untuk membuat codingan disini.</li>
<li><strong>bin</strong> berisi script rails yang digunakan untuk menyiapkan, memperbarui, menyebarkan, atau menjalankan aplikasi.</li>
<li><strong>config</strong> berisi konfigurasi aplikasi, database, dan masih banyak lagi.</li>
<li><strong>config.ru</strong> konfigurasi untuk server berbasis Rack yang digunakan untuk memulai aplikasi.</li>
<li><strong>db</strong> berisi skema database kalian saat ini, serta migrasi database.</li>
<li><strong>Gemfile & Gemfile.lock</strong> file ini memungkinkan kalian menentukan dependensi gem apa yang dibutuhkan untuk aplikasi Rails kalian, file ini digunakan oleh gem Bundler.</li>
<li><strong>lib</strong> modul yang diperluas untuk aplikasi kalian.</li>
<li><strong>log</strong> file log aplikasi.</li>
<li><strong>package.json</strong> file ini untuk kolaborasi dengan nodejs, file ini baru saja di tambahkan di rails versi 5.1 keatas.</li>
<li><strong>public</strong> satu-satunya folder yang dilihat oleh client. Berisi file statis dan asset yang dikompilasi.</li>
<li><strong>Rakefile</strong> file ini menempatkan dan memuat perintah yang bisa dijalankan dari command line atau terminal.</li>
<li><strong>README.md</strong> ini adalah instruksi manual singkat untuk aplikasi kalian.</li>
<li><strong>test</strong> tes unit, perlengkapan, dan alat uji lainnya.</li>
<li><strong>tmp</strong> file sementara (seperti cache dan file pid).</li>
<li><strong>vendor</strong> tempat untuk semua kode pihak ketiga, ini termasuk gem yang telah dipatenkan.</li>
<li><strong>.gitignore</strong> file ini memberitahu git file mana yang harus diabaikan.</li>
</ul>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Cara Install Rails]]></title>
<link href="http://sundi3yansyah.github.io/article/2017/07/25/cara-install-rails/"/>
<updated>2017-07-25T14:40:21+07:00</updated>
<id>http://sundi3yansyah.github.io/article/2017/07/25/cara-install-rails</id>
<content type="html"><![CDATA[<h3>Apa itu Rails?</h3>
<blockquote><p>Ruby on Rails, disebut juga Rails, adalah sebuah kerangka kerja aplikasi web sumber terbuka yang berjalan via bahasa pemrograman Ruby. Ia merupakan kerangka kerja full-stack: memampukan pembuatan laman dan aplikasi yang mengumpulkan informasi dari server web, berkomunikasi dengan atau memanggil sebuah kueri dari server web, dan mengolah templat dari sumber. Sebagai hasilnya, Rails menyajikan fitur sistem routing yang independen dari server web.<br/><!-- more --><br/>Ruby on Rails menegaskan penggunaan pola-pola dan prinsip-prinsip rekayasa perangkat lunak terkenal, seperti pola active record, konvensi diatas konfigurasi (CoC), don’t repeat yourself (DRY), and model-view-controller (MVC).</p><p>- Perancang: David Heinemeier Hansson<br/>- Pengembang: Rails Core Team<br/>- Rilis perdana: 13 Desember 2005<br/>- Rilis stabil: 4.0.4 (14 Maret 2014)<br/>- Rilis pratayang: 4.1.0 RC 1 (18 Februari 2014)<br/>- Status pengembangan: Active<br/>- Bahasa pemograman: Ruby<br/>- Sistem operasi: Cross-platform<br/>- Lisensi: Lisensi MIT<br/>- Situs web resmi: rubyonrails.org</p><footer><strong>Ruby on Rails</strong> <cite><a href='https://id.wikipedia.org/wiki/Ruby_on_Rails'>id.wikipedia.org/wiki/…</a></cite></footer></blockquote>
<p>Sebelumnya kita dapat menjumpai tutorial saya sebelumnya tentang <a href="https://sundi3yansyah.github.io/article/2017/05/08/cara-instal-ruby-via-rvm/">Cara Instal Ruby via RVM</a>.
Jadi saya asumsikan perangkat kalian sudah terpasang Ruby entah itu ruby versi berapa tapi saya sarankan gunakan ruby versi terbaru, dan jangan lupa pula sesuaikan dengan sistem operasi yang kalian gunakan.</p>
<h4>1. Cek Ruby Environment</h4>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>ruby -v</span></code></pre></td></tr></table></div></figure>
<h4>2. Database untuk Rails</h4>
<p>Disini saya juga sudah mengasumsikan pada kalian untuk sudah memasang database yang akan digunakan di Rails nanti, contohnya seperti: SQLite3, MySQL, PostgreSQL dan lain sebagainya sesuaikan dengan kebutuhan database yang kalian gunakan nanti.
Untuk memverifikasinya dengan perintah sebagai contoh:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># SQLite3
</span><span class='line'>sqlite3 --version
</span><span class='line'>
</span><span class='line'># MySQL
</span><span class='line'>mysql --version
</span><span class='line'>
</span><span class='line'># PostgreSQL
</span><span class='line'>psql --version</span></code></pre></td></tr></table></div></figure>
<p>Dan lain sebagainya, sesuaikan dengan environment database yang kalian gunakan. Jika output dihasilkan maka database sudah siap dipakai.</p>
<h4>3. Instal Rails</h4>
<p>Sekarang kalian sudah bisa instal Rails dengan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>gem install rails</span></code></pre></td></tr></table></div></figure>
<p>Ini membutuhkan waktu yang lama sesuai koneksi internet dan perangkat yang digunakan.</p>
<h4>4. Verifikasi Rails</h4>
<p>Jika langkah diatas sudah kelar maka langkah selanjutnya kalian verifikasi rails yang sudah di instal dengan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails -v</span></code></pre></td></tr></table></div></figure>
<p>Jika output dihasilkan maka Rails sudah siap dipakai.</p>
<h4>5. Siapkan aplikasi baru</h4>
<p>Untuk memulai aplikasi baru Rails yang sudah di-install langsung saja ketikkan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails new aplikasi-pertamaku</span></code></pre></td></tr></table></div></figure>
<p>Sebelum kalian menggunakan perintah <code>rails new aplikasi-pertamaku</code> kalian juga dapat menggunakan parameter yang tersedia sebegai berikut:</p>
<figure class='code'><figcaption><span>Parameter ‘rails new –help’ </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>Usage:
</span><span class='line'> rails new APP_PATH [options]
</span><span class='line'>
</span><span class='line'>Options:
</span><span class='line'> -r, [--ruby=PATH] # Path to the Ruby binary of your choice
</span><span class='line'> # Default: /home/sundi3yansyah/.rvm/rubies/ruby-2.3.3/bin/ruby
</span><span class='line'> -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
</span><span class='line'> -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
</span><span class='line'> # Default: sqlite3
</span><span class='line'> -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
</span><span class='line'> # Default: jquery
</span><span class='line'> [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
</span><span class='line'> -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
</span><span class='line'> -G, [--skip-git], [--no-skip-git] # Skip .gitignore file
</span><span class='line'> [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
</span><span class='line'> -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
</span><span class='line'> -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
</span><span class='line'> -P, [--skip-puma], [--no-skip-puma] # Skip Puma related files
</span><span class='line'> -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
</span><span class='line'> -S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
</span><span class='line'> [--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
</span><span class='line'> [--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem
</span><span class='line'> -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
</span><span class='line'> [--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
</span><span class='line'> -T, [--skip-test], [--no-skip-test] # Skip test files
</span><span class='line'> [--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
</span><span class='line'> [--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
</span><span class='line'> [--rc=RC] # Path to file containing extra configuration options for rails command
</span><span class='line'> [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
</span><span class='line'> [--api], [--no-api] # Preconfigure smaller stack for API only apps
</span><span class='line'>
</span><span class='line'>Runtime options:
</span><span class='line'> -f, [--force] # Overwrite files that already exist
</span><span class='line'> -p, [--pretend], [--no-pretend] # Run but do not make any changes
</span><span class='line'> -q, [--quiet], [--no-quiet] # Suppress status output
</span><span class='line'> -s, [--skip], [--no-skip] # Skip files that already exist
</span><span class='line'>
</span><span class='line'>Rails options:
</span><span class='line'> -h, [--help], [--no-help] # Show this help message and quit
</span><span class='line'> -v, [--version], [--no-version] # Show Rails version number and quit
</span><span class='line'>
</span><span class='line'>Description:
</span><span class='line'> The 'rails new' command creates a new Rails application with a default
</span><span class='line'> directory structure and configuration at the path you specify.
</span><span class='line'>
</span><span class='line'> You can specify extra command-line arguments to be used every time
</span><span class='line'> 'rails new' runs in the .railsrc configuration file in your home directory.
</span><span class='line'>
</span><span class='line'> Note that the arguments specified in the .railsrc file don't affect the
</span><span class='line'> defaults values shown above in this help message.
</span><span class='line'>
</span><span class='line'>Example:
</span><span class='line'> rails new ~/Code/Ruby/weblog
</span><span class='line'>
</span><span class='line'> This generates a skeletal Rails installation in ~/Code/Ruby/weblog.</span></code></pre></td></tr></table></div></figure>
<p>Sebagai contoh aplikasi rails kita ingin menggunakan database MySQL dengan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails new aplikasi-pertamaku -d mysql</span></code></pre></td></tr></table></div></figure>
<p>Contoh lain aplikasi rails kita ingin digunakan untuk membuat API maka perintahnya:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails new aplikasi-pertamaku --api</span></code></pre></td></tr></table></div></figure>
<p>Atau kedua-duanya, maka perintahnya:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails new aplikasi-pertamaku -d mysql --api</span></code></pre></td></tr></table></div></figure>
<p><strong>aplikasi-pertamaku</strong> adalah nama aplikasi atau nama module atau apakah kalian menyebutnya dan <strong>aplikasi-pertamaku</strong> sekaligus nama folder yang akan dihasilkan, maka langkah selanjutnya masuk ke folder aplikasi tersebut:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd aplikasi-pertamaku</span></code></pre></td></tr></table></div></figure>
<h4>6. Jalankan Aplikasi</h4>
<p>Jika aplikasi rails kalian sudah yakin benar, untuk menjalankannya aplikasi rails yang sudah dihasilkan gunakan perintah:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rails server</span></code></pre></td></tr></table></div></figure>
<p>Jika output terminal yang dihasilkan kurang lebih sebagai berikut:</p>
<figure class='code'><figcaption><span>Terminal </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>=> Booting Puma
</span><span class='line'>=> Rails 5.1.2 application starting in development on http://localhost:3000
</span><span class='line'>=> Run `rails server -h` for more startup options
</span><span class='line'>Puma starting in single mode...
</span><span class='line'>* Version 3.9.1 (ruby 2.3.3-p222), codename: Private Caller
</span><span class='line'>* Min threads: 5, max threads: 5
</span><span class='line'>* Environment: development
</span><span class='line'>* Listening on tcp://0.0.0.0:3000
</span><span class='line'>Use Ctrl-C to stop</span></code></pre></td></tr></table></div></figure>
<p>Maka aplikasi berhasil dijalankan, langkah berikutnya kalian bisa kunjungi alamat <a href="http://localhost:3000">http://localhost:3000</a> pada browser favorit kalian.</p>
<p>Jika output pada browser sebagai berikut:</p>
<p><img src="http://guides.rubyonrails.org/images/getting_started/rails_welcome.png" alt="Rails welcome" /></p>
<p>Maka artikel ini berhasil membantu anda untuk meng-instal Rails pada perangkat kalian.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Cara Instal Ruby via RVM]]></title>
<link href="http://sundi3yansyah.github.io/article/2017/05/08/cara-instal-ruby-via-rvm/"/>
<updated>2017-05-08T14:06:02+07:00</updated>
<id>http://sundi3yansyah.github.io/article/2017/05/08/cara-instal-ruby-via-rvm</id>
<content type="html"><![CDATA[<p>Apa itu RVM?</p>
<blockquote><p>Ruby Version Manager, often abbreviated as RVM, is a unix-like software platform designed to manage multiple instalations of Ruby on the same device.</p><footer><strong>Ruby Version Manager</strong> <cite><a href='https://en.wikipedia.org/wiki/Ruby_Version_Manager'>en.wikipedia.org/wiki/…</a></cite></footer></blockquote>
<!-- more -->
<p>Jadi intinya kita bisa memasang ruby untuk beberapa versi yang kita inginkan.</p>