gploy 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest ADDED
@@ -0,0 +1,17 @@
1
+ Manifest
2
+ Rakefile
3
+ bin/gploy
4
+ gploy.gemspec
5
+ lib/TODO.txt
6
+ lib/gploy.rb
7
+ lib/gploy/configure.rb
8
+ lib/gploy/helpers.rb
9
+ lib/gploy/logger.rb
10
+ lib/gploy/teste.rb
11
+ test/config/config.yaml
12
+ test/config/post-receive
13
+ test/db/schema.rb
14
+ test/helper.rb
15
+ test/suite.rb
16
+ test/test_configure.rb
17
+ test/test_logger.rb
data/Rakefile CHANGED
@@ -1,59 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rubygems/specification'
3
2
  require 'rake'
4
- require 'rake/gempackagetask'
5
- require 'spec/rake/spectask'
6
-
7
- GEM = "gploy"
8
- GEM_VERSION = "0.1.5"
9
- SUMMARY = "Simple gem to configure rails project deploy using git(locaweb server only)"
10
- AUTHOR = "Edipo Luis Federle"
11
- EMAIL = "edipofederle@gmail.com"
12
- HOMEPAGE = "http://edipolf.com"
13
-
14
-
15
- desc "Run all examples with RCov"
16
- Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
17
- t.spec_files = FileList['spec/*.rb']
18
- t.rcov = true
19
- t.rcov_opts = ['--exclude', 'spec']
20
-
21
- end
22
-
23
- spec = Gem::Specification.new do |s|
24
- s.name = GEM
25
- s.version = GEM_VERSION
26
- s.platform = Gem::Platform::RUBY
27
- s.summary = SUMMARY
28
- s.require_paths = ['bin', 'lib']
29
- s.executables = ["gploy"]
30
- s.add_dependency(%q<rubigen>, [">= 1.3.4"])
31
- s.files = FileList['bin/*', 'lib/**/*.rb', '[A-Z]*'].to_a
32
-
33
- s.author = AUTHOR
34
- s.email = EMAIL
35
- s.homepage = HOMEPAGE
36
-
37
- s.rubyforge_project = GEM # GitHub bug, gem isn't being build when this miss
38
- end
39
-
40
- Spec::Rake::SpecTask.new do |t|
41
- t.spec_files = FileList['spec/**/*_spec.rb']
42
- t.spec_opts = %w(-fs --color)
43
- end
44
-
45
- Rake::GemPackageTask.new(spec) do |pkg|
46
- pkg.gem_spec = spec
47
- end
48
-
49
- desc "Install the gem locally"
50
- task :install => [:package] do
51
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
52
- end
53
-
54
- desc "Create a gemspec file"
55
- task :make_spec do
56
- File.open("#{GEM}.gemspec", "w") do |file|
57
- file.puts spec.to_ruby
58
- end
59
- end
3
+ require 'echoe'
4
+
5
+ Echoe.new('gploy', '0.1.6') do |p|
6
+ p.description = "Rubygem simple to deploy rails app via git push"
7
+ p.url = "http://github.com/edipofederle/gploy"
8
+ p.author = "Edipo L Federle"
9
+ p.email = "edipofederle at gmail dot com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
data/bin/gploy CHANGED
@@ -1,30 +1,56 @@
1
1
  #!/usr/bin/env ruby
2
- require "rubygems"
3
- require "rubigen"
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ help = <<HELP
6
+
7
+ To learn about gploy visit github page at http://github.com/edipofederle/gploy or type rake -T to see all functions.
8
+
9
+ HELP
10
+
11
+ require 'optparse'
4
12
  require "gploy"
13
+ require "logger"
5
14
 
6
- if %w(-v --version).include? ARGV.first
7
- puts "#{File.basename($0)} - #{Gploy::Configure::VERSION}"
8
- exit(0)
15
+ exec = {}
16
+ options = {}
17
+ opts = OptionParser.new do |opts|
18
+ opts.banner = help
19
+ opts.on("--version", "Display current version") do
20
+ puts "Gploy " + Gploy::VERSION
21
+ exit 0
22
+ end
23
+
24
+ opts.on("--pr", "Create post-receive file") do
25
+ c = Gploy::Configure.new
26
+ c.configure_hook
27
+ end
28
+
29
+ opts.on("--setup", "Configure Project") do
30
+ c = Gploy::Configure.new
31
+ c.setup
32
+ end
33
+
34
+ opts.on("--update-hook", "Update Hook File") do
35
+ c = Gploy::Configure.new
36
+ c.upload_hook
37
+ end
38
+
39
+ opts.on("--deploy", "New Deploy") do
40
+ c = Gploy::Configure.new
41
+ c.new_deploy
42
+ end
43
+
44
+ opts.on("--configure", "Initial configuration") do
45
+ c = Gploy::Configure.new
46
+ c.configure_server
47
+ end
48
+
9
49
  end
10
50
 
11
- if %(-configure -c).include? ARGV.first
12
- c = Gploy::Configure.new
13
- c.configure_server
14
- end
15
- if %(-pr).include? ARGV.first
16
- c = Gploy::Configure.new
17
- c.configure_hook
18
- end
19
- if %(-setup -s).include? ARGV.first
20
- c = Gploy::Configure.new
21
- c.setup
22
- end
23
- if %(-update-hook -uh).include? ARGV.first
24
- c = Gploy::Configure.new
25
- c.upload_hook
51
+ opts.parse!
52
+ case ARGV.size
53
+ when 0
54
+ puts "Invalid options. Run `gploy --help` for assistance."
55
+ exit(1)
26
56
  end
27
- if %(-deploy -d).include? ARGV.first
28
- c = Gploy::Configure.new
29
- c.new_deploy
30
- end
data/gploy.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{gploy}
5
+ s.version = "0.1.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Edipo L Federle"]
9
+ s.date = %q{2011-05-14}
10
+ s.default_executable = %q{gploy}
11
+ s.description = %q{Rubygem simple to deploy rails app via git push}
12
+ s.email = %q{edipofederle at gmail dot com}
13
+ s.executables = ["gploy"]
14
+ s.extra_rdoc_files = ["bin/gploy", "lib/TODO.txt", "lib/gploy.rb", "lib/gploy/configure.rb", "lib/gploy/helpers.rb", "lib/gploy/logger.rb", "lib/gploy/teste.rb"]
15
+ s.files = ["Manifest", "Rakefile", "bin/gploy", "gploy.gemspec", "lib/TODO.txt", "lib/gploy.rb", "lib/gploy/configure.rb", "lib/gploy/helpers.rb", "lib/gploy/logger.rb", "lib/gploy/teste.rb", "test/config/config.yaml", "test/config/post-receive", "test/db/schema.rb", "test/helper.rb", "test/suite.rb", "test/test_configure.rb", "test/test_logger.rb", "test/test_configuration.rb"]
16
+ s.homepage = %q{http://github.com/edipofederle/gploy}
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gploy", "--main", "README.markdown"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{gploy}
20
+ s.rubygems_version = %q{1.6.2}
21
+ s.summary = %q{Rubygem simple to deploy rails app via git push}
22
+ s.test_files = ["test/test_configuration.rb", "test/test_configure.rb", "test/test_logger.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
data/lib/TODO.txt ADDED
@@ -0,0 +1 @@
1
+ - Arrumar testes que fazem uso de diretorios, criar e deletar(setup/teardown)
data/lib/gploy.rb CHANGED
@@ -1,2 +1,25 @@
1
- require "gploy/helpers"
2
- require "gploy/configure"
1
+ $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installedr"
2
+
3
+
4
+ def require_all(path)
5
+ glob = File.join(File.dirname(__FILE__), path, '*.rb')
6
+ Dir[glob].each do |f|
7
+ require f
8
+ end
9
+ end
10
+
11
+ require 'rubygems'
12
+
13
+ require "rubygems"
14
+ require 'net/ssh'
15
+ require 'fileutils'
16
+ require 'yaml'
17
+ require 'net/sftp'
18
+
19
+ require 'gploy/logger'
20
+ require 'gploy/helpers'
21
+ require 'gploy/configure'
22
+
23
+ module Gploy
24
+ VERSION = '0.1.6'
25
+ end
@@ -1,16 +1,16 @@
1
- require "rubygems"
2
- require 'net/ssh'
3
- require 'fileutils'
4
- require 'yaml'
5
- require 'net/sftp'
6
-
7
1
  module Gploy
2
+
8
3
  class Configure
9
-
10
- include Helpers
4
+ include Helpers
5
+
11
6
  VERSION = '0.1.5'
12
-
13
- def configure_server
7
+ def initialize
8
+ @path = "config/config.yaml"
9
+ end
10
+
11
+
12
+ def configure_server
13
+ log(green("Starting gploy configuration...create config.yaml"))
14
14
  create_file_and_direcotry_unless_exists("config", "config.yaml")
15
15
  puts "Files created into the config directory. Now need edit config.yaml"
16
16
  puts ""
@@ -20,16 +20,29 @@ module Gploy
20
20
  end
21
21
 
22
22
  def configure_hook
23
- read_config_file
23
+ config = read_config_file(@path)
24
+ @url = config["config"]["url"]
25
+ @app_name = config["config"]["app_name"]
26
+ @user = config["config"]["user"]
27
+ @password = config["config"]["password"]
28
+ @origin = config["config"]["origin"]
29
+ log("Configure Hook")
24
30
  create_file_and_direcotry_unless_exists("config", "post-receive")
25
31
  puts "Now you should edit config/post-receive file, like this:"
26
32
  puts ""
27
- post_commands
33
+ post_commands(config)
28
34
  end
29
35
 
30
36
  def setup
37
+ log("Starting gploy setup...")
38
+ config = read_config_file(@path)
39
+ @url = config["config"]["url"]
40
+ @app_name = config["config"]["app_name"]
41
+ @user = config["config"]["user"]
42
+ @password = config["config"]["password"]
43
+ @origin = config["config"]["origin"]
44
+ log("Start Setup...")
31
45
  check_if_dir_log_exists
32
- read_config_file
33
46
  remote
34
47
  initialize_local_repo
35
48
  create_repo(@app_name)
@@ -45,17 +58,25 @@ module Gploy
45
58
  end
46
59
 
47
60
  def upload_hook
48
- read_config_file
61
+ log("Realoding hook file...")
49
62
  remote
50
63
  update_hook(@user, @url, @app_name)
51
64
  puts "File successfully Updated"
52
65
  end
53
66
 
54
- def read_config_file
55
- config = YAML.load_file("config/config.yaml")
56
- config["config"].each { |key, value| instance_variable_set("@#{key}", value) }
67
+ def read_config_file(path)
68
+ begin
69
+ config = YAML.load_file(path)
70
+ raise "Invalid configuration - #{path}" if !config.is_a?(Hash)
71
+ $stderr.puts "Configuration ok from #{path}"
72
+ rescue => e
73
+ $stderr.puts "WARNING: I Could not read configuration file."
74
+ $stderr.puts "\t" + e.to_s
75
+ config = {}
76
+ end
77
+ config
57
78
  end
58
-
79
+
59
80
  def remote
60
81
  @shell = start(@url, @user, @password)
61
82
  end
@@ -115,7 +136,7 @@ module Gploy
115
136
  end
116
137
 
117
138
  def new_deploy
118
- read_config_file
139
+ read_config_file(path)
119
140
  run_local("git checkout #{@branch} - && git push #{@origin} master")
120
141
  end
121
142
 
@@ -135,5 +156,10 @@ module Gploy
135
156
  run_remote "cd rails_app/#{name}/ && mkdir tmp"
136
157
  end
137
158
 
159
+ def log(msg)
160
+ a = Time.now.strftime('%Y-%m-%d %H:%M:%S')
161
+ $stderr.puts(a + " " + msg)
162
+ end
163
+
138
164
  end
139
165
  end
data/lib/gploy/helpers.rb CHANGED
@@ -19,7 +19,6 @@ module Gploy
19
19
  end
20
20
 
21
21
  def run_remote(command)
22
- logger(command, "remote")
23
22
  @shell.exec!(command)
24
23
  end
25
24
 
@@ -28,7 +27,6 @@ module Gploy
28
27
  end
29
28
 
30
29
  def run_local(command)
31
- logger(command, "local")
32
30
  Kernel.system command
33
31
  end
34
32
 
@@ -53,26 +51,24 @@ module Gploy
53
51
  end
54
52
 
55
53
  def migrate(name)
54
+ log("Running DB:MIGRATE for #{name} app")
56
55
  if useMigrations?
57
- logger("Run db:migrate", "remote")
58
56
  run_remote "cd rails_app/#{name}/ && rake db:migrate RAILS_ENV=production"
59
57
  end
60
- logger("rake db:migrae => FALSE", nil)
61
58
  end
62
59
 
63
60
  def restart_server(name)
64
- logger("restart server", "remote")
65
61
  run_remote "cd rails_app/#{name}/tmp && touch restart.txt"
66
62
  end
67
63
 
68
- def post_commands
64
+ def post_commands(config)
69
65
  commands = <<CMD
70
66
  #!/bin/sh
71
- cd ~/rails_app/#{@app_name}
67
+ cd ~/rails_app/#{config["config"]["app_name"]}
72
68
  env -i git reset --hard
73
- env -i git pull #{@origin} master
69
+ env -i git pull #{config["config"]["origin"]} master
74
70
  env -i rake db:migrate RAILS_ENV=production
75
- env -i touch ~/rails_app/#{@app_name}/tmp/restart.txt
71
+ env -i touch ~/rails_app/#{config["config"]["app_name"]}/tmp/restart.txt
76
72
  CMD
77
73
  puts commands
78
74
  end
@@ -89,4 +85,16 @@ CMD
89
85
  puts commands
90
86
  end
91
87
  end
88
+
89
+ def colorize(text, color_code)
90
+ "#{color_code}#{text}e[0m"
91
+ end
92
+
93
+ def red(text)
94
+ colorize(text, "e[31m")
95
+ end
96
+ def green(text)
97
+ colorize(text, "e[32m")
98
+ end
99
+
92
100
  end
@@ -0,0 +1,8 @@
1
+ module Gploy
2
+ module Logger
3
+ def log(msg)
4
+ a = Time.now.strftime('%Y-%m-%d %H:%M:%S')
5
+ $stderr.puts(a + " " + msg)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Gploy
2
+ class Tese
3
+ include Helpers
4
+ end
5
+ end
File without changes
File without changes
data/test/db/schema.rb ADDED
File without changes
data/test/helper.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'mocha'
4
+ require 'shoulda'
5
+ require 'rr'
6
+ require File.join(File.dirname(__FILE__), *%w[.. lib gploy])
7
+
8
+ include Gploy
9
+ class Test::Unit::TestCase
10
+ include RR::Adapters::TestUnit
11
+ def dest_dir(*subdirs)
12
+ File.join(File.dirname(__FILE__), 'dest', *subdirs)
13
+ end
14
+
15
+ def source_dir(*subdirs)
16
+ File.join(File.dirname(__FILE__), 'source', *subdirs)
17
+ end
18
+
19
+ def clear_dest
20
+ FileUtils.rm_rf(dest_dir)
21
+ end
22
+
23
+
24
+ end
data/test/suite.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'test/unit'
2
+
3
+ #Run all tests.
4
+ tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"]
5
+ tests.each do |file|
6
+ require file
7
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+ class ConfigureTest < Test::Unit::TestCase
3
+
4
+ def setup
5
+ @path = File.join(Dir.pwd, '_config.yml')
6
+ end
7
+
8
+ def testLoadFileConfire
9
+ connection = Gploy::Configure.new
10
+ mock(YAML).load_file(@path){ Hash.new}
11
+ mock($stderr).puts("Configuration ok from #{@path}")
12
+ connection.read_config_file(@path)
13
+ end
14
+
15
+ def testBadConfi
16
+ connection = Gploy::Configure.new
17
+ mock(YAML).load_file(@path) { raise "No such file or directory - #{@path}" }
18
+ mock($stderr).puts("WARNING: I Could not read configuration file.")
19
+ mock($stderr).puts("\tNo such file or directory - #{@path}")
20
+ connection.read_config_file(@path)
21
+ end
22
+
23
+ end
@@ -0,0 +1,143 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+ class ConfigureTest < Test::Unit::TestCase
3
+
4
+ def testeOne
5
+ assert(true)
6
+ end
7
+
8
+ def setup
9
+
10
+ mockRespinse = mock("Net::SSH")
11
+ ssh = mock("Net::SSH")
12
+
13
+ @connection = Gploy::Configure.new
14
+
15
+ @connection.expects(:start).once.returns(@ssh)
16
+ @c = @connection.remote
17
+
18
+ @path = File.join(Dir.pwd, '_config.yml')
19
+
20
+ @url = "server_name"
21
+ @user = "user_name"
22
+ @password = "user_senha"
23
+ @app_name = "fake_project"
24
+ @origin = "production"
25
+ end
26
+
27
+
28
+ def testShouldReturnGemVersion
29
+ assert_not_nil(!nil,Gploy::Configure::VERSION)
30
+ assert_equal("0.1.6", Gploy::VERSION)
31
+ end
32
+ def testShouldHaveALogPath
33
+ assert_equal("./log/gploylog.log", Gploy::Configure::LOG_PATH);
34
+ end
35
+
36
+ def testCreateDirLogIfDontExist
37
+ dir_log = @connection.check_if_dir_log_exists
38
+ assert(dir_log, "Directory Log not found")
39
+ end
40
+
41
+ def testIfSomeDirectoryExist
42
+ no_dir = "fakedir"
43
+ assert_equal(false, @connection.dirExists?(no_dir))
44
+ assert_equal(true, @connection.dirExists?("log"))
45
+ end
46
+
47
+ def testOne
48
+ expect_command_local "chmod +x config/post-receive && scp config/post-receive #{@user}@#{@url}:repos/#{@app_name}.git/hooks/"
49
+ @connection.update_hook_into_server(@user, @url, @app_name)
50
+ end
51
+
52
+ def testUploadPostReceiveFile
53
+ expect_command_local "scp config/post-receive #{@user}@#{@url}:repos/#{@app_name}.git/hooks/"
54
+ @connection.update_hook(@user, @url, @app_name)
55
+ end
56
+
57
+ def testIfExistPostReceiveFileIntoConfigFolder
58
+ @connection.create_hook_file
59
+ assert File.exists?(File.join("config",'post-receive'))
60
+ end
61
+
62
+ def testReturnPathPostReceive
63
+ assert_equal("config/post-receive", @connection.path)
64
+ end
65
+
66
+ def testIfExistCofigFile
67
+ @connection.create_file_and_direcotry_unless_exists("config", "config.yaml")
68
+ assert File.exists?(File.join("config",'config.yaml'))
69
+ end
70
+
71
+ def testShouldReturnPathForHookFileIntoServer
72
+ assert_equal("~/repos/#{@name}.git/hooks/post-receive", @connection.path_hook(@name))
73
+ end
74
+
75
+ def testShouldCreateSysLinkIntoServer
76
+ expect_command_remote "ln -s ~/rails_app/#{@app_name}/public ~/public_html/#{@app_name}"
77
+ @connection.sys_link(@app_name)
78
+ end
79
+
80
+ def testShouldDreateTmpDirIntoProjectServer
81
+ expect_command_remote "cd rails_app/#{@app_name}/ && mkdir tmp"
82
+ @connection.tmp_create(@app_name)
83
+ end
84
+
85
+ def testShouldCreateAndInitializeRepoIntoServer
86
+ expect_command_remote "cd repos/ && mkdir nome.git && cd nome.git && git init --bare"
87
+ @connection.create_repo("nome")
88
+ end
89
+
90
+ def testShouldAddGitRemoteInLocalProject
91
+ expect_command_local "git remote add #{@origin} #{@user}@#{@url}:~/repos/#{@app_name}.git"
92
+ @connection.add_remote(@url, @user, @app_name, @origin)
93
+ end
94
+
95
+ def testShoulRunCloneIntoServer
96
+ # @logger.expects(:log).once.with(instance_of(String))
97
+ expect_command_remote "git clone ~/repos/#{@app_name}.git ~/rails_app/#{@app_name}"
98
+ @connection.clone(@app_name)
99
+ end
100
+
101
+ def testShouldRunCloneIntoServer2
102
+ expect_command_remote "git clone repos/#{@app_name}.git ~/rails_app/#{@app_name}"
103
+ @connection.clone_into_server(@app_name)
104
+ end
105
+
106
+ def testShouldRunPushMaster
107
+ # @logger.expects(:log).once.with(instance_of(String))
108
+ expect_command_local "git checkout master && git push #{@origin} master"
109
+ @connection.push_local(@origin)
110
+ end
111
+
112
+ def tesShouldNotRunMigrateTask
113
+ @connection.migrate(@app_name)
114
+ end
115
+
116
+ def testShouldRestartServer
117
+ expect_command_remote("cd rails_app/#{@app_name}/tmp && touch restart.txt")
118
+ @connection.restart_server(@app_name)
119
+ end
120
+
121
+ #FIX THIS TEST
122
+ def RtestShouldRunMigrateTask
123
+ FileUtils.remove_dir("db")
124
+ #Dir.mkdir("db")
125
+ FileUtils.touch("db/schema.rb")
126
+ expect_command_remote "cd rails_app/#{@app_name}/ && rake db:migrate RAILS_ENV=production"
127
+ @connection.migrate(@app_name)
128
+ end
129
+
130
+ def testLogMessage
131
+ a = Time.stubs(:now).returns(Time.mktime(1970,1,1))
132
+ mock($stderr).puts(Time.now.strftime('%Y-%m-%d %H:%M:%S') + " Hello")
133
+ @connection.log("Hello")
134
+ end
135
+
136
+ def expect_command_local(command)
137
+ Kernel.expects(:system).with(command)
138
+ end
139
+
140
+ def expect_command_remote(command)
141
+ @c.expects(:exec!).with(command)
142
+ end
143
+ end
File without changes
metadata CHANGED
@@ -1,81 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gploy
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
4
+ prerelease:
5
+ version: 0.1.6
10
6
  platform: ruby
11
7
  authors:
12
- - Edipo Luis Federle
8
+ - Edipo L Federle
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-07-30 00:00:00 -03:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rubigen
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 3
30
- - 4
31
- version: 1.3.4
32
- type: :runtime
33
- version_requirements: *id001
34
- description:
35
- email: edipofederle@gmail.com
13
+ date: 2011-05-14 00:00:00 -03:00
14
+ default_executable: gploy
15
+ dependencies: []
16
+
17
+ description: Rubygem simple to deploy rails app via git push
18
+ email: edipofederle at gmail dot com
36
19
  executables:
37
20
  - gploy
38
21
  extensions: []
39
22
 
40
- extra_rdoc_files: []
41
-
42
- files:
23
+ extra_rdoc_files:
43
24
  - bin/gploy
25
+ - lib/TODO.txt
26
+ - lib/gploy.rb
44
27
  - lib/gploy/configure.rb
45
28
  - lib/gploy/helpers.rb
46
- - lib/gploy.rb
29
+ - lib/gploy/logger.rb
30
+ - lib/gploy/teste.rb
31
+ files:
32
+ - Manifest
47
33
  - Rakefile
48
- - README.markdown
34
+ - bin/gploy
35
+ - gploy.gemspec
36
+ - lib/TODO.txt
37
+ - lib/gploy.rb
38
+ - lib/gploy/configure.rb
39
+ - lib/gploy/helpers.rb
40
+ - lib/gploy/logger.rb
41
+ - lib/gploy/teste.rb
42
+ - test/config/config.yaml
43
+ - test/config/post-receive
44
+ - test/db/schema.rb
45
+ - test/helper.rb
46
+ - test/suite.rb
47
+ - test/test_configure.rb
48
+ - test/test_logger.rb
49
+ - test/test_configuration.rb
49
50
  has_rdoc: true
50
- homepage: http://edipolf.com
51
+ homepage: http://github.com/edipofederle/gploy
51
52
  licenses: []
52
53
 
53
54
  post_install_message:
54
- rdoc_options: []
55
-
55
+ rdoc_options:
56
+ - --line-numbers
57
+ - --inline-source
58
+ - --title
59
+ - Gploy
60
+ - --main
61
+ - README.markdown
56
62
  require_paths:
57
- - bin
58
63
  - lib
59
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
60
66
  requirements:
61
67
  - - ">="
62
68
  - !ruby/object:Gem::Version
63
- segments:
64
- - 0
65
69
  version: "0"
66
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
67
72
  requirements:
68
73
  - - ">="
69
74
  - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- version: "0"
75
+ version: "1.2"
73
76
  requirements: []
74
77
 
75
78
  rubyforge_project: gploy
76
- rubygems_version: 1.3.6
79
+ rubygems_version: 1.6.2
77
80
  signing_key:
78
81
  specification_version: 3
79
- summary: Simple gem to configure rails project deploy using git(locaweb server only)
80
- test_files: []
81
-
82
+ summary: Rubygem simple to deploy rails app via git push
83
+ test_files:
84
+ - test/test_configuration.rb
85
+ - test/test_configure.rb
86
+ - test/test_logger.rb
data/README.markdown DELETED
@@ -1,108 +0,0 @@
1
- Version 0.1.5 brings some improvements in the way it will deploy.
2
-
3
- Notes Version 0.1.5
4
- A new command called gploy -d
5
- The log file was also changed to indicate that the command was run locally or remotely.
6
-
7
- ## Introduction
8
-
9
- 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.
10
-
11
- ## What directory structure is used
12
- This gem use a structure in webserver like this:
13
-
14
- 1. ~/repos -> For host a git repository
15
- 2. ~/rails_app -> For host your production project
16
- 3. ~/public_html -> For create a symlink to the project in rails_app directory
17
-
18
- ## Files generated
19
- This gem generate only two simple file into the config directory, one file is called config.yaml and other is post-receive.
20
-
21
- ### The config.yaml file:
22
-
23
- The contents of this file must be like this:
24
-
25
- config:
26
- url: host
27
- user: username
28
- password: password
29
- app_name: project_name
30
- origin: git origin
31
-
32
- If your git is already configured for origin use another, for example: production
33
-
34
- ### The post-receive file:
35
-
36
- The contents of this file must be like this:
37
-
38
- #!/bin/sh
39
- cd ~/rails_app/project_name
40
- env -i git reset --hard
41
- env -i git pull project_name master
42
- env -i rake db:migrate RAILS_ENV=production
43
- env -i touch ~/rails_app/project_name/tmp/restart.txt
44
-
45
- 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)
46
-
47
- ## Usage
48
- First thing you must do is install the gploy gem in your computer:
49
-
50
- sudo gem install gploy
51
-
52
- after it inside your rails project your must execute the following commands:
53
-
54
- > gploy -c // For generate config.yaml file
55
-
56
- Now you can edit this file with your data, make sure you not have a origin set in git if you will use it.
57
-
58
- 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:
59
-
60
- > gploy -pr // For generate post-receive file
61
-
62
- This command will generate a snippet like this:
63
-
64
- #!/bin/sh
65
- cd ~/rails_app/project_name
66
- env -i git reset --hard
67
- env -i git pull project_name master
68
- env -i rake db:migrate RAILS_ENV=production
69
- env -i touch ~/rails_app/project_name/tmp/restart.txt
70
-
71
- Put it inside the config/post-receive file. You can add more commands in the post-receive file if you want.
72
-
73
- Finally now you can run the command that will upload your project to the server and do what needs to be done:
74
-
75
- > gploy -s
76
-
77
- If no error occurs, your project must be available now.
78
-
79
- 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 or run:
80
-
81
- > gploy -d
82
- #OBS: This is a initial version then careful when using it. If you find bugs please let me know, fell free for make a fork in project at [github](http://github.com/edipofederle/gploy) and fix the bugs :D.
83
-
84
-
85
- ## LICENSE:
86
-
87
- (The MIT License)
88
-
89
- Copyright (c) 2008 Edipo Luis Federle
90
-
91
- Permission is hereby granted, free of charge, to any person obtaining
92
- a copy of this software and associated documentation files (the
93
- 'Software'), to deal in the Software without restriction, including
94
- without limitation the rights to use, copy, modify, merge, publish,
95
- distribute, sublicense, and/or sell copies of the Software, and to
96
- permit persons to whom the Software is furnished to do so, subject to
97
- the following conditions:
98
-
99
- The above copyright notice and this permission notice shall be
100
- included in all copies or substantial portions of the Software.
101
-
102
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
103
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
106
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
107
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
108
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.