strap 0.0.4 → 0.0.5
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/lib/strap/cli.rb +4 -5
- data/lib/strap/core.rb +4 -4
- data/lib/strap/version.rb +1 -1
- metadata +2 -2
data/lib/strap/cli.rb
CHANGED
@@ -7,7 +7,7 @@ module Strap
|
|
7
7
|
desc "install", "Create '~/.strap' templates directory"
|
8
8
|
def install
|
9
9
|
if File.exists?(File.expand_path('~/.strap'))
|
10
|
-
say "'~/.strap' directory already exists
|
10
|
+
say "'~/.strap' directory already exists", :red
|
11
11
|
else
|
12
12
|
Dir::mkdir(File.expand_path('~/.strap'))
|
13
13
|
FileUtils.cp(CONFIG_TEMPLATE, File.expand_path('~/.strap/default'))
|
@@ -18,23 +18,22 @@ module Strap
|
|
18
18
|
desc "init PATH", "Initialize a new project directory at PATH and generate Strapfile"
|
19
19
|
method_option :template, :aliases => "-t", :desc => "Specify a template Strapfile from '~/.strap'"
|
20
20
|
def init(path)
|
21
|
-
say ""
|
22
21
|
if File.exists?(path)
|
23
|
-
say "That directory already exists
|
22
|
+
say "That directory already exists", :red
|
24
23
|
else
|
25
24
|
template = options[:template]
|
26
25
|
core = Strap::Core.new(self)
|
27
26
|
core.create_project_directory(path)
|
28
27
|
core.create_config(path, template)
|
29
28
|
core.update_database_name(path)
|
30
|
-
say "
|
29
|
+
say "Strap project created. Now edit the Strapfile and run 'strap go' from the project directory to bootstrap your project."
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
33
|
desc "go", "Bootstrap the project: clone bootstrap repo, create database, make first commit to project repo"
|
35
34
|
def go(strapfile = "Strapfile")
|
36
35
|
unless File.exists?(strapfile)
|
37
|
-
say "
|
36
|
+
say "No Strapfile in current directory. Use the 'strap init PATH' command first to setup your project directory and to initialize a Strapfile.", :red
|
38
37
|
return false
|
39
38
|
end
|
40
39
|
config = Strap::Config.new(strapfile)
|
data/lib/strap/core.rb
CHANGED
@@ -44,7 +44,7 @@ module Strap
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def clone_repo(repo, directory=".")
|
47
|
-
if !repo.
|
47
|
+
if !repo.nil? && !File.exists?("#{directory}/.git")
|
48
48
|
output "- Cloning source repo"
|
49
49
|
clone = system("cd #{directory} && git clone #{repo} strap_temp")
|
50
50
|
unless clone
|
@@ -63,7 +63,7 @@ module Strap
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def commit_to_repo(repo, directory=".", force=false)
|
66
|
-
if !repo.
|
66
|
+
if !repo.nil?
|
67
67
|
commit = system("cd #{directory} && git init . && git add -A && git commit -m 'Initial commit from Strap'")
|
68
68
|
if commit
|
69
69
|
output "- Git repo initialized"
|
@@ -82,7 +82,7 @@ module Strap
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def create_database(db_user, db_password, db_socket=nil, db_name=nil, db_port=nil, db_host=nil)
|
85
|
-
if db_user.
|
85
|
+
if db_user.nil? and db_password.nil? and db_name.nil?
|
86
86
|
return false
|
87
87
|
end
|
88
88
|
mysql = Mysql::new(db_host, db_user, db_password, nil, db_port, db_socket)
|
@@ -97,7 +97,7 @@ module Strap
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def import_to_database(sql, db_user, db_password, db_socket=nil, db_name=nil, db_port=nil, db_host=nil)
|
100
|
-
if db_user.
|
100
|
+
if db_user.nil? and db_password.nil? and db_name.nil? and sql.nil?
|
101
101
|
return false
|
102
102
|
end
|
103
103
|
import = system("mysql -u#{db_user} -p#{db_password} -S#{db_socket} #{db_name} < #{sql}")
|
data/lib/strap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|