gemput 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/gemput +13 -1
- data/gemput.gemspec +1 -1
- data/lib/gemput.rb +85 -7
- data/lib/gemput/version.rb +1 -1
- metadata +2 -3
- data/gemput-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 028de48bc9048e928ac0e3a654e4619dea698e6d
|
4
|
+
data.tar.gz: 1eab54664a4b2c74f9c0146a8a4d48a042a33458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0faa1a1b3b5a84480e534be799d2ca2d178d79a641110e73c3778fa6382cb36c25e7bf24c5c5ab63646fc012942f6783c0cfccee1c622ba08dd95b9398306c76
|
7
|
+
data.tar.gz: 527d19bacdb2df98c8f1da18e793715200a1fd970fd9d8a8d3b76f050e235e642920aed5a080e498ce183f74f21e6905fbf1f1bf27e3cf6045a2d102559d6d58
|
data/.gitignore
CHANGED
data/bin/gemput
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'gemput'
|
4
|
-
|
4
|
+
|
5
|
+
unless ARGV[0].nil?
|
6
|
+
case ARGV[0]
|
7
|
+
when "add", "a", "-a"
|
8
|
+
Gemput.add_gem(ARGV[1])
|
9
|
+
when "sync", "s", "-s"
|
10
|
+
Gemput.sync_gem()
|
11
|
+
when "help", "h", "-h"
|
12
|
+
Gemput.show_help()
|
13
|
+
end
|
14
|
+
else
|
15
|
+
Gemput.show_help()
|
16
|
+
end
|
data/gemput.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_development_dependency "rake", "~> 10.0"
|
17
17
|
s.add_dependency 'gems', '~> 0.8.3'
|
18
18
|
|
19
|
-
s.files
|
19
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
20
|
|
21
21
|
s.executables = %w(gemput)
|
22
22
|
s.require_paths = ["lib"]
|
data/lib/gemput.rb
CHANGED
@@ -3,20 +3,98 @@ require 'gems'
|
|
3
3
|
|
4
4
|
module Gemput
|
5
5
|
def self.add_gem(gem_name)
|
6
|
-
|
6
|
+
unless File.exists?('Gemfile')
|
7
|
+
puts ''
|
8
|
+
puts "# Could not locate Gemfile."
|
9
|
+
puts ''
|
10
|
+
return
|
11
|
+
end
|
12
|
+
if gem_name.nil?
|
13
|
+
puts ''
|
14
|
+
puts "# Need gem name."
|
15
|
+
puts ''
|
16
|
+
puts '- Usage: '
|
17
|
+
puts ' 1-1 gemput add GEM_NAME'
|
18
|
+
puts ' 1-2 gemput a GEM_NAME'
|
19
|
+
puts ' 1-3 gemput -a GEM_NAME'
|
20
|
+
puts ''
|
21
|
+
return
|
22
|
+
end
|
7
23
|
|
8
24
|
gem_info = Gems.info(gem_name)
|
9
25
|
|
10
26
|
unless gem_info['name'].nil?
|
11
27
|
open('Gemfile', 'a') { |f|
|
12
28
|
f.puts "gem '#{gem_info['name']}', '~> #{gem_info['version']}'"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
29
|
+
puts ''
|
30
|
+
puts " '#{gem_info['name']}' gem added."
|
31
|
+
puts ''
|
32
|
+
}
|
33
|
+
else
|
34
|
+
puts ''
|
35
|
+
puts "# This rubygem could not be found."
|
36
|
+
puts ''
|
17
37
|
end
|
18
|
-
|
19
38
|
end
|
20
|
-
end
|
21
39
|
|
40
|
+
def self.sync_gem()
|
41
|
+
unless File.exists?('Gemfile')
|
42
|
+
puts ''
|
43
|
+
puts "# Could not locate Gemfile."
|
44
|
+
puts ''
|
45
|
+
return
|
46
|
+
end
|
47
|
+
read_text = File.open('./Gemfile').read
|
48
|
+
write_text = ''
|
49
|
+
puts ''
|
50
|
+
puts '# gem version synchronizing start.'
|
51
|
+
read_text.each_line do |line|
|
52
|
+
gem_line = /^\s*gem '([^']*)'\s*$/.match(line)
|
53
|
+
unless gem_line.nil?
|
54
|
+
name = gem_line.captures[0]
|
55
|
+
gem_info = Gems.info(name)
|
56
|
+
gem_version = gem_info['version']
|
57
|
+
write_text << line.delete!("\n") << ", '~> " << gem_version << "'\n"
|
58
|
+
puts " - '#{name}' gem version added."
|
59
|
+
else
|
60
|
+
write_text << line
|
61
|
+
end
|
62
|
+
end
|
22
63
|
|
64
|
+
aFile = File.new('./Gemfile', 'w')
|
65
|
+
if aFile
|
66
|
+
aFile.syswrite(write_text)
|
67
|
+
else
|
68
|
+
puts ''
|
69
|
+
puts '# Unable open file.'
|
70
|
+
puts ''
|
71
|
+
return
|
72
|
+
end
|
73
|
+
puts '# gem version synchronizing finished.'
|
74
|
+
puts ''
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.show_help()
|
78
|
+
puts ''
|
79
|
+
puts 'This gem manages the version of gems in the Gemfile.'
|
80
|
+
puts ''
|
81
|
+
|
82
|
+
puts '# you can add a gem along with its latest gem version in the Gemfile.'
|
83
|
+
puts ' 1-1 gemput add GEM_NAME'
|
84
|
+
puts ' 1-2 gemput a GEM_NAME'
|
85
|
+
puts ' 1-3 gemput -a GEM_NAME'
|
86
|
+
puts ''
|
87
|
+
|
88
|
+
puts '# you can fill out the missing gem versions in the Gemfile.'
|
89
|
+
puts ' 2-1 gemput sync'
|
90
|
+
puts ' 2-2 gemput s'
|
91
|
+
puts ' 2-3 gemput -s'
|
92
|
+
puts ''
|
93
|
+
|
94
|
+
puts '# you can view command helps.'
|
95
|
+
puts ' 3-1 gemput help'
|
96
|
+
puts ' 3-2 gemput h'
|
97
|
+
puts ' 3-3 gemput -h'
|
98
|
+
puts ''
|
99
|
+
end
|
100
|
+
end
|
data/lib/gemput/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stompesi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/gemput
|
72
72
|
- bin/setup
|
73
|
-
- gemput-0.1.0.gem
|
74
73
|
- gemput.gemspec
|
75
74
|
- lib/gemput.rb
|
76
75
|
- lib/gemput/version.rb
|
data/gemput-0.1.0.gem
DELETED
Binary file
|