mgem 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/mgem +6 -1
- data/lib/mgem.rb +17 -2
- metadata +2 -2
data/bin/mgem
CHANGED
@@ -53,8 +53,13 @@ elsif ARGV[0] == 'search'
|
|
53
53
|
gems.search(ARGV[1]).each {|gem| info_proc.call(gem) }
|
54
54
|
elsif ARGV[0] == 'update'
|
55
55
|
puts 'Update list of GEMs...'
|
56
|
+
amount = gems.size
|
56
57
|
gems.update!
|
57
|
-
|
58
|
+
gems = load_gems
|
59
|
+
new_gems = gems.size - amount
|
60
|
+
if new_gems > 0
|
61
|
+
puts "#{new_gems} new GEMs!"
|
62
|
+
end
|
58
63
|
elsif ARGV[0] == 'config'
|
59
64
|
puts <<__CONFIG__
|
60
65
|
MRuby::Build.new do |conf|
|
data/lib/mgem.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'fileutils'
|
3
|
+
require "stringio"
|
3
4
|
|
4
|
-
MGEM_VERSION = '0.0
|
5
|
+
MGEM_VERSION = '0.1.0'
|
5
6
|
|
6
7
|
MGEM_DIR = '.mgem'
|
7
8
|
GEMS_ACTIVE = 'GEMS_ACTIVE.lst'
|
@@ -21,7 +22,9 @@ end
|
|
21
22
|
|
22
23
|
def initialize_mgem_list(config = {})
|
23
24
|
unless File.exists? config[:mgem_list]
|
25
|
+
puts "Loading fresh GEM list..."
|
24
26
|
`git clone #{GEMS_REPO} #{config[:mgem_list]}`
|
27
|
+
puts "done!"
|
25
28
|
end
|
26
29
|
|
27
30
|
unless File.exists? config[:mgem_active]
|
@@ -110,8 +113,20 @@ class MrbgemList
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def update!
|
116
|
+
temp_stderr, $stderr = $stderr, StringIO.new
|
113
117
|
git_dir = [@config[:mgem_list], '.git'].join File::SEPARATOR
|
114
|
-
|
118
|
+
dir_arg = "--git-dir=#{git_dir} --work-tree=#{@config[:mgem_list]} "
|
119
|
+
current_hash = `git #{dir_arg} log -n 1 --pretty=format:%H`
|
120
|
+
`git #{dir_arg} pull`
|
121
|
+
result = `git #{dir_arg} log #{current_hash}..HEAD --pretty=format:''`
|
122
|
+
count = result.lines.count
|
123
|
+
if count == 0
|
124
|
+
puts "No new GEMs."
|
125
|
+
else
|
126
|
+
puts "The GEM list was updated!"
|
127
|
+
end
|
128
|
+
ensure
|
129
|
+
$stderr = temp_stderr
|
115
130
|
end
|
116
131
|
|
117
132
|
private
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: mgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Bovensiepen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: mgem helps you search and find GEMs specifically written for mruby. It also supports by creating a mruby build configuration.
|
15
15
|
email: daniel@bovensiepen.net
|