kickstart 0.2 → 0.2.2
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/bin/kickstart +62 -4
- data/kickstart_home/defaults.rb +10 -1
- data/lib/cli_tools.rb +5 -1
- data/lib/kickstart.rb +2 -1
- data/lib/plugins.rb +4 -3
- data/lib/scripting.rb +12 -6
- metadata +1 -1
data/bin/kickstart
CHANGED
@@ -11,17 +11,75 @@ include Kickstart::Keywords
|
|
11
11
|
include Kickstart::Plugins
|
12
12
|
include Kickstart::Scripting
|
13
13
|
|
14
|
+
@help_docs = <<-EOF
|
15
|
+
kickstart is the super awesome ruby package that gets you railsing in a jiffy.
|
16
|
+
since using a subversion repository is Best Practice(TM), this package generally
|
17
|
+
prefers that you have one set up before creating your project. kickstart will
|
18
|
+
still work (some) goodness for you if you aren't using a repository, but i really
|
19
|
+
think you should use one. really.
|
20
|
+
|
21
|
+
also: have you run
|
22
|
+
|
23
|
+
$ kickstart --config
|
24
|
+
|
25
|
+
yet? you really should. it puts your kickstart home in place (~/.kickstart) with
|
26
|
+
all kinds of goodies. well.. a few kinds of goodies... i recommend it.
|
27
|
+
|
28
|
+
- - + basic usage + - -
|
29
|
+
|
30
|
+
$ kickstart project_name.rails [flags] # <- currently requires that project_name.rails already exists
|
31
|
+
$ kickstart repo_address [flags]
|
32
|
+
|
33
|
+
repositories are addressable by http://, svn://, svn+ssh://, repo:// or repo:
|
34
|
+
repo:// (and repo:) indicate a repository in your repo bank, customizable in ~/.kickstart/defaults.rb
|
35
|
+
|
36
|
+
- - + flags + - -
|
37
|
+
|
38
|
+
--config or -c
|
39
|
+
copies the default kickstart home into ~/.kickstart if it does not already exist
|
40
|
+
opens ~/.kickstart/plugin_helper.rb and ~/.kickstart/defaults.rb for editing before processing
|
41
|
+
exits unless a project is given
|
42
|
+
|
43
|
+
--force or -f
|
44
|
+
destroys the kickstart home if the config flag is set
|
45
|
+
i.e. forces copy, but you should know that it destroys the whole folder.
|
46
|
+
does nothing unless flagging to config
|
47
|
+
|
48
|
+
--name or -n
|
49
|
+
set the name of your project.
|
50
|
+
by default your project will be named by your .rails file or your repository.
|
51
|
+
|
52
|
+
--sample or -s
|
53
|
+
selects a sample project from the kickstart home. selects the project by name without (e.g. -s twirp)
|
54
|
+
cannot be used in conjunction with --config (config exits before sample gets a chance to do its thing)
|
55
|
+
|
56
|
+
--help or -h
|
57
|
+
exits after showing this
|
58
|
+
|
59
|
+
EOF
|
60
|
+
|
61
|
+
def help_docs
|
62
|
+
puts @help_docs
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
|
66
|
+
flag(:help => 'h'){
|
67
|
+
help_docs
|
68
|
+
}
|
14
69
|
flag(:sample => 's'){ |value|
|
15
70
|
@remaining_argument << "#{ENV['HOME']}/.kickstart/samples/#{value}.rails" if exists?(:folder, "#{ENV['HOME']}/.kickstart")
|
16
71
|
}
|
17
72
|
|
73
|
+
flag(:force => 'f'){ @force = true }
|
74
|
+
|
18
75
|
flag(:config => 'c'){
|
19
76
|
puts "\npreparing the ~/.kickstart folder\n"
|
77
|
+
destroy "#{ENV['HOME']}/.kickstart" if exists?(:folder, "#{ENV['HOME']}/.kickstart") && @active_flags.include?(:force)
|
20
78
|
copy "#{File.dirname(__FILE__)}/../kickstart_home/", "#{ENV['HOME']}/.kickstart" unless exists?(:folder, "#{ENV['HOME']}/.kickstart")
|
21
|
-
puts "\
|
22
|
-
system "
|
23
|
-
puts "\
|
24
|
-
system "
|
79
|
+
puts "\n#{ENV['EDITOR']} #{ENV['HOME']}/.kickstart/plugin_helper.rb\n"
|
80
|
+
system "#{ENV['EDITOR']} #{ENV['HOME']}/.kickstart/plugin_helper.rb"
|
81
|
+
puts "\n#{ENV['EDITOR']} #{ENV['HOME']}/.kickstart/defaults.rb"
|
82
|
+
system "#{ENV['EDITOR']} #{ENV['HOME']}/.kickstart/defaults.rb"
|
25
83
|
exit unless not remaining_argument.empty?
|
26
84
|
}
|
27
85
|
|
data/kickstart_home/defaults.rb
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
require 'plugin_helper'
|
6
6
|
|
7
|
-
|
7
|
+
ENV['EDITOR'] = 'vi' # must be callable from the command line (mate -w for textmate)
|
8
|
+
$RSPEC_VERSION = '0_7_5_1'
|
8
9
|
|
9
10
|
mysqladmin_user 'root'
|
10
11
|
request_mysqladmin_pass? false
|
@@ -15,3 +16,11 @@ delete_rails_index? true
|
|
15
16
|
default_plugins << :spider_test
|
16
17
|
|
17
18
|
use_plugins default_plugins
|
19
|
+
|
20
|
+
module Kickstart
|
21
|
+
module Scripting
|
22
|
+
def repo_bank
|
23
|
+
{:newq => 'http://someaddress'}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/cli_tools.rb
CHANGED
@@ -97,9 +97,13 @@ module Flagger
|
|
97
97
|
|
98
98
|
def run_flags(options)
|
99
99
|
options.each { |key, value|
|
100
|
-
@associated_blocks[key.to_sym][value]
|
100
|
+
@associated_blocks[key.to_sym][value] rescue help_docs
|
101
101
|
}
|
102
102
|
end
|
103
|
+
|
104
|
+
def help_docs
|
105
|
+
exit
|
106
|
+
end
|
103
107
|
|
104
108
|
def active_options
|
105
109
|
flags = @active_flags || {}
|
data/lib/kickstart.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
+
ENV['EDITOR'] = 'vi'
|
4
5
|
require 'rails_elements'
|
5
6
|
require 'repository'
|
6
7
|
require 'keywords'
|
@@ -10,5 +11,5 @@ require 'filebase'
|
|
10
11
|
require 'cli_tools'
|
11
12
|
|
12
13
|
module Kickstart
|
13
|
-
VERSION = '0.2'
|
14
|
+
VERSION = '0.2.2'
|
14
15
|
end
|
data/lib/plugins.rb
CHANGED
@@ -2,13 +2,14 @@ module Kickstart
|
|
2
2
|
module Plugins
|
3
3
|
# define the version of rspec that you are using. formatted as it would be in the rspec_on_rails url
|
4
4
|
def rspec_version
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
$RSPEC_VERSION ||= request_value("please enter the version of rspec on your computer [default: 0_7_5_1]")
|
6
|
+
$RSPEC_VERSION = '0_7_5_1' if $RSPEC_VERSION == ''
|
7
|
+
$RSPEC_VERSION
|
8
8
|
end
|
9
9
|
|
10
10
|
# set the rspec version
|
11
11
|
def rspec_version= what
|
12
|
+
puts "setting rspec version to #{what}"
|
12
13
|
@rspec_version = what
|
13
14
|
end
|
14
15
|
|
data/lib/scripting.rb
CHANGED
@@ -20,14 +20,20 @@ resource(:foo){|foo|
|
|
20
20
|
EOF
|
21
21
|
end
|
22
22
|
|
23
|
+
def repo_bank; {} end
|
23
24
|
def setup_project(arg)
|
24
|
-
if arg =~ /^(http:\/\/|svn\+ssh
|
25
|
-
|
26
|
-
|
25
|
+
if arg =~ /^(http:\/\/|svn\+ssh:\/\/|svn:\/\/|repo:\/\/|repo:)/
|
26
|
+
repo_name = arg.sub(/^.+\//, '')
|
27
|
+
repo_location = arg.sub(/^repo:/, '').sub(/^\/\//, '').sub(/\/#{repo_name}/, '') if arg=~ /^repo:/
|
28
|
+
|
29
|
+
@repo_address = arg=~/^repo:/ ? "#{repo_bank[repo_location.to_sym]}/#{repo_name}" : arg
|
30
|
+
puts repo_bank[:newq]+' '+repo_name
|
31
|
+
|
32
|
+
@project_name ||= repo_name
|
27
33
|
@kickstarter = "#{@project_name}.rails"
|
28
34
|
use_repo_first
|
29
35
|
write @repo_first_template.result, @kickstarter
|
30
|
-
system "
|
36
|
+
system "#{ENV['EDITOR']} #{@kickstarter}"
|
31
37
|
else
|
32
38
|
@kickstarter = arg
|
33
39
|
@project_name ||= arg.gsub(/^.+\//, '').gsub(/\..+$/, '')
|
@@ -56,7 +62,7 @@ end
|
|
56
62
|
|
57
63
|
def edit_db_config
|
58
64
|
@edit_db = request_value "would you like to edit database.yml file? default values will be used otherwise. [Y/n]" if(@edit_db == :ask || @edit_db.nil?)
|
59
|
-
system '
|
65
|
+
system "#{ENV['HOME']} config/database.yml" if @edit_db && @edit_db != 'n'
|
60
66
|
File.open('config/database.yml') { |yf| @dbconfig = YAML::load(yf) }
|
61
67
|
end
|
62
68
|
|
@@ -97,7 +103,7 @@ end
|
|
97
103
|
end
|
98
104
|
def edit_routes
|
99
105
|
@edit_routes = request_value "would you like to edit routes.rb? default values will be used otherwise. [Y/n]" if(@edit_routes == :ask || @edit_routes.nil?)
|
100
|
-
system "
|
106
|
+
system "#{ENV['EDITOR']} config/routes.rb"
|
101
107
|
end
|
102
108
|
|
103
109
|
def delete_rails_index? bool
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: kickstart
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
6
|
+
version: 0.2.2
|
7
7
|
date: 2007-04-15 00:00:00 -04:00
|
8
8
|
summary: this project is intended to give the initial steps of the rails process a nice kick in the pants, allowing you to define the initial parameters of a project in a unified way.
|
9
9
|
require_paths:
|