traquitana 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -43,24 +43,34 @@ Or install it yourself as:
43
43
  - - public/images/**/*
44
44
  - public/images/uploads/**/*
45
45
 
46
- On this example, all below public/images will be send BUT ignoring what is on public/images/uploads. This is a way to
47
- make sure you'll not overwrite some production files with your development versions.
46
+ On this example, all below public/images will be send BUT ignoring what is on
47
+ public/images/uploads. This is a way to make sure you'll not overwrite some
48
+ production files with your development versions.
49
+
50
+ - PLEASE PLEASE PLEASE configure this file. You can create an app on your
51
+ localhost and make some tests on it 'till you think is safe deal with real
52
+ apps on production servers.
48
53
 
49
- - PLEASE PLEASE PLEASE configure this file. You can create an app on your localhost and
50
- make some tests on it 'till you think is safe deal with real apps on production servers.
51
54
  - Run traq (just type traq).
52
55
  - It will search for changed files
53
56
  - Will create a list with the file names found
54
57
  - Will zíp the files.
55
58
  - Will send the list to the server, together with some control files.
56
- - What the control files deal: they are shell scripts that will zip the old files (based on what new files are going),
57
- unzip the new files, run migrations if needed and restart the web server. There are two files: one generic to make all
58
- sort of things BUT not restarting the web server. The webserver script will be send based on what webserver you need.
59
- - Now everything should be updated. On the next time you want to update your project, just run traq again.
59
+ - What the control files are for: they are shell scripts that will zip the
60
+ old files (based on what new files are going), unzip the new files, run
61
+ migrations if needed, run bundle install if the Gemfile contents changed
62
+ and restart the web server. There are two files: one generic to make all
63
+ sort of things BUT not restarting the web server. The webserver script will
64
+ be send based on what webserver you need.
65
+
66
+ - Now everything should be updated. On the next time you want to update your
67
+ project, just run traq again.
60
68
 
61
- * The list and the zip file created with the old files will be used on future versions as a rollback feature.
69
+ * The list and the zip file created with the old files will be used on future
70
+ versions as a rollback feature.
62
71
 
63
- Use for your risk. I think it's all ok but I don't give you guarantee if it break something.
72
+ Use for your risk. I think it's all ok but I don't give you guarantee if it
73
+ break something.
64
74
 
65
75
  ## Contributing
66
76
 
data/config/proc.sh CHANGED
@@ -1,3 +1,17 @@
1
+ function msg() {
2
+ local str="$1"
3
+ local verbose="$2"
4
+ local newline="$3"
5
+ if [ "$verbose" != "true" ]; then
6
+ return 1
7
+ fi
8
+ if [ "$newline" == "true" ]; then
9
+ echo "$str"
10
+ else
11
+ echo -n "$str"
12
+ fi
13
+ }
14
+
1
15
  # force the production enviroment
2
16
  export RAILS_ENV=production
3
17
 
@@ -8,46 +22,46 @@ cd $1/..
8
22
  verbose="$3"
9
23
 
10
24
  # make a copy of the old contents
11
- if [ "$verbose" == "true" ]; then
12
- echo -n "Making a safety copy of the old contents on traq/$2 ... "
13
- fi
25
+ msg "Making a safety copy of the old contents on traq/$2 ... " "$verbose" "false"
14
26
  zip -q traq/$2.safe.zip `cat traq/$2.list` &> /dev/null
15
- if [ "$verbose" == "true" ]; then
16
- echo "done."
17
- fi
27
+ msg "done." "$verbose" "true"
28
+
29
+ # check the current Gemfile checksum
30
+ old_gemfile_md5=$(md5sum Gemfile 2> /dev/null | cut -f1 -d' ')
18
31
 
19
32
  # install the new files
20
- echo -n "Unzipping $2.zip ... "
33
+ msg "Unzipping $2.zip ... " "true" "false"
21
34
  unzip -o traq/$2.zip &> /dev/null
22
- echo "done."
35
+ msg "done." "true" "true"
36
+
37
+ # check the new Gemfile checksum
38
+ new_gemfile_md5=$(md5sum Gemfile 2> /dev/null | cut -f1 -d' ')
39
+
40
+ # if the current Gemfile is different, run bundle install
41
+ if [ "$old_gemfile_md5" != "$new_gemfile_md5" ]; then
42
+ msg "Running bundle install ..." "$verbose" "true"
43
+ bundle install
44
+ fi
23
45
 
24
46
  # run migrations if needed
25
47
  migrations=$(grep "^db/migrate" traq/$2.list)
26
48
  if [ -n "$migrations" ]; then
27
- echo "Running migrations ... "
49
+ msg "Running migrations ... " "true" "true"
28
50
  bundle exec rake db:migrate 2> /dev/null
29
- echo "Migrations done."
51
+ msg "Migrations done." "true" "true"
30
52
  fi
31
53
 
32
54
  # precompile assets if needed
33
55
  if [ -d app/assets ]; then
34
- if [ "$verbose" == "true" ]; then
35
- echo -n "Compiling assets ... "
36
- fi
56
+ msg "Compiling assets ... " "$verbose" "false"
37
57
  bundle exec rake assets:precompile 2> /dev/null
38
- if [ "$verbose" == "true" ]; then
39
- echo "done."
40
- fi
58
+ msg "done." "$verbose" "true"
41
59
  fi
42
60
 
43
61
  # change file permissions on public dir
44
- if [ "$verbose" == "true" ]; then
45
- echo -n "Changing file permissions on public to 0755 ... "
46
- fi
62
+ msg "Changing file permissions on public to 0755 ... " "$verbose" "false"
47
63
  chmod -R 0755 public/*
48
- if [ "$verbose" == "true" ]; then
49
- echo "done."
50
- fi
64
+ msg "done." "$verbose" "true"
51
65
 
52
66
  # restart server
53
67
  if [ -x ./traq/server.sh -a -f ./traq/server.sh ]; then
@@ -1,3 +1,3 @@
1
1
  module Traquitana
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -9,6 +9,6 @@ describe Traquitana::Selector do
9
9
 
10
10
  it "should return the file list" do
11
11
  list = Traquitana::Selector.new(File.expand_path(File.dirname(__FILE__))+"/config/").files
12
- list.size.must_equal 23
12
+ list.size.must_equal 24
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traquitana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-22 00:00:00.000000000Z
12
+ date: 2012-08-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
16
- requirement: &76789160 !ruby/object:Gem::Requirement
16
+ requirement: &81789340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *76789160
24
+ version_requirements: *81789340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-ssh
27
- requirement: &76788900 !ruby/object:Gem::Requirement
27
+ requirement: &81789010 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *76788900
35
+ version_requirements: *81789010
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: net-scp
38
- requirement: &76788660 !ruby/object:Gem::Requirement
38
+ requirement: &81788670 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *76788660
46
+ version_requirements: *81788670
47
47
  description: Simple tool for deploy Rails apps
48
48
  email:
49
49
  - eustaquiorangel@gmail.com
@@ -78,6 +78,7 @@ files:
78
78
  - spec/cleaner_spec.rb
79
79
  - spec/config/Gemfile
80
80
  - spec/config/Rakefile
81
+ - spec/config/app/assets/javascripts/application.js.scss
81
82
  - spec/config/app/controllers/people_controller.rb
82
83
  - spec/config/app/models/people.rb
83
84
  - spec/config/app/views/people/index.html.erb
@@ -143,6 +144,7 @@ test_files:
143
144
  - spec/cleaner_spec.rb
144
145
  - spec/config/Gemfile
145
146
  - spec/config/Rakefile
147
+ - spec/config/app/assets/javascripts/application.js.scss
146
148
  - spec/config/app/controllers/people_controller.rb
147
149
  - spec/config/app/models/people.rb
148
150
  - spec/config/app/views/people/index.html.erb