caravan 0.6.2 → 0.7.0

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: 2cb58e3b687de82078f8648801e4e601c43f5697
4
- data.tar.gz: 196ee1ea409f031f64fa91dc56ecc6e03014aa15
3
+ metadata.gz: f04af0c92d6322edaa0e750792d9377184adec46
4
+ data.tar.gz: d02d0c1601d98d6e0f1e33050113fbe5b7bb94e3
5
5
  SHA512:
6
- metadata.gz: feebfb9d0d2a2fa2ac2a826b8475f38197ffa34ca0aa5c282acc3338ff7d3a34dc27fa3347fd3783d0e4b4da011f3b8c4d9c7e9da73c6fbeaeb2700d8fe0eb7a
7
- data.tar.gz: 527d1d49aa71bafeb85f4ef5f5709f55abd682b02d69437e1957eb4a0cbaee1c87ade0ba4f564028983ee9fd5157e7c008d790d5876a04eccee7f9da46bb4b38
6
+ metadata.gz: 5bd169ffcb6a9f6caf6d9f912926085fce3a5cf3a09930690465ff0eb0b333d004344485fc0c0dbdacef86195a26d73ee3ddc865c4e76524bb006660ea05eb92
7
+ data.tar.gz: efb1b60eb0a047213f423f90f3c9a2270f10ccdc62b5100f6ec9034c23b7d192c4035ee422225cb4cc94b48df7315f47ba32d79f7c5d9c883ac1cd3293451190
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ Style/StringLiterals:
2
+ Enabled: false
3
+ Metrics/MethodLength:
4
+ Max: 30
data/.travis.yml CHANGED
@@ -1,10 +1,19 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.3.0
5
4
  - 2.4.0
6
- after_success:
7
- - CODECLIMATE_REPO_TOKEN=b72ccd136db6874a3d5dd842c50c1dc0933a1f49a02c55ce8567ec7311600af3 bundle exec codeclimate-test-reporter
5
+ - 2.5.0
6
+ env:
7
+ global:
8
+ - CC_TEST_REPORTER_ID=b72ccd136db6874a3d5dd842c50c1dc0933a1f49a02c55ce8567ec7311600af3
9
+ before_script:
10
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
+ - chmod +x ./cc-test-reporter
12
+ - ./cc-test-reporter before-build
13
+ script:
14
+ - bundle exec rake test
15
+ after_script:
16
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
8
17
  notifications:
9
18
  email: false
10
19
  slack: navyblue-team:ioO5diAGc5WUQVDKc5BH1UbE
data/README.md CHANGED
@@ -11,7 +11,7 @@ The scenario is when we are developing in your local workspace and the program o
11
11
 
12
12
  ![](/assets/civ-5-caravan.png)
13
13
 
14
- This is the caravan in Sid Meier's Civilization V, which the project name originally comes from.
14
+ This is the caravan in [Sid Meier's Civilization V](http://www.civilization5.com/), which the project name originally comes from.
15
15
 
16
16
  ## Installation
17
17
 
@@ -79,12 +79,22 @@ You may also write `src` and `dst` to `caravan.yml`. Hence, deployment made even
79
79
  $ caravan
80
80
  ```
81
81
 
82
+ ### Deploy Modes
83
+
84
+ * shell
85
+ * `cp` in local.
86
+ * scp
87
+ * `scp` to remote machines, _not recommended_.
88
+ * [rsync](https://rsync.samba.org/)
89
+ * `rsync` to remote machines, which is the default and recommended mode because it is incremental. Thus, it performs much better.
90
+ * rsync_local
91
+ * `rsync` in local.
92
+
82
93
  ## Plan
83
94
 
84
95
  - [x] Basic watching and deploying
85
96
  - [x] Exclude watching unwanted files
86
97
  - [x] `caravan.yml` for project-specialized configuration
87
- - [ ] Watch and deploy only the changed file instead of the whole folder
88
98
  - [x] Callbacks for deployment
89
99
  - [x] `after_create`
90
100
  - [x] `after_change`
data/exe/caravan CHANGED
@@ -10,6 +10,10 @@ option_parser = OptionParser.new do |opts|
10
10
  opts.banner = "Caravan #{Caravan::VERSION}\nCopyright (c) David Zhang 2018\n"
11
11
  opts.separator ""
12
12
 
13
+ opts.on("-l YAML_NAME", "--load YAML_NAME", "YAML path") do |value|
14
+ options[:yaml] = value
15
+ end
16
+
13
17
  opts.on("-s SOURCE_PATH", "--source SOURCE_PATH", "Source path") do |value|
14
18
  options[:src] = value
15
19
  end
@@ -30,12 +34,10 @@ option_parser = OptionParser.new do |opts|
30
34
  end
31
35
  end
32
36
 
33
- options[:once] = false
34
37
  opts.on("-o", "--once", "Deploy for once") do
35
38
  options[:once] = true
36
39
  end
37
40
 
38
- options[:debug] = false
39
41
  opts.on("-b", "--debug", "Debug mode") do
40
42
  options[:debug] = true
41
43
  end
@@ -56,7 +58,11 @@ if ARGV.length == 0
56
58
  merged_conf = Caravan::Config.merge({}, Caravan.process_conf("."))
57
59
  else
58
60
  option_parser.parse!(ARGV)
59
- merged_conf = Caravan::Config.merge(options, Caravan.process_conf(options[:src]))
61
+ if options.key?(:yaml)
62
+ merged_conf = Caravan::Config.merge(options, Caravan.process_conf(options[:src], options[:yaml]))
63
+ else
64
+ merged_conf = Caravan::Config.merge(options, Caravan.process_conf(options[:src]))
65
+ end
60
66
  end
61
67
 
62
68
  if merged_conf.key?("src") && merged_conf.key?("dst") && merged_conf.key?("deploy_mode")
data/lib/caravan.rb CHANGED
@@ -37,7 +37,7 @@ module Caravan
37
37
  exit(0)
38
38
  end
39
39
  listener.start
40
-
40
+
41
41
  trap("INT") do
42
42
  listener.stop
43
43
  deployer.before_destroy
@@ -52,6 +52,7 @@ module Caravan
52
52
  deployer.before_deploy
53
53
  deployer.run
54
54
  deployer.after_deploy
55
+ Caravan::Message.success("Deployed once.")
55
56
  end
56
57
 
57
58
  def create_listener(deployer, src_path)
@@ -64,12 +65,10 @@ module Caravan
64
65
  end
65
66
  end
66
67
 
67
- def process_conf(src_path)
68
+ def process_conf(src_path, yaml_name = Caravan::Config.default_conf_name)
68
69
  Caravan::Message.success("Reading configuration...")
69
- if src_path.nil?
70
- src_path = '.'
71
- end
72
- user_config_path = File.join(File.expand_path(src_path), Caravan::Config.default_conf_name)
70
+ src_path = '.' if src_path.nil?
71
+ user_config_path = File.join(File.expand_path(src_path), yaml_name)
73
72
  conf = Caravan::Config.from(user_config_path)
74
73
  conf
75
74
  end
@@ -20,7 +20,7 @@ module Caravan
20
20
  end
21
21
 
22
22
  def success(msg)
23
- puts "#{msg}".green
23
+ puts msg.green
24
24
  end
25
25
  end
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module Caravan
2
- VERSION = "0.6.2".freeze
2
+ VERSION = "0.7.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caravan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen
@@ -119,6 +119,7 @@ extra_rdoc_files: []
119
119
  files:
120
120
  - ".codeclimate.yml"
121
121
  - ".gitignore"
122
+ - ".rubocop.yml"
122
123
  - ".travis.yml"
123
124
  - CODE_OF_CONDUCT.md
124
125
  - Gemfile