derpy 1.1.6 → 2.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- data.tar.gz: 14bacecf9744417e9013c86d53ca8a77a5565e21
4
- metadata.gz: 74e2ba385b02661131ca11e4a341d22839ad0993
3
+ data.tar.gz: d9077f8b38d3981e7a637cf797e43e2fa3493fd6
4
+ metadata.gz: 4a158887e27a8c5514f1e94d6e8340764f6f69aa
5
5
  SHA512:
6
- data.tar.gz: e3d620fb5dbcf0483909228f823942891a21c7c3424befce4ea1abc78c6e3741eb0bffa2083b5336df4b1306764fb8f4a3fa63dfb99724e0f8ff2f7754d69db5
7
- metadata.gz: a732220563d00c092069e000df8417cf2cf914d6d7a5121472f48b214369077611c8ccd9c3e9f03b1db83d5ef199392d4b9d1dc6b8a1c84bccc29e8b5a856fdb
6
+ data.tar.gz: 6b888e3ed41adef70f3902f71685cfa2b1a9c4c16563c9808b041a720aeab2589a258c21f4066af2477e95fb258699c3b72805dd53a61c2bdabc8b20c3d88536
7
+ metadata.gz: d49579647e102794960c4ff233d69c10e944b4a847bcd8be4e64b628e19e47743a6191d6594c1d5e7acc74fac2432999f1b7e4898720ff1e46e652e05ff16d95
data/README.markdown CHANGED
@@ -47,7 +47,11 @@ After that you can do incremental updates with: "derpy deploy"
47
47
 
48
48
  ### Derpy
49
49
 
50
- The command "derpy" is an alias that calls the required Capistrano task, just to be fancy.
50
+ The command "derpy build" can be used to install a new Drupal site with the 3SIGN makefile and profile.
51
+
52
+ $ derpy build [sitename]
53
+
54
+ All other arguments for "derpy" are aliases that call the required Capistrano tasks, just to be fancy.
51
55
  Specify the "-T" parameter to get a list of all available tasks.
52
56
 
53
57
  $ derpy -T
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6
1
+ 2.0.0
data/bin/derpify CHANGED
@@ -36,6 +36,7 @@ def unindent(string)
36
36
  end
37
37
 
38
38
  dirname = File.basename(File.expand_path(ARGV[0]))
39
+ source = File.expand_path(File.dirname(__FILE__)) + "/../templates/"
39
40
 
40
41
  files = {
41
42
  "Capfile" => unindent(<<-FILE),
@@ -44,52 +45,9 @@ files = {
44
45
  load 'config/deploy'
45
46
  FILE
46
47
 
47
- "config/deploy.rb" => 'set :stages, %w(staging production)
48
- set :default_stage, "staging"
49
- require "capistrano/ext/multistage"
50
-
51
- set :application, "' + dirname + '"
52
- set :local_database, "' + dirname + '" # optional, used with manage:pull_dump
53
- set :repository, "git@git.3sign.com:git/' + dirname + '/' + dirname + '.git"
54
- ',
55
- "config/deploy/staging.rb" => '# SERVER
56
- set :user, "staging"
57
- set :runner_group, "staging"
58
- set :deploy_to, "/home/staging/public_html/' + dirname + '/"
59
- server "rd", :app, :web, :db, :primary => true
60
-
61
- # GIT
62
- set :branch, "master"
63
-
64
- # STAGING DB
65
- set :db_type, "mysql"
66
- set :db_name, "staging_' + dirname + '"
67
- set :db_username, "staging_' + dirname + '"
68
- set :db_password, "####"
69
- set :db_host, "localhost"
70
- set :push_dump_enabled, true # optional, enables manage:push_dump (dangerous)
71
-
72
- after "deploy:update", "deploy:cleanup"
73
- ',
74
- "config/deploy/production.rb" => '# SERVER
75
- set :user, "' + dirname + '"
76
- set :runner_group, "' + dirname + '"
77
- set :deploy_to, "/home/' + dirname + '/public_html/"
78
- server "rd", :app, :web, :db, :primary => true
79
-
80
- # GIT
81
- set :branch, "master"
82
-
83
- # PRODUCTION DB
84
- set :db_type, "mysql"
85
- set :db_name, "' + dirname + '_db"
86
- set :db_username, "' + dirname + '_usr"
87
- set :db_password, "####"
88
- set :db_host, "localhost"
89
- set :push_dump_enabled, true # optional, enables manage:push_dump (dangerous)
90
-
91
- after "deploy:update", "deploy:cleanup"
92
- '
48
+ "config/deploy.rb" => File.read(source + "deploy.rb").gsub('[sitename]',dirname),
49
+ "config/deploy/staging.rb" => File.read(source + "staging.rb").gsub('[sitename]',dirname),
50
+ "config/deploy/production.rb" => File.read(source + "production.rb").gsub('[sitename]',dirname)
93
51
  }
94
52
 
95
53
  base = ARGV.shift
@@ -113,4 +71,4 @@ puts "[done] derpified!"
113
71
 
114
72
  puts ""
115
73
  puts 'After editing your config files just run: "derpy deploy:cold" to setup from scratch.'
116
- puts 'After that you can do incremental updates with: "derpy deploy"'
74
+ puts 'After that you can do incremental updates with: "derpy deploy".'
data/bin/derpy CHANGED
@@ -1,4 +1,87 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'capistrano/cli'
4
- Capistrano::CLI.execute
4
+ require 'fileutils'
5
+
6
+ def derpy_capistrano
7
+ Capistrano::CLI.execute
8
+ end
9
+
10
+ def derpy_install
11
+ # make sure the user provided a target directory
12
+ if ARGV.length == 1
13
+ abort "Please specify the target directory."
14
+ # make sure the user didn't provide too many arguments
15
+ elsif ARGV.length > 2
16
+ abort "Too many arguments; please specify only the target directory."
17
+ end
18
+
19
+ # set the target directory
20
+ site_target_dir = ARGV[1]
21
+
22
+ # check if the target directory exists
23
+ if Dir.exists?(site_target_dir)
24
+ abort "Error: The target directory already exists."
25
+ end
26
+
27
+ # make remote repos
28
+ system('ssh git@git.3sign.com "cd git; mkdir [sitename] [sitename]/[sitename].git; cd [sitename]/[sitename].git; git --bare init;"'.gsub('[sitename]',site_target_dir))
29
+
30
+ # fetch and execute the drush make file
31
+ system('git clone git@github.com:3sign/threesign-standard-makefile.git')
32
+ system('drush make threesign-standard-makefile/threesign.make ' + site_target_dir)
33
+
34
+ # remove the drush make file
35
+ FileUtils.rm_rf 'threesign-standard-makefile'
36
+
37
+ Dir.chdir(site_target_dir) do
38
+ # remove .git directories
39
+ FileUtils.rm_rf Dir.glob("./**/.git/")
40
+
41
+ # create patches and drush directories
42
+ FileUtils.mkdir('sites/all/patches')
43
+ FileUtils.mkdir('sites/all/drush')
44
+
45
+ # copy the aliases file to the drush dir
46
+ source = File.expand_path(File.dirname(__FILE__)) + "/../templates/aliases.drushrc.php"
47
+ FileUtils.cp(source, 'sites/all/drush')
48
+ # replace [sitename] with site_target_dir
49
+ text = File.read('sites/all/drush/aliases.drushrc.php')
50
+ puts = text.gsub('[sitename]',site_target_dir)
51
+ File.open('sites/all/drush/aliases.drushrc.php', "w") {|file| file << puts}
52
+
53
+ # create local .htaccess
54
+ FileUtils.cp('.htaccess', '.htaccess.local')
55
+ # alter local .htaccess to use VirtualDocumentRoot
56
+ text = File.read('.htaccess.local')
57
+ puts = text.gsub('# RewriteBase /','RewriteBase /')
58
+ File.open('.htaccess.local', "w") {|file| file << puts}
59
+
60
+ # set up the core repo
61
+ system('git init')
62
+ system('git remote add origin git@git.3sign.com:git/[sitename]/[sitename].git'.gsub('[sitename]',site_target_dir))
63
+ File.open('.gitignore', 'a') { |file|
64
+ file.puts "# Ignore local .htaccess."
65
+ file.puts ".htaccess.local"
66
+ file.puts "# Ignore Capistrano config paths."
67
+ file.puts "Capfile"
68
+ file.puts "config"
69
+ file.puts "build"
70
+ }
71
+ # initial push
72
+ system('git add .')
73
+ system('git commit -am "initial commit"')
74
+ system('git push origin master')
75
+
76
+ puts "Derpy finished installing " + site_target_dir + ", YO!"
77
+ end
78
+ end
79
+
80
+ if ARGV.empty?
81
+ abort "Use 'derpy -T' to display Capistrano tasks.
82
+ Use 'derpy install [sitename]' to install a new Drupal site."
83
+ elsif ARGV.first == "install"
84
+ derpy_install
85
+ else
86
+ derpy_capistrano
87
+ end
data/derpy.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'derpy'
5
- s.version = '1.1.6'
5
+ s.version = '2.0.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.description = <<-DESC
8
8
  Derpy contains a set of tasks for deploying Drupal projects with Capistrano.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Langhe
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-03-19 00:00:00 Z
12
+ date: 2014-05-14 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano