gploy 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -1,3 +1,5 @@
1
+ This is version 0.1.4, it has small change in the code, removing some duplication. Also a new method for logs, and other functionality that is now the only gem wheel task migration database when necessary.
2
+
1
3
  ## Introduction
2
4
 
3
5
  This is a simple RubyGems to configure your Rails Project for deployment using git push, this gem only make a series of configurations in your local project and to in your web server. This gem consider what you are using locaweb to host your project and using git obviously.
@@ -14,7 +16,7 @@ This gem generate only two simple file into the config directory, one file is ca
14
16
 
15
17
  ### The config.yaml file:
16
18
 
17
- The contents of this file should be like this:
19
+ The contents of this file must be like this:
18
20
 
19
21
  config:
20
22
  url: host
@@ -27,7 +29,7 @@ If your git is already configured for origin use another, for example: productio
27
29
 
28
30
  ### The post-receive file:
29
31
 
30
- The contents of this file should be like this:
32
+ The contents of this file must be like this:
31
33
 
32
34
  #!/bin/sh
33
35
  cd ~/rails_app/project_name
@@ -39,17 +41,17 @@ The contents of this file should be like this:
39
41
  The post-receive file is a git hook, read more about hooks at: [www.ru.kernel.org](http://www.ru.kernel.org/pub/software/scm/git/docs/v1.5.2.5/hooks.html)
40
42
 
41
43
  ## Usage
42
- First thing you should do is install the gploy gem in your computer:
44
+ First thing you must do is install the gploy gem in your computer:
43
45
 
44
46
  sudo gem install gploy
45
47
 
46
- after it inside your rails project your should execute the following commands:
48
+ after it inside your rails project your must execute the following commands:
47
49
 
48
50
  > gploy -c // For generate config.yaml file
49
51
 
50
52
  Now you can edit this file with your data, make sure you not have a origin set in git if you will use it.
51
53
 
52
- Now lets generate a post-receive file, this file is a git hook, and should have commands that you want that are executed when your run git push in your project, for this execute:
54
+ Now lets generate a post-receive file, this file is a git hook, and must have commands that you want that are executed when your run git push in your project, for this execute:
53
55
 
54
56
  > gploy -pr // For generate post-receive file
55
57
 
@@ -68,7 +70,7 @@ Finally now you can run the command that will upload your project to the server
68
70
 
69
71
  > gploy -s
70
72
 
71
- If no error occurs, your project should be available now.
73
+ If no error occurs, your project must be available now.
72
74
 
73
75
  From now when you want update your project simply do a commit of changes and run git push production master to update project in server.
74
76
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "gploy"
8
- GEM_VERSION = "0.1.3"
8
+ GEM_VERSION = "0.1.4"
9
9
  SUMMARY = "Simple gem to configure rails project deploy using git(locaweb server only)"
10
10
  AUTHOR = "Edipo Luis Federle"
11
11
  EMAIL = "edipofederle@gmail.com"
@@ -9,6 +9,7 @@ module Gploy
9
9
 
10
10
  include Helpers
11
11
  VERSION = '0.1.3'
12
+
12
13
 
13
14
  def configure_server
14
15
  create_file_and_direcotry_unless_exists("config", "config.yaml")
@@ -29,6 +30,7 @@ module Gploy
29
30
  end
30
31
 
31
32
  def setup
33
+ check_if_dir_log_exists
32
34
  read_config_file
33
35
  remote
34
36
  initialize_local_repo
@@ -56,7 +58,6 @@ module Gploy
56
58
  end
57
59
 
58
60
  def run_tasks
59
- puts "Run db:migrate and Restart Server"
60
61
  migrate(@app_name)
61
62
  restart_server(@app_name)
62
63
  end
data/lib/gploy/helpers.rb CHANGED
@@ -1,14 +1,25 @@
1
- require 'logger'
2
-
3
1
  module Gploy
4
2
  module Helpers
3
+ LOG_PATH = './log/gploylog.log'
5
4
 
6
- def log(msg)
5
+ def check_if_dir_log_exists
6
+ unless dirExists?("log")
7
+ Dir.mkdir("log")
8
+ false
9
+ else
10
+ true
11
+ end
12
+ end
13
+
14
+ def logger(msg)
7
15
  puts "--> #{msg}"
16
+ File.open(LOG_PATH, 'a+') do |f|
17
+ f.puts "#{Time.now} => #{msg}"
18
+ end
8
19
  end
9
20
 
10
21
  def run_remote(command)
11
- log(command)
22
+ logger(command)
12
23
  @shell.exec!(command)
13
24
  end
14
25
 
@@ -17,7 +28,7 @@ module Gploy
17
28
  end
18
29
 
19
30
  def run_local(command)
20
- log(command)
31
+ logger(command)
21
32
  Kernel.system command
22
33
  end
23
34
 
@@ -42,9 +53,21 @@ module Gploy
42
53
  def update_hook(username, url, name)
43
54
  run_local "scp config/post-receive #{username}@#{url}:repos/#{name}.git/hooks/"
44
55
  end
56
+
57
+ def useMigrations?
58
+ if File.exists?("db/schema.rb")
59
+ true
60
+ else
61
+ false
62
+ end
63
+ end
45
64
 
46
65
  def migrate(name)
47
- run_remote "cd rails_app/#{name}/ && rake db:migrate RAILS_ENV=production"
66
+ if useMigrations?
67
+ logger("Run db:migrate")
68
+ run_remote "cd rails_app/#{name}/ && rake db:migrate RAILS_ENV=production"
69
+ end
70
+ logger("Projet dont use Migrations yet")
48
71
  end
49
72
 
50
73
  def restart_server(name)
@@ -76,4 +99,4 @@ CMD
76
99
  puts commands
77
100
  end
78
101
  end
79
- end
102
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Edipo Luis Federle
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-26 00:00:00 -03:00
17
+ date: 2010-05-21 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency