railsmachine 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ setup_rdoc ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
15
15
  desc "Does a full compile, test run"
16
16
  task :default => [:test, :package]
17
17
 
18
- version="1.0.4"
18
+ version="1.0.5"
19
19
  name="railsmachine"
20
20
 
21
21
  setup_gem(name, version) do |spec|
@@ -8,6 +8,7 @@ Capistrano::Configuration.instance(:must_exist).load do
8
8
  set :app_server, :mongrel
9
9
  set :db_adapter, :mysql
10
10
  set :rails_env, "production"
11
+ set :domain, nil
11
12
 
12
13
  # mongrel defaults
13
14
  set :mongrel_servers, 2
@@ -28,7 +29,7 @@ Capistrano::Configuration.instance(:must_exist).load do
28
29
  set :use_mod_rewrite, false
29
30
 
30
31
  # apache defaults
31
- set :apache_server_name, nil
32
+ set :apache_server_name, nil
32
33
  set :apache_conf, nil
33
34
  set :apache_default_vhost, false
34
35
  set :apache_default_vhost_conf, nil
@@ -217,7 +218,6 @@ Capistrano::Configuration.instance(:must_exist).load do
217
218
  task :setup, :roles => :scm do
218
219
  begin
219
220
  sudo "chown -R #{user}:#{user} #{deploy_to.gsub(application,'')}"
220
- dump_settings
221
221
  localrepo.setup
222
222
  rescue
223
223
  puts "repos:setup failed!"
@@ -1,8 +1,8 @@
1
1
  require 'fileutils'
2
2
  Capistrano::Configuration.instance(:must_exist).load do
3
-
3
+
4
4
  namespace :localrepo do
5
-
5
+
6
6
  desc "Setup directory structure and initialize git repository on remote server"
7
7
  task :setup, :roles => :scm do
8
8
  dir = "#{deploy_to}/repos/#{application}.git"
@@ -15,30 +15,42 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  desc "Import code into remote git repository."
16
16
  task :import do
17
17
  puts "Initializing local git repository"
18
- system "git init"
18
+ system "git init" unless File.directory?(".git")
19
19
 
20
20
  puts "Adding remote server pointing to #{repository}"
21
- system "git remote add origin #{repository}"
21
+ remotes = `git remote`.split("\n").map {|r| `git remote show #{r}`}
22
+ remote_name = if existing_remote = remotes.find {|r| r =~ /URL: #{Regexp.escape(repository)}/ }
23
+ existing_remote.match(/\* remote (.*)$/)[1]
24
+ elsif remotes.any? {|r| r =~ /\* remote origin$/ }
25
+ Capistrano::CLI.ui.ask("Remote 'origin' already exists. Please name the remote you want to create:")
26
+ else
27
+ 'origin'
28
+ end
29
+ unless existing_remote
30
+ system "git remote add #{remote_name} #{repository}"
31
+ end
22
32
 
23
33
  puts "Adding .gitignore file"
24
- system "echo 'log/*'>> .gitignore"
25
- system "echo 'tmp/*'>> .gitignore"
26
- system "echo '.DS_Store'>> .gitignore"
27
- system "echo 'public/cache/**/*'>> .gitignore"
28
- system "git add .gitignore"
29
-
30
- puts "Committing application locally"
31
- system "git add *"
32
- system 'git commit -a -v -m "initial import of site"'
33
-
34
- puts "Pushing application to the remote server. The name of the branch is:"
35
- system "git remote"
36
- system "git push origin master"
37
-
34
+ ignores = File.exist?('.gitignore') ? File.read('.gitignore') : ''
35
+ system "echo 'log/*'>> .gitignore" unless ignores =~ %r{log/\*}
36
+ system "echo 'tmp/*'>> .gitignore" unless ignores =~ %r{tmp/\*}
37
+ system "echo '.DS_Store'>> .gitignore" unless ignores =~ %r{\.DS_Store}
38
+ system "echo 'public/cache/**/*'>> .gitignore" unless ignores =~ %r{public/cache/\*\*/\*}
39
+ system "git add .gitignore && git commit -v -m 'Add ignores.'" if `git status` =~ %r{\.gitignore}
40
+
41
+ unless `git status` =~ /working directory clean/
42
+ puts "Committing application locally"
43
+ system "git add *"
44
+ system 'git commit -a -v -m "Import for RailsMachine"'
45
+ end
46
+
47
+ puts "Pushing application to the remote server '#{remote_name}'."
48
+ system "git push #{remote_name} master"
49
+
38
50
  puts "git setup complete"
39
51
  puts "You can clone this repository with git clone #{repository} #{application}"
40
52
  end
41
-
53
+
42
54
  end
43
-
55
+
44
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsmachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rails Machine
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-30 00:00:00 -05:00
12
+ date: 2009-01-13 00:00:00 -05:00
13
13
  default_executable: railsmachine
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency