gemput 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 028de48bc9048e928ac0e3a654e4619dea698e6d
4
- data.tar.gz: 1eab54664a4b2c74f9c0146a8a4d48a042a33458
3
+ metadata.gz: 9a671665314caccaed7053ef5d64985ef78e1e71
4
+ data.tar.gz: 9eb0fb78e1644b1ff4b19df565898300df2e9772
5
5
  SHA512:
6
- metadata.gz: 0faa1a1b3b5a84480e534be799d2ca2d178d79a641110e73c3778fa6382cb36c25e7bf24c5c5ab63646fc012942f6783c0cfccee1c622ba08dd95b9398306c76
7
- data.tar.gz: 527d19bacdb2df98c8f1da18e793715200a1fd970fd9d8a8d3b76f050e235e642920aed5a080e498ce183f74f21e6905fbf1f1bf27e3cf6045a2d102559d6d58
6
+ metadata.gz: 9e230119799f7fdf68d0b57d5a626e8338179b2140d62d83c89e744f3613ac41b3152a4135dd2a6aad50bd68855823592b46f8b69849c8ee5782a2129747c5cc
7
+ data.tar.gz: 6613e4a97ba5f87a9c55171842eb13503db28f658076b3ef8bcff63b68c686cb7fce866d74f3806dbaffbc43c29341febb41ee233f6d271495b612b4e46e8fb4
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Gemput
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gemput`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ The easiest way to manage your Gemfile. Gemput keeps your software stable by freezing Gemfile.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ##[Why do you specify gem version?](http://everydayrails.com/2012/09/11/bundler-rails-specify-versions.html)
6
+
7
+ > The Rails ecosystem moves quickly–too quickly, some might say–and as a result a given library’s API from just a few months ago may be deprecated today–or worse, it may just no longer work. Running bundle install with the Gemfile as-is, I could get gem versions that are no longer compatible with a legacy version of Rails. Or potentially worse, I could get gem versions with drastically rewritten APIsvery difficult to debug without a solid suite of tests. (The codebase in question lacks test coverage, too, but that’s a different subject.)
6
8
 
7
9
  ## Installation
8
10
 
@@ -20,9 +22,30 @@ Or install it yourself as:
20
22
 
21
23
  $ gem install gemput
22
24
 
23
- ## Usage
25
+ ## Getting Started
26
+
27
+ Add a gem along with its latest gem version in the Gemfile.
28
+
29
+ ```bash
30
+ $ gemput add GEM_NAME
31
+ $ gemput a GEM_NAME
32
+ $ gemput -a GEM_NAME
33
+ ```
34
+
35
+ Fill out the missing gem versions in the Gemfile.
36
+
37
+ ```bash
38
+ $ gemput sync
39
+ $ gemput s
40
+ $ gemput -s
41
+ ```
24
42
 
25
- TODO: Write usage instructions here
43
+ View command helps.
44
+ ```bash
45
+ $ gemput help
46
+ $ gemput h
47
+ $ gemput -h
48
+ ```
26
49
 
27
50
  ## Development
28
51
 
@@ -32,7 +55,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
55
 
33
56
  ## Contributing
34
57
 
35
- 1. Fork it ( https://github.com/[my-github-username]/gemput/fork )
58
+ 1. Fork it ( https://github.com/stompesi/gemput/fork )
36
59
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
60
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
61
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module Gemput
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/gemput.rb CHANGED
@@ -21,11 +21,13 @@ module Gemput
21
21
  return
22
22
  end
23
23
 
24
- gem_info = Gems.info(gem_name)
24
+ lines = File.open(filename).to_a
25
+
25
26
 
26
27
  unless gem_info['name'].nil?
27
28
  open('Gemfile', 'a') { |f|
28
- f.puts "gem '#{gem_info['name']}', '~> #{gem_info['version']}'"
29
+ f.sub(/\s+\Z/, "")
30
+ f.puts "\ngem '#{gem_info['name']}', '~> #{gem_info['version']}'"
29
31
  puts ''
30
32
  puts " '#{gem_info['name']}' gem added."
31
33
  puts ''
@@ -49,12 +51,12 @@ module Gemput
49
51
  puts ''
50
52
  puts '# gem version synchronizing start.'
51
53
  read_text.each_line do |line|
52
- gem_line = /^\s*gem '([^']*)'\s*$/.match(line)
54
+ gem_line = /^\s*gem ['"]([^']*)['"]\s*$/.match(line)
53
55
  unless gem_line.nil?
54
56
  name = gem_line.captures[0]
55
57
  gem_info = Gems.info(name)
56
58
  gem_version = gem_info['version']
57
- write_text << line.delete!("\n") << ", '~> " << gem_version << "'\n"
59
+ write_text << line.sub(/\s+\Z/, "") << ", '~> " << gem_version << "'\n"
58
60
  puts " - '#{name}' gem version added."
59
61
  else
60
62
  write_text << line
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.2
4
+ version: 0.1.3
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-15 00:00:00.000000000 Z
12
+ date: 2015-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler