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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 074cf53541cc8dda276109cd786eed5e4c013455
4
- data.tar.gz: ba808e6dd94614a4f0cc179fe3dccd29f1c1f517
3
+ metadata.gz: 62efb1ff293f94f8729e1c494fc07e9cfc5d8c80
4
+ data.tar.gz: ead2e1620710ed87d57be6f7fe5edcf3e4a4f967
5
5
  SHA512:
6
- metadata.gz: d9ab780149ca55a6dca8bf1067bd723c00c532219e39196bcd8b5429c556a0bbccb790230c504c5fad0d638db0eb773436853df67dd5738d5b55f91dbd774127
7
- data.tar.gz: a28e3901c130731e5792aa0683d11ec45534bd39840f4e4883b3861a88c33b545418c8cd2a4f1e711bbadb12f493181fc0fb227347f2375ca2376176f1be3876
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
- run cmdline, @release_path
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
- aPath ||= File.basename(aGitUrl,'.git')
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
@@ -3,6 +3,9 @@ module Rigup
3
3
  class Config < Buzztools::Config
4
4
 
5
5
  DEFAULTS = {
6
+ app_name: String,
7
+ user: String,
8
+ group: 'www',
6
9
  site_dir: String,
7
10
  git_url: String,
8
11
  branch: String,
@@ -74,13 +74,12 @@ module Rigup
74
74
  internal_permissions(aPath, aKind)
75
75
  end
76
76
 
77
- def ensure_link(aTo,aFrom) #,aDir=nil,aUserGroup=nil,aSudo='')
77
+ def ensure_link(aTo,aFrom,aUserGroup=nil,aSudo='')
78
78
  raise "Must supply from" if !aFrom
79
79
  cmd = []
80
- #cmd << "cd #{aDir}" if aDir
81
- cmd << "#{@context.sudo} rm -rf #{aFrom}"
82
- cmd << "#{@context.sudo} ln -sf #{aTo} #{aFrom}"
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
 
@@ -1,11 +1,36 @@
1
1
  module Rigup
2
2
  module Runability
3
3
 
4
- def run(aCommand,aDir=nil)
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 (response && response[:exitcode]==0)
8
- return response[:stdout]
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
@@ -1,3 +1,3 @@
1
1
  module Rigup
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/rigup.rb CHANGED
@@ -2,7 +2,8 @@ require 'thor'
2
2
  require 'buzztools'
3
3
  require 'logger'
4
4
  require 'yaml'
5
- require 'buzztools/extras/shell_extras'
5
+ require 'session'
6
+ #require 'buzztools/extras/shell_extras'
6
7
 
7
8
  require_relative "rigup/version"
8
9
  require_relative "rigup/config"
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.2
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-10 00:00:00.000000000 Z
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: POpen4
98
+ name: session
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '>='