<NME> gulpfile.js
<BEF> 'use strict';

var gulp = require( 'gulp' );
var download = require( 'gulp-download' );
var decompress = require( 'gulp-decompress' );
var convertEncoding = require( 'gulp-convert-encoding' );
var chmod = require( 'gulp-chmod' );
var v1 = require( './lib/v1.js' );

gulp.task( 'download', function () {
  return download( [
    'http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip',
  ] )
  .pipe( decompress() )
  .pipe( convertEncoding( { from: "shift_jis", to: "utf-8" } ) )
  .pipe( chmod( 644 ) )
  .pipe( gulp.dest( 'api' ) );
} );

gulp.task( 'v1', function () {
  return download( [
    'http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip',
  ] )
  .pipe( decompress() )
  .pipe( convertEncoding( { from: "shift_jis", to: "utf-8" } ) )
  .pipe( v1() )
  .pipe( chmod( 644 ) )
  .pipe( gulp.dest( 'api/v1' ) );
    .pipe( gulp.dest( 'api/v1' ) );
} );

/**
 * Create an API of the Jigyosyo postal code.
 */
gulp.task( 'v1-jigyosyo', ['download'], function () {
  gulp.src( 'api/JIGYOSYO.CSV' )
    .pipe( jigyosyo2json() )
    .pipe( v1() )
    .pipe( chmod( 644 ) )
    .pipe( gulp.dest( 'api/v1' ) );
} );

gulp.task( 'default', [ 'v1', 'v1-jigyosyo' ] );

<MSG> Merge branch 'refactoring-gulpfile' of git://github.com/torounit/postal-code-api into torounit-refactoring-gulpfile

<DFF> @@ -7,22 +7,25 @@ var convertEncoding = require( 'gulp-convert-encoding' );
 var chmod = require( 'gulp-chmod' );
 var v1 = require( './lib/v1.js' );
 
-gulp.task( 'download', function () {
+/**
+ * Download and Decompress and Convert Encoding.
+ */
+function getZipCodeCSV() {
   return download( [
     'http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip',
   ] )
   .pipe( decompress() )
   .pipe( convertEncoding( { from: "shift_jis", to: "utf-8" } ) )
+}
+
+gulp.task( 'download', function () {
+  return getZipCodeCSV()
   .pipe( chmod( 644 ) )
   .pipe( gulp.dest( 'api' ) );
 } );
 
 gulp.task( 'v1', function () {
-  return download( [
-    'http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip',
-  ] )
-  .pipe( decompress() )
-  .pipe( convertEncoding( { from: "shift_jis", to: "utf-8" } ) )
+  return getZipCodeCSV()
   .pipe( v1() )
   .pipe( chmod( 644 ) )
   .pipe( gulp.dest( 'api/v1' ) );

Merge branch 'refactoring-gulpfile' of git://github.com/torounit/postal-code-api into torounit-refactoring-gulpfile