rigup 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rigup/cli.rb +8 -3
- data/lib/rigup/config.rb +3 -0
- data/lib/rigup/install_utils.rb +4 -5
- data/lib/rigup/runability.rb +29 -4
- data/lib/rigup/version.rb +1 -1
- data/lib/rigup.rb +2 -1
- data/notes.txt +49 -0
- data/rigup.gemspec +2 -1
- data/rigup.iml +1 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62efb1ff293f94f8729e1c494fc07e9cfc5d8c80
|
4
|
+
data.tar.gz: ead2e1620710ed87d57be6f7fe5edcf3e4a4f967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d33144732cb205306bf335b484dce1b4f84b07dacacbbf979be5234c5d30282e55b4d83440ad8956edd8a99f141b9295c3acda0bcc7c117fd8523f08e70fbd
|
7
|
+
data.tar.gz: dcc9ed34920e9a6f8fb168e504feba5ce107994b09253fead2fa50760da6ab04165a98142468bda7ff8de7d56f91a5c28f7d6e56b198e49745a5ff49ccbad9aa
|
data/lib/rigup/cli.rb
CHANGED
@@ -121,7 +121,9 @@ module Rigup
|
|
121
121
|
|
122
122
|
def call_release_command(aCommand)
|
123
123
|
return unless cmdline = config["#{aCommand}_command".to_sym].to_s.strip.to_nil
|
124
|
-
|
124
|
+
cd @release_path do
|
125
|
+
run cmdline
|
126
|
+
end
|
125
127
|
end
|
126
128
|
|
127
129
|
end
|
@@ -130,10 +132,13 @@ module Rigup
|
|
130
132
|
|
131
133
|
desc "new GIT_URL [PATH]", "setup new site"
|
132
134
|
def new(aGitUrl,aPath=nil)
|
133
|
-
|
135
|
+
app_name = File.basename(aGitUrl,'.git')
|
136
|
+
aPath ||= app_name
|
134
137
|
init(
|
135
138
|
aPath,
|
136
|
-
git_url: aGitUrl
|
139
|
+
git_url: aGitUrl,
|
140
|
+
app_name: app_name,
|
141
|
+
user: ENV['USER']
|
137
142
|
)
|
138
143
|
FileUtils.mkdir_p(site_dir)
|
139
144
|
FileUtils.mkdir_p(File.join(site_dir,'releases'))
|
data/lib/rigup/config.rb
CHANGED
data/lib/rigup/install_utils.rb
CHANGED
@@ -74,13 +74,12 @@ module Rigup
|
|
74
74
|
internal_permissions(aPath, aKind)
|
75
75
|
end
|
76
76
|
|
77
|
-
def ensure_link(aTo,aFrom
|
77
|
+
def ensure_link(aTo,aFrom,aUserGroup=nil,aSudo='')
|
78
78
|
raise "Must supply from" if !aFrom
|
79
79
|
cmd = []
|
80
|
-
|
81
|
-
cmd << "#{
|
82
|
-
cmd << "#{
|
83
|
-
#cmd << "#{@context.sudo} chown -h #{aUserGroup} #{aFrom}" if aUserGroup
|
80
|
+
cmd << "#{aSudo} rm -rf #{aFrom}"
|
81
|
+
cmd << "#{aSudo} ln -sf #{aTo} #{aFrom}"
|
82
|
+
cmd << "#{aSudo} chown -h #{aUserGroup} #{aFrom}" if aUserGroup
|
84
83
|
run cmd.join(' && ')
|
85
84
|
end
|
86
85
|
|
data/lib/rigup/runability.rb
CHANGED
@@ -1,11 +1,36 @@
|
|
1
1
|
module Rigup
|
2
2
|
module Runability
|
3
3
|
|
4
|
-
def
|
4
|
+
def shell
|
5
|
+
@shell ||= ::Session::Bash.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def pwd
|
9
|
+
shell.execute("pwd", stdout: nil).first.strip
|
10
|
+
end
|
11
|
+
|
12
|
+
def cd(aPath,&block)
|
13
|
+
if block_given?
|
14
|
+
begin
|
15
|
+
before_path = pwd
|
16
|
+
cd(aPath)
|
17
|
+
yield aPath,before_path
|
18
|
+
ensure
|
19
|
+
cd(before_path)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
aPath = File.expand_path(aPath)
|
23
|
+
Dir.chdir(aPath)
|
24
|
+
shell.execute("cd \"#{aPath}\"")
|
25
|
+
end
|
26
|
+
aPath
|
27
|
+
end
|
28
|
+
|
29
|
+
def run(aCommand)
|
5
30
|
@context.logger.debug aCommand
|
6
|
-
response = ::POpen4::shell(aCommand,aDir || @context.pwd)
|
7
|
-
raise Error, "Command Failed" unless
|
8
|
-
return response
|
31
|
+
response,errout = @shell.execute(aCommand,stdout: STDOUT) # ::POpen4::shell(aCommand,aDir || @context.pwd)
|
32
|
+
raise Error, "Command Failed" unless @shell.exit_status==0
|
33
|
+
return response
|
9
34
|
end
|
10
35
|
|
11
36
|
def run_for_all(aCommand,aPath,aFilesOrDirs,aPattern=nil,aInvertPattern=false,aSudo=false)
|
data/lib/rigup/version.rb
CHANGED
data/lib/rigup.rb
CHANGED
data/notes.txt
CHANGED
@@ -1,3 +1,52 @@
|
|
1
|
+
https://github.com/ahoward/wrap
|
2
|
+
|
3
|
+
https://github.com/ahoward/session/tree/master
|
4
|
+
|
5
|
+
bash = Session::Bash.new
|
6
|
+
|
7
|
+
execute command, collecting output AND piping to screen :
|
8
|
+
out,err = bash.execute('some command',stdout: STDOUT)
|
9
|
+
|
10
|
+
out,err = run(aCommand,aDir,)
|
11
|
+
|
12
|
+
SOLUTION :
|
13
|
+
|
14
|
+
create mixin including Session::Bash
|
15
|
+
add cd method eg.
|
16
|
+
cd(@release_path) do
|
17
|
+
run "do this"
|
18
|
+
run "do that"
|
19
|
+
end
|
20
|
+
OR
|
21
|
+
cd(@release_path)
|
22
|
+
(also does Dir.chdir for consistency with other Ruby methods)
|
23
|
+
|
24
|
+
run_in "ls",@release_path
|
25
|
+
|
26
|
+
run(aCommand,aOptions)
|
27
|
+
run fires exception if exit_status not 0
|
28
|
+
|
29
|
+
silent do # disconnects stdout
|
30
|
+
run 'this'
|
31
|
+
run 'that'
|
32
|
+
end
|
33
|
+
|
34
|
+
pipe_out do # sends all output to stdout
|
35
|
+
run 'this'
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
Output Idea :
|
40
|
+
|
41
|
+
say "Get File Listing..."
|
42
|
+
run "ls"
|
43
|
+
|
44
|
+
Get File Listing...
|
45
|
+
> ls
|
46
|
+
current releases rigup.yml shared
|
47
|
+
this and that
|
48
|
+
|
49
|
+
|
1
50
|
From site root :
|
2
51
|
|
3
52
|
> cd /var/www
|
data/rigup.gemspec
CHANGED
@@ -36,7 +36,8 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_runtime_dependency('git')
|
37
37
|
#s.add_runtime_dependency('middleman')
|
38
38
|
s.add_runtime_dependency('buzztools')
|
39
|
-
s.add_runtime_dependency('POpen4')
|
39
|
+
#s.add_runtime_dependency('POpen4')
|
40
|
+
s.add_runtime_dependency('session')
|
40
41
|
# https://github.com/geemus/formatador
|
41
42
|
#s.add_runtime_dependency('bitbucket_rest_api')
|
42
43
|
#s.add_runtime_dependency('osx_keychain')
|
data/rigup.iml
CHANGED
@@ -10,18 +10,16 @@
|
|
10
10
|
</content>
|
11
11
|
<orderEntry type="inheritedJdk" />
|
12
12
|
<orderEntry type="sourceFolder" forTests="false" />
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="POpen4 (v0.1.4, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="Platform (v0.4.0, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
15
13
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
16
14
|
<orderEntry type="library" scope="PROVIDED" name="buzztools (v0.0.4, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
17
15
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
18
16
|
<orderEntry type="library" scope="PROVIDED" name="git (v1.2.6, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="open4 (v1.3.3, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
20
17
|
<orderEntry type="library" scope="PROVIDED" name="rake (v10.2.0, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
21
18
|
<orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
22
19
|
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.8, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
23
20
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.5, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
24
21
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.6, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="session (v3.2.0, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
25
23
|
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
26
24
|
</component>
|
27
25
|
</module>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rigup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary McGhee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: session
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '>='
|