Skip to content

Commit b3fbc50

Browse files
authored
Merge pull request #95 from numbata/feature/add_devtools
Added rubocop.yml, editorconfig and changelog
2 parents 5cd7193 + b2a8d3c commit b3fbc50

File tree

15 files changed

+244
-146
lines changed

15 files changed

+244
-146
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 2
13+
charset = utf-8

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.gem
2+
Gemfile.lock

.rubocop.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Rails:
2+
Enabled: true
3+
4+
AllCops:
5+
TargetRubyVersion: 2.3
6+
Exclude:
7+
- 'client/**/*'
8+
- 'db/**/*'
9+
- 'config/**/*'
10+
- 'script/**/*'
11+
- 'test/factories/**/*'
12+
- 'lib/configus.rb'
13+
- 'node_modules/**/*'
14+
- 'tmp/**/*'
15+
- '**/*.haml'
16+
17+
Style/FrozenStringLiteralComment:
18+
Enabled: false
19+
20+
Style/ClassAndModuleChildren:
21+
Enabled: false
22+
23+
Style/Documentation:
24+
Enabled: false
25+
26+
Metrics/ClassLength:
27+
Max: 150
28+
29+
Metrics/CyclomaticComplexity:
30+
Max: 10
31+
32+
Metrics/LineLength:
33+
Max: 160
34+
35+
Metrics/AbcSize:
36+
Max: 40
37+
38+
Metrics/MethodLength:
39+
Max: 30
40+
41+
Metrics/ModuleLength:
42+
Max: 150
43+
44+
Metrics/PerceivedComplexity:
45+
Max: 10
46+
47+
Style/NumericLiterals:
48+
Enabled: false
49+
50+
Style/RegexpLiteral:
51+
Enabled: false
52+
53+
Style/AsciiComments:
54+
Enabled: false
55+
56+
Style/StringLiterals:
57+
Enabled: false

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Capistrano-db-tasks Changelog
2+
3+
Reverse Chronological Order:
4+
5+
## master
6+
7+
https://github.com/sgruhier/capistrano-db-tasks/compare/v0.4...HEAD
8+
9+
* Your contribution here!
10+
* Fixed iteration on remote/local assets dir #98 (@elthariel)
11+
* Fetch :user property on server #97 (@elthariel)
12+
* Add support of ENV['DATABASE_URL'] #54 #70 #99 (@numbata, @fabn, @donbobka, @ktaragorn, @markgandolfo, @leifcr, @elthariel)
13+
* Specify database for pg\_terminate_backend #93 (@stevenchanin)
14+
* Show local execution failure log #89 (@dtaniwaki)
15+
* Add postigs to allowed PG adapters #91 (@matfiz)
16+
* Added database name to --ignore-table statements for MySQL #76 (@km-digitalpatrioten)
17+
* Add :db\_ignore\_tables option #65 (@rdeshpande)
18+
* Update README.markdown #67 (@alexbrinkman)
19+
* Using gzip instead of bzip2 (configurable) #48 #59 (@numbata)
20+
21+
# 0.4 (Feb 26 2015)
22+
23+
https://github.com/sgruhier/capistrano-db-tasks/compare/v0.3...v0.4
24+
25+
* Set correct username for pg connection #55 (@numbata)
26+
* Protect remote server from pushing #51 (@IntractableQuery)
27+
* Use stage name as rails\_env #49 (@bronislav)
28+
* Remove local db dump after db:push if db_local_clean is set #47 (@pugetive)
29+
* Fixed app:pull and app:push tasks #42 (@iamdeuterium)
30+
* Added space between -p and the password #41 (@iamdeuterium)
31+
* Add option to skip data synchronization prompt question #37 (@rafaelsales)
32+
* Add option to remove remote dump file after downloading to local #36 (@rafaelsales)
33+
* Use port option from database.yml #35 (@numbata)
34+
* Use heroku dump/restore arguments for postgresql #26 (@mdpatrick)
35+
36+
# 0.3 (Feb 9 2014)
37+
38+
https://github.com/sgruhier/capistrano-db-tasks/compare/v0.2.1...v0.3
39+
40+
* Capistrano 3 support PR #23 (@sauliusgrigaitis)

README.markdown

Lines changed: 0 additions & 102 deletions
This file was deleted.

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# CapistranoDbTasks | [![Code Climate](https://codeclimate.com/github/sgruhier/capistrano-db-tasks/badges/gpa.svg)](https://codeclimate.com/github/sgruhier/capistrano-db-tasks) [![Gem Version](https://badge.fury.io/rb/capistrano-db-tasks.svg)](http://badge.fury.io/rb/capistrano-db-tasks)
2+
3+
Add database AND assets tasks to capistrano to a Rails project. It only works with capistrano 3. Older versions until 0.3 works with capistrano 2.
4+
5+
Currently
6+
7+
* It only supports mysql and postgresql (both side remote and local)
8+
* Synchronize assets remote to local and local to remote
9+
10+
Commands mysql, mysqldump (or pg\_dump, psql), bzip2 and unbzip2 (or gzip) must be in your PATH
11+
12+
Feel free to fork and to add more database support or new tasks.
13+
14+
## Install
15+
16+
Add it as a gem:
17+
18+
```ruby
19+
gem "capistrano-db-tasks", require: false
20+
```
21+
22+
Add to config/deploy.rb:
23+
24+
```ruby
25+
require 'capistrano-db-tasks'
26+
27+
# if you haven't already specified
28+
set :rails_env, "production"
29+
30+
# if you want to remove the local dump file after loading
31+
set :db_local_clean, true
32+
33+
# if you want to remove the dump file from the server after downloading
34+
set :db_remote_clean, true
35+
36+
# if you want to exclude table from dump
37+
set :db_ignore_tables, []
38+
39+
# if you want to exclude table data (but not table schema) from dump
40+
set :db_ignore_data_tables, []
41+
42+
# If you want to import assets, you can change default asset dir (default = system)
43+
# This directory must be in your shared directory on the server
44+
set :assets_dir, %w(public/assets public/att)
45+
set :local_assets_dir, %w(public/assets public/att)
46+
47+
# if you want to work on a specific local environment (default = ENV['RAILS_ENV'] || 'development')
48+
set :locals_rails_env, "production"
49+
50+
# if you are highly paranoid and want to prevent any push operation to the server
51+
set :disallow_pushing, true
52+
53+
# if you prefer bzip2/unbzip2 instead of gzip
54+
set :compressor, :bzip2
55+
```
56+
57+
Add to .gitignore
58+
59+
```yml
60+
/db/*.sql
61+
```
62+
63+
[How to install bzip2 on Windows](http://stackoverflow.com/a/25625988/3324219)
64+
65+
## Available tasks
66+
67+
```
68+
app:local:sync || app:pull # Synchronize your local assets AND database using remote assets and database
69+
app:remote:sync || app:push # Synchronize your remote assets AND database using local assets and database
70+
71+
assets:local:sync || assets:pull # Synchronize your local assets using remote assets
72+
assets:remote:sync || assets:push # Synchronize your remote assets using local assets
73+
74+
db:local:sync || db:pull # Synchronize your local database using remote database data
75+
db:remote:sync || db:push # Synchronize your remote database using local database data
76+
```
77+
78+
## Example
79+
80+
```
81+
cap db:pull
82+
cap production db:pull # if you are using capistrano-ext to have multistages
83+
```
84+
85+
## Contributors
86+
87+
* tilsammans (http://github.com/tilsammansee)
88+
* bigfive (http://github.com/bigfive)
89+
* jakemauer (http://github.com/jakemauer)
90+
* tjoneseng (http://github.com/tjoneseng)
91+
* numbata (http://github.com/numbata)
92+
* rafaelsales (http://github.com/rafaelsales)
93+
* rdeshpande (http://github.com/rdeshpande)
94+
95+
## TODO
96+
97+
* May be change project's name as it's not only database tasks now :)
98+
* Add tests
99+
100+
Copyright (c) 2009 [Sébastien Gruhier - XILINUS], released under the MIT license

capistrano-db-tasks.gemspec

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
# -*- encoding: utf-8 -*-
2-
$:.push File.expand_path("../lib", __FILE__)
2+
lib = File.expand_path("../lib", __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
34
require "capistrano-db-tasks/version"
45

5-
Gem::Specification.new do |s|
6-
s.name = "capistrano-db-tasks"
7-
s.version = CapistranoDbTasks::VERSION
8-
s.authors = ["Sebastien Gruhier"]
9-
s.email = ["[email protected]"]
10-
s.homepage = "https://github.com/sgruhier/capistrano-db-tasks"
11-
s.summary = "A collection of capistrano tasks for syncing assets and databases"
12-
s.description = "A collection of capistrano tasks for syncing assets and databases"
6+
Gem::Specification.new do |gem|
7+
gem.name = "capistrano-db-tasks"
8+
gem.version = CapistranoDbTasks::VERSION
9+
gem.authors = ["Sebastien Gruhier"]
10+
gem.email = ["[email protected]"]
11+
gem.homepage = "https://github.com/sgruhier/capistrano-db-tasks"
12+
gem.summary = "A collection of capistrano tasks for syncing assets and databases"
13+
gem.description = "A collection of capistrano tasks for syncing assets and databases"
1314

14-
s.rubyforge_project = "capistrano-db-tasks"
15+
gem.rubyforge_project = "capistrano-db-tasks"
1516

16-
s.files = `git ls-files`.split("\n")
17-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19-
s.require_paths = ["lib"]
17+
gem.licenses = ["MIT"]
2018

21-
s.add_runtime_dependency "capistrano", ">= 3.0.0"
19+
gem.files = `git ls-files`.split("\n")
20+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22+
gem.require_paths = ["lib"]
23+
24+
gem.add_runtime_dependency "capistrano", ">= 3.0.0"
2225
end

lib/capistrano-db-tasks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
require "capistrano"
2-
require File.expand_path("#{File.dirname(__FILE__)}/capistrano-db-tasks/dbtasks")
2+
require File.expand_path("#{File.dirname(__FILE__)}/capistrano-db-tasks/dbtasks")
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module Compressors
2-
class Base
3-
4-
end
2+
class Base; end
53
end

lib/capistrano-db-tasks/compressors/bzip2.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module Compressors
22
class Bzip2 < Base
3-
43
class << self
5-
64
def file_extension
75
"bz2"
86
end
@@ -34,7 +32,6 @@ def decompress(from, to = nil)
3432

3533
"bunzip2 -f #{from} #{to}"
3634
end
37-
3835
end
3936
end
4037
end

0 commit comments

Comments
 (0)