bling 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. data/bin/bling +1 -1
  2. data/lib/bling/bling.rb +18 -6
  3. metadata +12 -5
data/bin/bling CHANGED
@@ -82,6 +82,6 @@ if ARGV[0] == "install"
82
82
  elsif ARGV[0] == "init"
83
83
  init
84
84
  else
85
- puts "Unrecognized command. Available command: install"
85
+ puts "Unrecognized command. Available commands: install, init"
86
86
  end
87
87
 
@@ -1,9 +1,11 @@
1
1
  require 'rubygems'
2
+ require 'erb'
2
3
 
3
4
  class Bling
4
- def initialize(bling_file = "bling.yml")
5
+ def initialize(bling_file = ".gems")
5
6
  raise ArgumentError, "bling file not found" unless File.exists?(bling_file)
6
- @yaml = YAML::load_file(bling_file)
7
+ @yaml = YAML::load(ERB.new(File.read(bling_file)).result)
8
+
7
9
  end
8
10
 
9
11
  def require_env(env = nil)
@@ -13,12 +15,22 @@ class Bling
13
15
  end
14
16
  end
15
17
 
18
+ def gem_string(gem, version = nil)
19
+ if version
20
+ gem.to_s + " [#{version}]"
21
+ else
22
+ gem.to_s
23
+ end
24
+ end
25
+
16
26
  def list_gems(env = nil)
27
+ lines = []
17
28
  self.each_gem_for(env) do |entry|
18
- line = entry['name']
19
- line += " [#{entry['version']}]" if entry['version']
29
+ line = gem_string(entry['name'], entry['version'])
30
+ lines << line
20
31
  $stdout.puts line
21
32
  end
33
+ lines
22
34
  end
23
35
 
24
36
  def install_gems(env = nil)
@@ -28,11 +40,11 @@ class Bling
28
40
  begin
29
41
  version = only_if_present.call('-v=', entry['version'].to_s.gsub(/[=~<>]/, ''))
30
42
  source = only_if_present.call('--source=', entry['source'])
31
- gem *([entry['name'], entry['version']].compact)
43
+ gem *([entry['name'], entry['version'].to_s].compact)
32
44
  rescue Gem::LoadError
33
45
  gem_installed = true
34
46
  $stdout.puts "installing #{entry['name']} #{version}"
35
- `gem install #{entry['name']} #{version} #{source} `
47
+ `gem install #{entry['name']} #{version} #{source} ` unless ENV['PRACTICE']
36
48
  end
37
49
  end
38
50
  $stdout.puts "nothing to install!" unless gem_installed
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Terry Heath
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-19 00:00:00 -06:00
17
+ date: 2010-02-23 00:00:00 -06:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -38,18 +43,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
38
43
  requirements:
39
44
  - - ">="
40
45
  - !ruby/object:Gem::Version
46
+ segments:
47
+ - 0
41
48
  version: "0"
42
- version:
43
49
  required_rubygems_version: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
47
55
  version: "0"
48
- version:
49
56
  requirements: []
50
57
 
51
58
  rubyforge_project:
52
- rubygems_version: 1.3.5
59
+ rubygems_version: 1.3.6
53
60
  signing_key:
54
61
  specification_version: 3
55
62
  summary: bling bling gem management