mina-rsync-npn47 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5930bf854b98f58b38a332ea85062a1f76ecd8c4
4
+ data.tar.gz: 19d2b4e471fc2ba6aff293f9260cac67b0f8531f
5
+ SHA512:
6
+ metadata.gz: ab641bfa0cfbf0f5b993326595419e9d798bd3a6a1f91519a247a8466f9ecb36f577e67746ee246a188f82aca7313e39860cd286ceec87fe4361e9d7e22b6517
7
+ data.tar.gz: 5240afe9a9b22794c4f8ff51ac32ea6a04ec1b2e459e110f1ff1489bb335b7de09c2de8ac531bef740adfeca6e6cf8e66fb2a9840e0182dd4a239d537039fa3a
@@ -0,0 +1 @@
1
+ /*.gem
@@ -0,0 +1,6 @@
1
+ ## 1.1.0 (Sep 2, 2013)
2
+ - Prints progress messages like Mina does it and with color.
3
+ - Supports `--verbose` running to see what commands get executed.
4
+
5
+ ## 1.0.0 (Sep 2, 2013)
6
+ - First release. Let's get syncing!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Mina::Rsync
2
+ Copyright (C) 2013 Andri Möll
3
+
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License as published by the Free
6
+ Software Foundation, either version 3 of the License, or any later version.
7
+
8
+ Additional permission under the GNU Affero GPL version 3 section 7:
9
+ If you modify this Program, or any covered work, by linking or
10
+ combining it with other code, such other code is not for that reason
11
+ alone subject to any of the requirements of the GNU Affero GPL version 3.
12
+
13
+ In summary:
14
+ - You can use this program for no cost.
15
+ - You can use this program for both personal and commercial reasons.
16
+ - You do not have to share your own program's code which uses this program.
17
+ - You have to share modifications (e.g bug-fixes) you've made to this program.
18
+
19
+ For the full copy of the GNU Affero General Public License see:
20
+ http://www.gnu.org/licenses.
@@ -0,0 +1,16 @@
1
+ NAME = mina-rsync
2
+
3
+ love:
4
+ @echo "Feel like makin' love."
5
+
6
+ pack:
7
+ gem build $(NAME).gemspec
8
+
9
+ publish:
10
+ gem push $(NAME)-*.gem
11
+
12
+ clean:
13
+ rm -rf *.gem
14
+
15
+ .PHONY: love pack publish
16
+ .PHONY: clean
@@ -0,0 +1,112 @@
1
+ Mina::Rsync for Mina
2
+ ====================
3
+ [![Gem version](https://badge.fury.io/rb/mina-rsync.png)](http://badge.fury.io/rb/mina-rsync)
4
+
5
+ **Deploy with Rsync** to your server from any local (or remote) repository when using [**Mina**](http://nadarei.co/mina).
6
+ Saves you from having to install Git on your production machine and allows you to customize which files you want to deploy. Also allows you to easily precompile things on your local machine before deploying.
7
+
8
+ ### Tour
9
+ - Suitable for deploying any apps, be it Ruby, Rails, Node.js or others.
10
+ - Exclude files from being deployed with Rsync's `--exclude` options.
11
+ - Precompile files or assets easily before deploying, like JavaScript or CSS.
12
+ - Caches your previously deployed code to speed up deployments ~1337%.
13
+ - Currently works only with Git, so please shout out your interest in other SCMs.
14
+
15
+
16
+ Using
17
+ -----
18
+ Install with:
19
+ ```
20
+ gem install mina-rsync
21
+ ```
22
+
23
+ Require it at the top of your `Minafile` (or `config/deploy.rb`):
24
+ ```ruby
25
+ require "mina/rsync"
26
+ ```
27
+
28
+ Set some `rsync_options` to your liking:
29
+ ```ruby
30
+ set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]
31
+ ```
32
+
33
+ Then invoke Mina::Rsync's tasks from your `deploy` task:
34
+ ```ruby
35
+ task :deploy do
36
+ deploy do
37
+ invoke "rsync:deploy"
38
+ end
39
+ end
40
+ ```
41
+
42
+ And after setting regular Mina options, deploy as usual!
43
+ ```
44
+ mina deploy
45
+ ```
46
+
47
+ ### Implementation
48
+ 1. Clones and updates your repository to `rsync_stage` (defaults to `tmp/deploy`) on your local machine.
49
+ 2. Checks out the branch set in the `branch` variable (defaults to `master`).
50
+ 3. Rsyncs to `rsync_cache` (defaults to `shared/deploy`) on the server.
51
+ 4. Copies the content of the cache directory to the build directory.
52
+
53
+ After that, Mina takes over and runs its usual tasks and symlinking.
54
+
55
+ ### Excluding files from being deployed
56
+ If you don't want to deploy everything you've committed to your repository, pass some `--exclude` options to Rsync:
57
+ ```ruby
58
+ set :rsync_options, %w[
59
+ --recursive --delete --delete-excluded
60
+ --exclude .git*
61
+ --exclude /config/database.yml
62
+ --exclude /test/***
63
+ ]
64
+ ```
65
+
66
+ ### Precompile assets before deploy
67
+ Mina::Rsync runs `rsync:stage` before rsyncing. Hook to that like this:
68
+ ```ruby
69
+ task :precompile do
70
+ Dir.chdir settings.rsync_stage do
71
+ system "rake", "assets:precompile"
72
+ end
73
+ end
74
+
75
+ task "rsync:stage" do
76
+ invoke "precompile"
77
+ end
78
+ ```
79
+
80
+
81
+ Configuration
82
+ -------------
83
+ Set Mina variables with `set name, value`.
84
+
85
+ Name | Default | Description
86
+ --------------|---------|------------
87
+ repository | `.` | The path or URL to a Git repository to clone from.
88
+ branch | `master` | The Git branch to checkout.
89
+ rsync_stage | `tmp/deploy` | Path where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
90
+ rsync_cache | `shared/deploy` | Path where to cache your repository on the server to avoid rsyncing from scratch each time. Can be both relative or absolute.
91
+ rsync_options | `[]` | Array of options to pass to `rsync`.
92
+ rsync_copy | `rsync --archive --acls --xattrs` | Command used to copy files from the cache directory to the build path on the server.
93
+
94
+
95
+ License
96
+ -------
97
+ Mina::Rsync is released under a *Lesser GNU Affero General Public License*, which in summary means:
98
+
99
+ - You **can** use this program for **no cost**.
100
+ - You **can** use this program for **both personal and commercial reasons**.
101
+ - You **do not have to share your own program's code** which uses this program.
102
+ - You **have to share modifications** (e.g bug-fixes) you've made to this program.
103
+
104
+ For more convoluted language, see the `LICENSE` file.
105
+
106
+
107
+ About
108
+ -----
109
+ **[Andri Möll](http://themoll.com)** made this happen.
110
+ [Monday Calendar](https://mondayapp.com) was the reason I needed this.
111
+
112
+ If you find Mina::Rsync needs improving, please don't hesitate to type to me now at [andri@dot.ee](mailto:andri@dot.ee) or [create an issue online](https://github.com/moll/mina-rsync/issues).
@@ -0,0 +1,80 @@
1
+ require File.expand_path("../rsync/version", __FILE__)
2
+
3
+ # NOTE: Please don't depend on tasks without a description (`desc`) as they
4
+ # might change between minor or patch version releases. They make up the
5
+ # private API and internals of Mina::Rsync. If you think something should be
6
+ # public for extending and hooking, please let me know!
7
+
8
+ set :repository, "."
9
+ set :branch, "master"
10
+ set :rsync_options, []
11
+ set :rsync_copy, "rsync --archive --acls --xattrs"
12
+
13
+ # Stage is used on your local machine for rsyncing from.
14
+ set :rsync_stage, "tmp/deploy"
15
+
16
+ # Cache is used on the server to copy files to from to the release directory.
17
+ # Saves you rsyncing your whole app folder each time.
18
+ set :rsync_cache, "shared/deploy"
19
+
20
+ run = lambda do |*cmd|
21
+ cmd = cmd[0] if cmd[0].is_a?(Array)
22
+ print_command cmd.join(" ") if fetch(:simulate) || fetch(:verbose)
23
+ Kernel.system *cmd unless fetch(:simulate)
24
+ end
25
+
26
+ rsync_cache = lambda do
27
+ cache = fetch(:rsync_cache)
28
+ raise TypeError, "Please set rsync_cache." unless cache
29
+ cache = fetch(:deploy_to) + "/" + cache if cache && cache !~ /^\//
30
+ cache
31
+ end
32
+
33
+ desc "Stage and rsync to the server (or its cache)."
34
+ task :rsync => %w[rsync:stage] do
35
+ print_status "Rsyncing to #{rsync_cache.call}..."
36
+
37
+ rsync = %w[rsync]
38
+ rsync.concat fetch(:rsync_options)
39
+ rsync << fetch(:rsync_stage) + "/"
40
+
41
+ user = fetch(:user) + "@" if fetch(:user)
42
+ host = fetch(:domain)
43
+ rsync << "#{user}#{host}:#{rsync_cache.call}"
44
+
45
+ run.call rsync
46
+ end
47
+
48
+ namespace :rsync do
49
+ task :create_stage do
50
+ next if File.directory?(fetch(:rsync_stage))
51
+ print_status "Cloning repository for the first time..."
52
+
53
+ clone = %w[git clone]
54
+ clone << fetch(:repository)
55
+ clone << fetch(:rsync_stage)
56
+ run.call clone
57
+ end
58
+
59
+ desc "Stage the repository in a local directory."
60
+ task :stage => %w[create_stage] do
61
+ print_status "Staging..."
62
+
63
+ stage = fetch(:rsync_stage)
64
+ git = %W[git --git-dir #{stage}/.git --work-tree #{stage}]
65
+ run.call git + %w[fetch --quiet --all --prune]
66
+
67
+ # Prefix the Git "HEAD is now at" message, but only if verbose is unset,
68
+ # because then the #print_command called by #run prints its own prefix.
69
+ print "Git checkout: " unless fetch(:simulate) || fetch(:verbose)
70
+ run.call git + %W[reset --hard origin/#{fetch(:branch)}]
71
+ end
72
+
73
+ task :build do
74
+ comment %(Copying from cache directory to build path)
75
+ command %(#{fetch(:rsync_copy)} "#{rsync_cache.call}/" '.')
76
+ end
77
+
78
+ desc "Stage, rsync and copy to the build path."
79
+ task :deploy => %w[rsync build]
80
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Rsync
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/mina/rsync/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'mina-rsync-npn47'
6
+ gem.version = Mina::Rsync::VERSION
7
+ gem.homepage = 'https://gitlab.com/neerajpn47/mina-rsync'
8
+ gem.summary = <<-end.strip.gsub(/\s*\n\s*/, " ")
9
+ Deploy with Rsync from any local (or remote) repository.
10
+ end
11
+
12
+ gem.description = <<-end.strip.gsub(/\s*?\n(\n?)\s*/, " \\1\\1")
13
+ Deploy with Rsync to your server from any local (or remote) repository.
14
+
15
+ Saves you the need to install Git on your production machine and deploy all
16
+ of your development files each time!
17
+
18
+ Suitable for deploying any apps, be it Ruby or Node.js.
19
+
20
+ Cloned from https://github.com/moll/mina-rsync
21
+ end
22
+
23
+ gem.authors = ['Andri Möll', 'Neeraj P N']
24
+ gem.email = "andri@dot.ee"
25
+ gem.license = "LAGPL"
26
+
27
+ gem.files = `git ls-files`.split($/)
28
+ gem.executables = gem.files.grep(/^bin\//).map(&File.method(:basename))
29
+ gem.test_files = gem.files.grep(/^spec\//)
30
+ gem.require_paths = ["lib"]
31
+
32
+ gem.add_dependency "mina"
33
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-rsync-npn47
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andri Möll
8
+ - Neeraj P N
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-06-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mina
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ description: "Deploy with Rsync to your server from any local (or remote) repository.
29
+ \n\nSaves you the need to install Git on your production machine and deploy all
30
+ of your development files each time! \n\nSuitable for deploying any apps, be it
31
+ Ruby or Node.js. \n\nCloned from https://github.com/moll/mina-rsync"
32
+ email: andri@dot.ee
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - ".gitignore"
38
+ - CHANGELOG.md
39
+ - LICENSE
40
+ - Makefile
41
+ - README.md
42
+ - lib/mina/rsync.rb
43
+ - lib/mina/rsync/version.rb
44
+ - mina-rsync.gemspec
45
+ homepage: https://gitlab.com/neerajpn47/mina-rsync
46
+ licenses:
47
+ - LAGPL
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 2.6.10
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Deploy with Rsync from any local (or remote) repository.
69
+ test_files: []