traquitana 0.1.0 → 0.1.5

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
- SHA1:
3
- metadata.gz: 83ba96ab51aeb9b09f628adc76c128cc44c379f7
4
- data.tar.gz: 443bd37eca37582cb1a55ec487ed61225cbbc697
2
+ SHA256:
3
+ metadata.gz: 2854ba3f13cca1fd5b29e5d7f07c520a8ccb4385c53ceeb1a3a781bb99542d68
4
+ data.tar.gz: c9d7e21b0dae5337b8ab3b9f34d98b7096f022bf3c384764989eea376084d040
5
5
  SHA512:
6
- metadata.gz: 385f0456a4dcf583b80f5997ddcbe5d427429f167d3511b8af64230948cac5425ac08b8f2871418cca3557d3ac87b240e6a30073dfff018b2fe3ffea13a21c93
7
- data.tar.gz: 5e48a555fb41f9aeda92f208b25da11d876b81eab0ff313063c5c50e973091cd91af040d495158177946c152f9dcbcf0d0c1a8655b3a9defd034c31ef5cafe11
6
+ metadata.gz: 1c4960102b217d9cc2d8c793dd8fbc3b079449966886b497e934f44557f33c0388ad0e65d6725179e042e3a349aa11ac9e286b4f4d05c915470c763ac423e1c1
7
+ data.tar.gz: 21cfcfae2686113774ca83c79d0f07e8d5657bab077becfa32c751f0b672d6e58383739f1fd58a96d5c61c4f5eb86a3e674b11dc9bbf3eb629f6caa8f82ed708
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- traquitana (0.0.28)
4
+ traquitana (0.1.3)
5
5
  highline
6
6
  net-scp
7
7
  net-ssh
8
- rubyzip (>= 1.0.0)
8
+ rubyzip (>= 2.0.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- highline (1.7.8)
14
- net-scp (1.2.1)
15
- net-ssh (>= 2.6.5)
16
- net-ssh (4.1.0)
17
- rubyzip (1.2.1)
13
+ highline (2.0.3)
14
+ net-scp (2.0.0)
15
+ net-ssh (>= 2.6.5, < 6.0.0)
16
+ net-ssh (5.2.0)
17
+ rubyzip (2.0.0)
18
18
 
19
19
  PLATFORMS
20
20
  ruby
@@ -23,4 +23,4 @@ DEPENDENCIES
23
23
  traquitana!
24
24
 
25
25
  BUNDLED WITH
26
- 1.14.6
26
+ 1.17.2
data/README.md CHANGED
@@ -1,16 +1,13 @@
1
- - [![Downloads](https://img.shields.io/gem/dt/traquitana.svg)](https://rubygems.org/gems/traquitana)
2
- - [![Version](https://img.shields.io/gem/v/traquitana.svg)](https://rubygems.org/gems/traquitana)
3
- - [![License](https://img.shields.io/badge/license-GPLV2-brightgreen.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
1
+ [![Downloads](https://img.shields.io/gem/dt/traquitana.svg)](https://rubygems.org/gems/traquitana)
2
+ [![Version](https://img.shields.io/gem/v/traquitana.svg)](https://rubygems.org/gems/traquitana)
3
+ [![License](https://img.shields.io/badge/license-GPLV2-brightgreen.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
4
4
 
5
5
  # Traquitana
6
6
 
7
7
  This project is a collection of scripts I used before met Capistrano and the
8
- other tools to do that.
9
- It send some files from your local Rails app directory to a production remote
10
- server, using some
11
- default libs on Ruby like net/ssh and net/scp, and rubyzip to zip all the files
12
- and try to make
13
- things faster.
8
+ other tools to do that. It send some files from your local Rails app directory
9
+ to a production remote server, using some default libs on Ruby like net/ssh and
10
+ net/scp, and rubyzip to zip all the files and try to make things faster.
14
11
 
15
12
  It was made to run on GNU/Linux, but should work on similar systems.
16
13
 
@@ -18,15 +15,21 @@ It was made to run on GNU/Linux, but should work on similar systems.
18
15
 
19
16
  Add this line to your application's Gemfile:
20
17
 
21
- gem 'traquitana'
18
+ ```
19
+ gem 'traquitana'
20
+ ```
22
21
 
23
22
  And then execute:
24
23
 
25
- $ bundle
24
+ ```
25
+ $ bundle
26
+ ```
26
27
 
27
28
  Or install it yourself as:
28
29
 
29
- $ gem install traquitana
30
+ ```
31
+ $ gem install traquitana
32
+ ```
30
33
 
31
34
  ## Usage
32
35
 
@@ -44,8 +47,10 @@ Or install it yourself as:
44
47
 
45
48
  On the list can have two elements by row, like:
46
49
 
47
- - - public/images/**/*
48
- - public/images/uploads/**/*
50
+ ```
51
+ - - public/images/**/*
52
+ - public/images/uploads/**/*
53
+ ```
49
54
 
50
55
  On this example, all below public/images will be send BUT ignoring what is on
51
56
  public/images/uploads. This is a way to make sure you'll not overwrite some
@@ -60,7 +65,7 @@ Or install it yourself as:
60
65
  specify any tags. Take a look on the custom.yml file provided and use
61
66
  -t or --target <target>.
62
67
 
63
- - Run traq (just type traq).
68
+ - Run traq (just type `traq`).
64
69
  - It will search for changed files
65
70
  - Will create a list with the file names found
66
71
  - Will zíp the files.
@@ -85,16 +90,27 @@ break something.
85
90
 
86
91
  There are some command line options:
87
92
 
88
- * -f or --file <file> - specify the config file path
89
- * -v or --version - show current version
90
- * -c or --cleanup - clean old versions backups stored on the remote host
91
- * -v or --verbose - be verbose while running
92
- * -t or --target <target> - specify which target will be loaded on the config file
93
+ * `-f` or `--file <file>` - specify the config file path
94
+ * `-v` or `--version` - show current version
95
+ * `-c` or `--cleanup` - clean old versions backups stored on the remote host
96
+ * `-v` or `--verbose` - be verbose while running
97
+ * `-t` or `--target <target>` - specify which target will be loaded on the config file
98
+
99
+ ## Drawbacks
100
+
101
+ As we're sending the local files to the server, if you deleted some file from
102
+ your local repository, **it will not be deleted from your server**, so, you'll
103
+ need to take care of this by yourself. I was inclined to check for the deleted
104
+ files on the file list sent to the server, comparing with the local files there,
105
+ and then delete the files, but I think file deletion could be a little more
106
+ invasive than I'd would like about how this gem works. Maybe on future I can
107
+ change my mind.
93
108
 
94
109
  ## Contributing
95
110
 
96
111
  1. Fork it
97
112
  2. Create your feature branch (`git checkout -b my-new-feature`)
98
- 3. Commit your changes (`git commit -am 'Added some feature'`)
99
- 4. Push to the branch (`git push origin my-new-feature`)
100
- 5. Create new Pull Request
113
+ 3. Test it! Run `$ rake test`. You'll need `minitest` and `minitest-focus`.
114
+ 4. Commit your changes (`git commit -am 'Added some feature'`)
115
+ 5. Push to the branch (`git push origin my-new-feature`)
116
+ 6. Create new Pull Request
data/bin/traq CHANGED
@@ -1,45 +1,45 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "rubygems"
4
- require "yaml"
5
- require "zip"
6
- require "net/scp"
7
- require "net/ssh"
8
- require "fileutils"
9
- require "optparse"
10
- require File.dirname(File.expand_path(__FILE__))+"/../lib/traquitana.rb"
3
+ require 'rubygems'
4
+ require 'yaml'
5
+ require 'zip'
6
+ require 'net/scp'
7
+ require 'net/ssh'
8
+ require 'fileutils'
9
+ require 'optparse'
10
+ require File.dirname(File.expand_path(__FILE__)) + '/../lib/traquitana.rb'
11
11
 
12
- @options = {:verbose=>false}
12
+ @options = { verbose: false }
13
13
 
14
14
  opts = OptionParser.new
15
- opts.banner = "Usage: traq [options] <setup>"
15
+ opts.banner = 'Usage: traq [options] <setup>'
16
16
 
17
- opts.on("-v","--version","Show version") do
18
- puts Traquitana::VERSION
19
- exit 0
17
+ opts.on('-v', '--version', 'Show version') do
18
+ puts Traquitana::VERSION
19
+ exit 0
20
20
  end
21
21
 
22
- opts.on("-c","--cleanup","Clean up old files") do
23
- Traquitana::Cleaner.new.run
24
- exit 0
22
+ opts.on('-c', '--cleanup', 'Clean up old files') do
23
+ Traquitana::Cleaner.new.run
24
+ exit 0
25
25
  end
26
26
 
27
- opts.on("-V","--verbose","Verbose mode") do
28
- @options[:verbose] = true
27
+ opts.on('-V', '--verbose', 'Verbose mode') do
28
+ @options[:verbose] = true
29
29
  end
30
30
 
31
- opts.on("-f","--file file","Config file") do |file|
32
- @options[:filename] = file
31
+ opts.on('-f', '--file file', 'Config file') do |file|
32
+ @options[:filename] = file
33
33
  end
34
34
 
35
- opts.on("-t","--target target","Target") do |target|
36
- @options[:target] = target
35
+ opts.on('-t', '--target target', 'Target') do |target|
36
+ @options[:target] = target
37
37
  end
38
38
 
39
39
  opts.parse!
40
40
 
41
41
  if ARGV[0] =~ /setup/
42
- Traquitana::Config.instance.setup
43
- else
44
- Traquitana::Deployer.new(@options).run
45
- end
42
+ Traquitana::Config.instance.setup
43
+ else
44
+ Traquitana::Deployer.new(@options).run
45
+ end
data/config/custom.yml CHANGED
@@ -1,5 +1,5 @@
1
- # Default configuration# Default configuration---
2
- default:
1
+ # This is the default configuration, created by the traq setup command
2
+ default: &default
3
3
  directory: /tmp/traq_test
4
4
  user: taq
5
5
  list:
@@ -12,6 +12,7 @@ default:
12
12
  - - config/environments/production.rb
13
13
  - - config/locales/**/*
14
14
  - - config/routes.rb
15
+ - - config/storage.yml
15
16
  - - app/**/*
16
17
  - - db/migrate/**/*
17
18
  - - public/javascripts/**/*
@@ -24,27 +25,13 @@ default:
24
25
  host: localhost
25
26
  server: passenger
26
27
  shell: bash -l -c
28
+
29
+ # This is a custom configuration to be used wit -t or --target option.
30
+ # It inherits all the default configs, just changing the directory.
31
+ # It can be used like:
32
+ # $ traq -t custom
33
+ # or
34
+ # $ traq --target custom
27
35
  custom:
36
+ <<: *default
28
37
  directory: /tmp/traq_test_custom
29
- user: taq
30
- list:
31
- - Rakefile
32
- - config.ru
33
- - Gemfile
34
- - - config/application.rb
35
- - - config/environment.rb
36
- - - config/initializers/**/*
37
- - - config/environments/production.rb
38
- - - config/locales/**/*
39
- - - config/routes.rb
40
- - - app/**/*
41
- - - db/migrate/**/*
42
- - - public/javascripts/**/*
43
- - - public/stylesheets/**/*
44
- - - lib/**/*
45
- - - bin/**/*
46
- - - public/images/**/*
47
- - public/images/uploads/**/*
48
- password: fill your password here
49
- host: localhost
50
- shell: bash -l -c
data/config/default.yml CHANGED
@@ -14,9 +14,15 @@ list:
14
14
  - - config/boot.rb
15
15
  - - config/database.yml
16
16
  - - config/secrets.yml
17
+ - - config/storage.yml
17
18
  - - app/**/*
18
19
  - - db/migrate/**/*
19
20
  - - db/seeds.rb
21
+ - - public/404.html
22
+ - - public/422.html
23
+ - - public/500.html
24
+ - - public/favicon.ico
25
+ - - public/robots.txt
20
26
  - - public/javascripts/**/*
21
27
  - - public/stylesheets/**/*
22
28
  - - lib/**/*
data/config/proc.sh CHANGED
@@ -134,6 +134,15 @@ function migrate() {
134
134
  fi
135
135
  }
136
136
 
137
+ #
138
+ # Check if the channels dir exists
139
+ #
140
+ function channels() {
141
+ if [ ! -d app/assets/javascripts/channels ]; then
142
+ mkdir -p app/assets/javascripts/channels
143
+ fi
144
+ }
145
+
137
146
  #
138
147
  # Precompile assets if needed
139
148
  #
@@ -193,6 +202,47 @@ function sanity_check() {
193
202
  fi
194
203
  }
195
204
 
205
+ function activate_gems() {
206
+ msg "Activating gems on $(pwd) ..."
207
+
208
+ local GEMFILE_VERSION=""
209
+
210
+ if [ -z "$GEMFILE_VERSION" ] && [ -f Gemfile ]; then
211
+ msg "Trying find Ruby version on Gemfile ..."
212
+ GEMFILE_VERSION=$(grep -e "^ruby" Gemfile | cut -f2 -d' ' | tr -d "'")
213
+ fi
214
+
215
+ if [ -z "$GEMFILE_VERSION" ] && [ -f .ruby-version ]; then
216
+ msg "Trying find Ruby version on .ruby-version file ..."
217
+ GEMFILE_VERSION=$(cat .ruby-version)
218
+ fi
219
+
220
+ if [ -z "$GEMFILE_VERSION" ]; then
221
+ msg "\e[31mCould not determine Ruby version.\e[0m"
222
+ return
223
+ fi
224
+
225
+ local PROVIDER=$(gem_provider)
226
+ local RVM_LOCAL=$HOME/.rvm/scripts/rvm
227
+ local RVM_SYSTEM=/usr/local/rvm/scripts/rvm
228
+ local RVM_SOURCE=""
229
+
230
+ if [ "$PROVIDER" == "rvm" ]; then
231
+ msg "Activating $GEMFILE_VERSION on RVM ..."
232
+
233
+ if [ -f "$RVM_LOCAL" ]; then
234
+ msg "Activating local RVM ..."
235
+ RVM_SOURCE="$RVM_LOCAL"
236
+ else
237
+ msg "Activating system RVM ..."
238
+ RVM_SOURCE="$RVM_SYSTEM"
239
+ fi
240
+
241
+ source "$RVM_SOURCE"
242
+ rvm $GEMFILE_VERSION
243
+ fi
244
+ }
245
+
196
246
  # force the production enviroment
197
247
  export RAILS_ENV=production
198
248
 
@@ -249,8 +299,10 @@ safe_copy "${config_id}"
249
299
 
250
300
  # here is where things happens on the server
251
301
  install_new_files "${config_id}"
302
+ activate_gems
252
303
  fix_gems
253
304
  createdb
305
+ channels
254
306
  migrate
255
307
  assets
256
308
  permissions
data/config/traq.yml CHANGED
@@ -11,6 +11,7 @@ list:
11
11
  - - config/environments/production.rb
12
12
  - - config/locales/**/*
13
13
  - - config/routes.rb
14
+ - - config/storage.yml
14
15
  - - app/**/*
15
16
  - - db/migrate/**/*
16
17
  - - public/javascripts/**/*
data/gem-public_cert.pem CHANGED
@@ -1,22 +1,26 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9ldXN0
3
- YXF1aW9yYW5nZWwxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
4
- ARkWA2NvbTAeFw0xNzA2MDMyMjM3MjdaFw0xODA2MDMyMjM3MjdaMEYxGDAWBgNV
5
- BAMMD2V1c3RhcXVpb3JhbmdlbDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
6
- CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
7
- pI58OaGELZWRnqvArECgbbOOU5ThDxGRoBz/91KaXysVAalPUVtEXQjsZSc6wOKb
8
- a+m2vEZ6j1LWMfG1xKh07KN/EwcmUoG9uj/U+OcZ+M6YA+DSDBQJozXEUgKiD0e0
9
- crZqrq+Qo9jg19lPvYcsFS4WumC3gtrx8Fe8K5JTEFR71Md3nnuBuKp1pouYTC3b
10
- UQ2Xv1URDITKa3N3Kyu/6MJOYBJ2nvDKdEdMFbXxKiC/Njv7eIF+1iNWrzp8osgL
11
- 5LWITluL2n+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czXGs/RH1diJes5AihU97po1EVyVpxjkyiVZxd0fl+r3OR7iYSSNMrdpH
24
+ Ey5t62RSM7fM69lDtUa1Jmv/CCRAeeY4TQUFwDrnNYhxQshCWcrFWQMb4ExJtwbC
25
+ iQ4FrdvzJJS+rA==
22
26
  -----END CERTIFICATE-----
data/lib/bar.rb CHANGED
@@ -5,7 +5,7 @@ module Traquitana
5
5
 
6
6
  def initialize
7
7
  reset
8
- end
8
+ end
9
9
 
10
10
  def reset
11
11
  @name = nil
data/lib/cleaner.rb CHANGED
@@ -11,9 +11,9 @@ module Traquitana
11
11
  end
12
12
 
13
13
  def run
14
- STDOUT.print "Cleaning old files ... "
14
+ STDOUT.print 'Cleaning old files ... '
15
15
  @network.execute(["find #{@config.directory}/traq -type f -iname '*.zip' -o -iname '*.list' | sort | head -n-2 | xargs rm $1"])
16
- STDOUT.puts "done."
16
+ STDOUT.puts 'done.'
17
17
  end
18
18
  end
19
19
  end