popo 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/envy CHANGED
@@ -7,14 +7,14 @@ module Popo
7
7
  POPO_CONFIG_FILE = 'popo.yml'
8
8
  ENVYRC_FILE = 'envyrc'
9
9
  BASH_PATH = `which bash`.strip
10
- ENVY_CMD = `which env`.strip
10
+ ENV_CMD = `which env`.strip
11
11
  ENVYRC = File.expand_path("../../script/#{ENVYRC_FILE}", __FILE__)
12
12
 
13
13
  def self.boot(args)
14
14
  options = {}
15
15
 
16
16
  optparse = OptionParser.new do |opts|
17
- opts.on('-C', '--chdir DIRECTORY', 'Changed to a given directory') do |d|
17
+ opts.on('-d', '--chdir DIRECTORY', 'Changed to a given directory') do |d|
18
18
  options[:directory] = d
19
19
  end
20
20
  end
@@ -27,40 +27,35 @@ module Popo
27
27
  def initialize(args, options)
28
28
  @root_path = args.shift
29
29
  @options = options
30
- @commands = []
31
-
32
- # set commands
33
- args.each do |a|
34
- @commands << a
35
- end
30
+ args = args.join(' ')
36
31
 
37
32
  config_file = File.join(@root_path, POPO_CONFIG_FILE)
38
33
 
39
34
  if File.exists?(config_file)
40
- cfg = YAML.load_file(config_file)
41
- @popo_path = cfg['path']
42
- @popo_target = cfg['target']
35
+ config = YAML.load_file(config_file)
36
+ @popo_path = config['path']
37
+ @popo_target = config['target']
43
38
  else
44
39
  raise "#{config_file} doesn't exist!"
45
40
  end
46
41
 
47
42
  if !@options[:directory].nil?
48
43
  @directory = File.join(@popo_path, @options[:directory])
44
+ @cmd = ["cd #{@directory};", args].join(' ')
49
45
  else
50
- @directory = ''
46
+ @cmd = args
51
47
  end
48
+
52
49
  end
53
50
 
54
51
  def run!
55
- cmd = "#{ENVY_CMD} popo_path=#{@popo_path} \
56
- popo_target=#{@popo_target} #{BASH_PATH} \
57
- -c 'source #{ENVYRC}; #{@commands.join(' ')}'"
52
+ cmd = "#{ENV_CMD} "\
53
+ "popo_path=#{@popo_path} "\
54
+ "popo_target=#{@popo_target} "\
55
+ "#{BASH_PATH} -c "\
56
+ "'source #{ENVYRC}; #{@cmd}'"
58
57
 
59
- if @directory.empty?
60
- `#{cmd}`
61
- else
62
- Dir.chdir(@directory) { `#{cmd}` }
63
- end
58
+ system(cmd)
64
59
  end
65
60
  end
66
61
  end
data/lib/popo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Popo
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/popo.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Popo::VERSION
8
8
  s.authors = ["Jan Mendoza"]
9
9
  s.email = ["poymode@gmail.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/poymode/popo"
11
11
  s.summary = %q{Popo ruby and rails repo tool}
12
12
  s.description = %q{Ruby and rails repo tool}
13
13
 
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ ENVY_PATH = `which envy`.strip
3
+ ROOT_PATH = File.expand_path('../..', __FILE__)
4
+
5
+ # add additional escape for shell variables
6
+ # so that it will not be parsed before passing to envy
7
+
8
+ args = ARGV.join(' ')
9
+ args.gsub!(/\$\w+/) { |match| "\\#{match}" }
10
+
11
+ cmd = "#{ENVY_PATH} #{ROOT_PATH} #{args}"
12
+ system(cmd)
13
+
data/script/envyrc CHANGED
@@ -1,16 +1,15 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  # Let's unload system installed rvm and move path prefix to popo
4
- unset $(env | awk -F= '/^rvm_/{print $1" "}')
5
- export rvm_reload_flag=1
4
+ export PATH=$(echo $PATH | tr ':' '\n' | grep -v /\.rvm/ | paste -sd:)
6
5
  export rvm_prefix=$popo_path
7
6
  export rvm_path=$popo_path/rvm
7
+
8
8
  # Now let's load rvm inside popo
9
9
  source $rvm_prefix/rvm/scripts/rvm
10
- # Load default rvm
11
- rvm default 1>/dev/null 2>&1
10
+
12
11
  unset PALMADE_GEMS_DIR
13
12
  export PATH="$popo_path/rvm/bin:$popo_path/tools:$PATH"
14
- export CABLING_PATH=$popo_path/.popo/cabling.yml
13
+ export CABLING_PATH=$popo_path/.manifest/cabling
15
14
  export CABLING_TARGET=$popo_target
16
15
  export DBGET_PATH=$popo_path/.manifest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000Z
12
+ date: 2012-02-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
16
- requirement: &6695400 !ruby/object:Gem::Requirement
16
+ requirement: &17642360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6695400
24
+ version_requirements: *17642360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &6694780 !ruby/object:Gem::Requirement
27
+ requirement: &17641840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *6694780
35
+ version_requirements: *17641840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cableguy
38
- requirement: &6692780 !ruby/object:Gem::Requirement
38
+ requirement: &17641380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *6692780
46
+ version_requirements: *17641380
47
47
  description: Ruby and rails repo tool
48
48
  email:
49
49
  - poymode@gmail.com
@@ -75,6 +75,7 @@ files:
75
75
  - lib/templates/envy.yml
76
76
  - popo.gemspec
77
77
  - script/Rakefile
78
+ - script/envy.template
78
79
  - script/envyrc
79
80
  - script/poporc
80
81
  - targets/beta.rb
@@ -83,7 +84,7 @@ files:
83
84
  - targets/production.rb
84
85
  - targets/staging.rb
85
86
  - targets/test.rb
86
- homepage: ''
87
+ homepage: https://github.com/poymode/popo
87
88
  licenses: []
88
89
  post_install_message:
89
90
  rdoc_options: []