rigup 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
 - data/lib/rigup/cli.rb +5 -3
 - data/lib/rigup/config.rb +1 -0
 - data/lib/rigup/context.rb +0 -4
 - data/lib/rigup/install_utils.rb +8 -8
 - data/lib/rigup/runability.rb +10 -7
 - data/lib/rigup/version.rb +1 -1
 - data/notes.txt +8 -0
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 93976958d3e4fb8d72c039d7e8e2386d03db5699
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a35ef540e688543b45e2653d5a4052b3b6c2bb0c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 42e0879308c9794c7eb0a327a261c27b9c06365f804115e0af3590e2f590df67926c85fc07305f0bc5c5f66a593db93b9c35feae725cc17c65dea601160f8d3f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d09e52aac08a191fb3983fcae42eff3c1c9d0dec57583a01dbb203ab70f39ef654001d4af1db3aee93f250ca29ce3c245a3ea88ab839228e1380487abd5aa84c
         
     | 
    
        data/lib/rigup/cli.rb
    CHANGED
    
    | 
         @@ -18,7 +18,9 @@ module Rigup 
     | 
|
| 
       18 
18 
     | 
    
         
             
            					file_config = YAML.load(String.from_file(f))
         
     | 
| 
       19 
19 
     | 
    
         
             
            					aConfig.merge!(file_config)
         
     | 
| 
       20 
20 
     | 
    
         
             
            				end
         
     | 
| 
       21 
     | 
    
         
            -
            				 
     | 
| 
      
 21 
     | 
    
         
            +
            				aConfig = aConfig.merge(site_dir: @site_dir)
         
     | 
| 
      
 22 
     | 
    
         
            +
            				aConfig[:user] ||= ENV['USER']
         
     | 
| 
      
 23 
     | 
    
         
            +
            				config = Rigup::Config.new(aConfig)
         
     | 
| 
       22 
24 
     | 
    
         
             
            				@context = Rigup::Context.new(
         
     | 
| 
       23 
25 
     | 
    
         
             
            					config: config,
         
     | 
| 
       24 
26 
     | 
    
         
             
            					logger: ::Logger.new(STDOUT),
         
     | 
| 
         @@ -100,7 +102,7 @@ module Rigup 
     | 
|
| 
       100 
102 
     | 
    
         
             
            			end
         
     | 
| 
       101 
103 
     | 
    
         | 
| 
       102 
104 
     | 
    
         
             
            			def link_live
         
     | 
| 
       103 
     | 
    
         
            -
            				ensure_link(@release_path,File.expand_path(File.join(site_dir,'current')))
         
     | 
| 
      
 105 
     | 
    
         
            +
            				ensure_link(@release_path,File.expand_path(File.join(site_dir,'current')),"#{config[:user]}:#{config[:group]}")
         
     | 
| 
       104 
106 
     | 
    
         
             
            			end
         
     | 
| 
       105 
107 
     | 
    
         | 
| 
       106 
108 
     | 
    
         
             
            			def cleanup
         
     | 
| 
         @@ -125,7 +127,6 @@ module Rigup 
     | 
|
| 
       125 
127 
     | 
    
         
             
            					run cmdline
         
     | 
| 
       126 
128 
     | 
    
         
             
            				end
         
     | 
| 
       127 
129 
     | 
    
         
             
            			end
         
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
130 
     | 
    
         
             
            		end
         
     | 
| 
       130 
131 
     | 
    
         | 
| 
       131 
132 
     | 
    
         
             
            		public
         
     | 
| 
         @@ -152,6 +153,7 @@ module Rigup 
     | 
|
| 
       152 
153 
     | 
    
         
             
            		def deploy(aPath=nil)
         
     | 
| 
       153 
154 
     | 
    
         
             
            			init(aPath)
         
     | 
| 
       154 
155 
     | 
    
         
             
            			update_cache
         
     | 
| 
      
 156 
     | 
    
         
            +
            			#gem 'debugger'; require 'debugger'; debugger
         
     | 
| 
       155 
157 
     | 
    
         
             
            			release
         
     | 
| 
       156 
158 
     | 
    
         
             
            			call_release_command(:install)     # call install_command if defined eg. defaults to "thor deploy:install" eg. make changes to files
         
     | 
| 
       157 
159 
     | 
    
         
             
            			call_release_command(:block)
         
     | 
    
        data/lib/rigup/config.rb
    CHANGED
    
    
    
        data/lib/rigup/context.rb
    CHANGED
    
    
    
        data/lib/rigup/install_utils.rb
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ module Rigup 
     | 
|
| 
       5 
5 
     | 
    
         
             
            			ext = Buzztools::File.extension(aFile,aExtendedExtension)
         
     | 
| 
       6 
6 
     | 
    
         
             
            			no_ext = Buzztools::File.no_extension(aFile,aExtendedExtension)
         
     | 
| 
       7 
7 
     | 
    
         
             
            			dir = File.dirname(aFile)
         
     | 
| 
       8 
     | 
    
         
            -
            			run "#{@context.sudo} mv -f #{no_ext}.#{@context.config[:stage]}.#{ext} #{aFile}"
         
     | 
| 
       9 
     | 
    
         
            -
            			run "#{@context.sudo} rm -f #{no_ext}.*.#{ext}"
         
     | 
| 
      
 8 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} mv -f #{no_ext}.#{@context.config[:stage]}.#{ext} #{aFile}"
         
     | 
| 
      
 9 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} rm -f #{no_ext}.*.#{ext}"
         
     | 
| 
       10 
10 
     | 
    
         
             
            		end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            		# Especially for modifiying behaviour eg. of FCKEditor without upsetting the standard files
         
     | 
| 
         @@ -17,8 +17,8 @@ module Rigup 
     | 
|
| 
       17 
17 
     | 
    
         
             
            		def override_folder(aFolder,aOverrideFolder=nil,aRemove=true)
         
     | 
| 
       18 
18 
     | 
    
         
             
            			aFolder = aFolder.desuffix('/')
         
     | 
| 
       19 
19 
     | 
    
         
             
            			aOverrideFolder ||= (aFolder+'_override')
         
     | 
| 
       20 
     | 
    
         
            -
            			run "#{@context.sudo} cp -vrf #{aOverrideFolder}/* #{aFolder}/"
         
     | 
| 
       21 
     | 
    
         
            -
            			run "#{@context.sudo} rm -rf #{aOverrideFolder}" if aRemove
         
     | 
| 
      
 20 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} cp -vrf #{aOverrideFolder}/* #{aFolder}/"
         
     | 
| 
      
 21 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} rm -rf #{aOverrideFolder}" if aRemove
         
     | 
| 
       22 
22 
     | 
    
         
             
            		end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         | 
| 
         @@ -27,7 +27,7 @@ module Rigup 
     | 
|
| 
       27 
27 
     | 
    
         
             
            			aUser ||= @user
         
     | 
| 
       28 
28 
     | 
    
         
             
            			aGroup ||= @group
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            			run "#{@context.sudo} chown -R #{aUser}:#{aGroup} #{aPath.ensure_suffix('/')}"
         
     | 
| 
      
 30 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} chown -R #{aUser}:#{aGroup} #{aPath.ensure_suffix('/')}"
         
     | 
| 
       31 
31 
     | 
    
         
             
            			run_for_all("chmod 755",aPath,:dirs)									# !!! perhaps reduce other permissions
         
     | 
| 
       32 
32 
     | 
    
         
             
            			run_for_all("chmod 644",aPath,:files)
         
     | 
| 
       33 
33 
     | 
    
         
             
            			run_for_all("chmod g+s",aPath,:dirs)
         
     | 
| 
         @@ -59,7 +59,7 @@ module Rigup 
     | 
|
| 
       59 
59 
     | 
    
         
             
            					#permissions_for_web_writable("#{aPath}/tmp")
         
     | 
| 
       60 
60 
     | 
    
         
             
            					make_public_cache_dir("#{aPath}/tmp")
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
            					run "#{@context.sudo} chown #{@apache_user} #{aPath}/config/environment.rb" unless DEV_MODE	# very important for passenger, which uses the owner of this file to run as
         
     | 
| 
      
 62 
     | 
    
         
            +
            					run "#{@context.config[:sudo]} chown #{@apache_user} #{aPath}/config/environment.rb" unless DEV_MODE	# very important for passenger, which uses the owner of this file to run as
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
            				when 'spree' then
         
     | 
| 
       65 
65 
     | 
    
         
             
            					internal_permissions(aPath,'rails')
         
     | 
| 
         @@ -80,11 +80,11 @@ module Rigup 
     | 
|
| 
       80 
80 
     | 
    
         
             
            			cmd << "#{aSudo} rm -rf #{aFrom}"
         
     | 
| 
       81 
81 
     | 
    
         
             
            			cmd << "#{aSudo} ln -sf #{aTo} #{aFrom}"
         
     | 
| 
       82 
82 
     | 
    
         
             
            			cmd << "#{aSudo} chown -h #{aUserGroup} #{aFrom}" if aUserGroup
         
     | 
| 
       83 
     | 
    
         
            -
            			run 
     | 
| 
      
 83 
     | 
    
         
            +
            			run(cmd.join(' && '),raise: false)
         
     | 
| 
       84 
84 
     | 
    
         
             
            		end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
            		def make_public_cache_dir(aStartPath)
         
     | 
| 
       87 
     | 
    
         
            -
            			run "#{@context.sudo} mkdir -p #{aStartPath}"
         
     | 
| 
      
 87 
     | 
    
         
            +
            			run "#{@context.config[:sudo]} mkdir -p #{aStartPath}"
         
     | 
| 
       88 
88 
     | 
    
         
             
            			permissions_for_web(aStartPath)
         
     | 
| 
       89 
89 
     | 
    
         
             
            			permissions_for_web_writable(aStartPath)
         
     | 
| 
       90 
90 
     | 
    
         
             
            		end
         
     | 
    
        data/lib/rigup/runability.rb
    CHANGED
    
    | 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Rigup
         
     | 
| 
       2 
2 
     | 
    
         
             
            	module Runability
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            		def  
     | 
| 
       5 
     | 
    
         
            -
            			@ 
     | 
| 
      
 4 
     | 
    
         
            +
            		def bash
         
     | 
| 
      
 5 
     | 
    
         
            +
            			@bash ||= ::Session::Bash.new
         
     | 
| 
       6 
6 
     | 
    
         
             
            		end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            		def pwd
         
     | 
| 
       9 
     | 
    
         
            -
            			 
     | 
| 
      
 9 
     | 
    
         
            +
            			bash.execute("pwd", stdout: nil).first.strip
         
     | 
| 
       10 
10 
     | 
    
         
             
            		end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            		def cd(aPath,&block)
         
     | 
| 
         @@ -15,21 +15,24 @@ module Rigup 
     | 
|
| 
       15 
15 
     | 
    
         
             
            			 		before_path = pwd
         
     | 
| 
       16 
16 
     | 
    
         
             
            					cd(aPath)
         
     | 
| 
       17 
17 
     | 
    
         
             
            					yield aPath,before_path
         
     | 
| 
      
 18 
     | 
    
         
            +
            				rescue Exception => e
         
     | 
| 
      
 19 
     | 
    
         
            +
            					@context.logger.info e.message
         
     | 
| 
       18 
20 
     | 
    
         
             
            				ensure
         
     | 
| 
       19 
21 
     | 
    
         
             
            					cd(before_path)
         
     | 
| 
       20 
22 
     | 
    
         
             
            				end
         
     | 
| 
       21 
23 
     | 
    
         
             
            			else
         
     | 
| 
       22 
24 
     | 
    
         
             
            				aPath = File.expand_path(aPath)
         
     | 
| 
       23 
25 
     | 
    
         
             
            				Dir.chdir(aPath)
         
     | 
| 
       24 
     | 
    
         
            -
            				 
     | 
| 
      
 26 
     | 
    
         
            +
            				bash.execute("cd \"#{aPath}\"")
         
     | 
| 
       25 
27 
     | 
    
         
             
            			end
         
     | 
| 
       26 
28 
     | 
    
         
             
            			aPath
         
     | 
| 
       27 
29 
     | 
    
         
             
            		end
         
     | 
| 
       28 
30 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
            		def run(aCommand)
         
     | 
| 
      
 31 
     | 
    
         
            +
            		def run(aCommand,aOptions=nil)
         
     | 
| 
      
 32 
     | 
    
         
            +
            			aOptions ||= {}
         
     | 
| 
       30 
33 
     | 
    
         
             
            			@context.logger.debug aCommand
         
     | 
| 
       31 
     | 
    
         
            -
            			response,errout =  
     | 
| 
       32 
     | 
    
         
            -
            			raise  
     | 
| 
      
 34 
     | 
    
         
            +
            			response,errout = bash.execute(aCommand,stdout: STDOUT)  #   ::POpen4::shell(aCommand,aDir || @context.pwd)
         
     | 
| 
      
 35 
     | 
    
         
            +
            			raise "Command Failed" unless bash.exit_status==0 or aOptions[:raise]==false
         
     | 
| 
       33 
36 
     | 
    
         
             
            			return response
         
     | 
| 
       34 
37 
     | 
    
         
             
            		end
         
     | 
| 
       35 
38 
     | 
    
         | 
    
        data/lib/rigup/version.rb
    CHANGED
    
    
    
        data/notes.txt
    CHANGED
    
    
    
        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.4
         
     | 
| 
       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-16 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |