visionmedia-drupal 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.txt +3 -1
- data/Rakefile +5 -0
- data/drupal.gemspec +2 -2
- data/lib/drupal/install.rb +22 -7
- data/lib/drupal.rb +12 -8
- data/test/test_create_module.rb +0 -0
- data/test/test_drupal.rb +4 -0
- data/test/test_install.rb +0 -0
- data/test/test_todo_list.rb +0 -0
- metadata +4 -1
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -46,11 +46,13 @@ to quickly generate and manage Drupal modules.
|
|
46
46
|
== TODO:
|
47
47
|
|
48
48
|
* Add formatted help option
|
49
|
-
* Add download of Drupal core install via 'install core [version]'
|
50
49
|
* Support versions for installer
|
51
50
|
* Support version prompt for project installation
|
51
|
+
* Support installing a list from file(s) so that devs may have lists of core modules they use
|
52
|
+
* Add installer for jQuery plugins?
|
52
53
|
* Add graceful error handling
|
53
54
|
* Add tests
|
55
|
+
* Refactor / encapsulate entire project
|
54
56
|
|
55
57
|
== AUTHOR:
|
56
58
|
|
data/Rakefile
CHANGED
@@ -13,4 +13,9 @@ desc 'Remove ruby gem build data.'
|
|
13
13
|
task :remove do
|
14
14
|
sh "sudo gem uninstall drupal"
|
15
15
|
sh "sudo rm drupal-#{Drupal::VERSION}.gem"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Run tests.'
|
19
|
+
task :test do
|
20
|
+
sh "ruby " + File.dirname(__FILE__) + '/test/test_drupal.rb' + ' -r tk'
|
16
21
|
end
|
data/drupal.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "drupal"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.4"
|
4
4
|
s.date = "2008-10-03"
|
5
5
|
s.summary = "Drupal development kit"
|
6
6
|
s.email = "tj@vision-media.ca"
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/drupal/templates/txt/readme",
|
34
34
|
"bin/drupal"]
|
35
35
|
s.executables = ["drupal"]
|
36
|
-
s.test_files = ["test/test_drupal.rb"]
|
36
|
+
s.test_files = ["test/test_drupal.rb", "test/test_install.rb", "test/test_create_module.rb", "test/test_todo_list.rb"]
|
37
37
|
s.rdoc_options = ["--main", "README.txt"]
|
38
38
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
39
39
|
end
|
data/lib/drupal/install.rb
CHANGED
@@ -8,17 +8,32 @@ class Drupal
|
|
8
8
|
# Attempt to download core installation or module.
|
9
9
|
def run(arguments)
|
10
10
|
@project = arguments[0]
|
11
|
-
@dest = arguments[1] || '.'
|
11
|
+
@dest = arguments[1] || '.'
|
12
12
|
abort "Destination #{@dest} is not a directory." unless File.directory?(@dest)
|
13
13
|
abort 'Project name required (core | <project>).' if arguments.empty?
|
14
|
-
|
15
|
-
install_project
|
14
|
+
install_projects
|
16
15
|
end
|
17
16
|
|
18
17
|
def debug(message)
|
19
18
|
puts '... ' + message
|
20
19
|
end
|
21
20
|
|
21
|
+
# Install single project or iterate lists.
|
22
|
+
def install_projects
|
23
|
+
if @project.include? ','
|
24
|
+
projects = @project.split ','
|
25
|
+
projects.each do |p|
|
26
|
+
@project = p
|
27
|
+
check_core
|
28
|
+
install_project
|
29
|
+
puts
|
30
|
+
end
|
31
|
+
else
|
32
|
+
check_core
|
33
|
+
install_project
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
22
37
|
# Check if the destination is empty.
|
23
38
|
def destination_empty?
|
24
39
|
Dir['*'].length == 0
|
@@ -60,14 +75,14 @@ class Drupal
|
|
60
75
|
end
|
61
76
|
debug "Copied tarball to #{@tarpath}"
|
62
77
|
rescue
|
63
|
-
abort "Failed to
|
78
|
+
abort "Failed to copy remote tarball #{@tarball}"
|
64
79
|
end
|
65
80
|
|
66
81
|
# Extract tarball
|
67
|
-
@pwd =
|
68
|
-
Dir.chdir File.dirname(@tarpath)
|
82
|
+
@pwd = Dir.getwd
|
83
|
+
Dir.chdir File.dirname(@tarpath) and debug "Changed cwd to #{File.dirname(@tarpath)}" unless @dest == '.'
|
69
84
|
Kernel.system "tar -xf #{@tarpath}" rescue abort "Failed to extract #{@tarpath}"
|
70
|
-
Dir.chdir @pwd
|
85
|
+
Dir.chdir @pwd and debug "Reverted cwd back to #{@pwd}" unless @dest == '.'
|
71
86
|
|
72
87
|
# Remove tarball
|
73
88
|
Kernel.system "rm #{@tarpath}" rescue abort "Failed to remove #{@tarpath}"
|
data/lib/drupal.rb
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
#
|
7
7
|
# == ARGUMENTS:
|
8
8
|
#
|
9
|
-
# create module <module_name> [dir]
|
10
|
-
# todo list [total]
|
11
|
-
# install <core | project
|
9
|
+
# create module <module_name> [dir] Generates a module skeleton from an interactive wizard. Current directory unless [dir] is specified.
|
10
|
+
# todo list [total] Displays list of todo items or a total.
|
11
|
+
# install <core | project ...> [dir] Install Drupal project(s) to [dir] or the current directory.
|
12
12
|
#
|
13
13
|
# == OPTIONS:
|
14
14
|
#
|
@@ -31,11 +31,15 @@
|
|
31
31
|
#
|
32
32
|
# View total todo items only.
|
33
33
|
# drupal todo list total ./sites/all/modules
|
34
|
-
#
|
35
|
-
#
|
34
|
+
#
|
35
|
+
# Install a module to the modules folder in my new installation (from drupal root)
|
36
|
+
# drupal install devel ./sites/all/modules
|
36
37
|
#
|
37
|
-
#
|
38
|
-
#
|
38
|
+
# Install a module when in the 'modules directory
|
39
|
+
# drupal install devel
|
40
|
+
#
|
41
|
+
# Install several modules to the modules folder
|
42
|
+
# drupal install devel,pathauto,err,ac ./sites/all/modules
|
39
43
|
#
|
40
44
|
|
41
45
|
require 'optparse'
|
@@ -48,7 +52,7 @@ class Drupal
|
|
48
52
|
|
49
53
|
MAJOR = 0
|
50
54
|
MINOR = 0
|
51
|
-
TINY =
|
55
|
+
TINY = 4
|
52
56
|
VERSION = [MAJOR, MINOR, TINY].join('.')
|
53
57
|
|
54
58
|
# Run the drupal development tool.
|
File without changes
|
data/test/test_drupal.rb
CHANGED
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visionmedia-drupal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tj@vision-media.ca
|
@@ -76,3 +76,6 @@ specification_version: 2
|
|
76
76
|
summary: Drupal development kit
|
77
77
|
test_files:
|
78
78
|
- test/test_drupal.rb
|
79
|
+
- test/test_install.rb
|
80
|
+
- test/test_create_module.rb
|
81
|
+
- test/test_todo_list.rb
|