gemstrap 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmU1MTAzYTBmNjhmYTc2NDVhNzdhZmI2YmZmMzQ1M2IxODIyNmZlMw==
5
- data.tar.gz: !binary |-
6
- MmFhZGNiNTMyNWIwNjAzN2YzYmU2NmZmYjQ0YWYwYjQ5ZWQ1NjYxYw==
2
+ SHA1:
3
+ metadata.gz: 444c3fdfe5711b3879a40e83f586c9a342c35e73
4
+ data.tar.gz: c72b8b1304376616f6a3c11963a46df09faf5709
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- Mjk4MDA2OTFmZTA2ZTk3Mzg1YWJhNTFhNjdjMGQ4ZGUxYTNlYzk5NDUyYzI0
10
- NjhmNDE2ZWE0ZGI4YjcxNjk1NTMzOTdmY2QyNjA2ZWRlZjYyZjcwNGVkMjk4
11
- Yzk4YTIyMWM3NTA1YTkyNDkwMzY3YzUyM2Q1MTJlZDY5NGYzNjI=
12
- data.tar.gz: !binary |-
13
- ZDM0MTY2MGU2NmMwZTkxZTI4YjY1MTc2MWJkZmM0OWMzOWFhYzAzZTVjZjI4
14
- NmM3MzgxZmU4MDNhMWY3ZWYyMTVkNTBhYjkzNWQyYzM3YTBlOTZhZWQ5YWMx
15
- NTE0NjYxZTk0Njc5N2I5OTI1YmI1Njc2N2ZhNmIxY2I4YzVjM2U=
6
+ metadata.gz: 33adff9f5c3f57298d8eb6db5d080ae9cef93ac090a747eed8a661f67d8da61678c972983b2f4887dc0cf23c7466b1914a6cac198856bc2b3f0b250e6211809f
7
+ data.tar.gz: bb6efe15fb6850948bd4f085211b186413a97396abab3f8f7c6a82f519832a22f0b76cfd4f9f04b2991152dc697d34a38d87cd9f3eeac6404b48645b5902dd4d
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # gemstrap
2
+
3
+ [![Build Status](https://travis-ci.org/dieb/gemstrap.svg?branch=master)](https://travis-ci.org/dieb/gemstrap)
4
+ [![Code Climate](https://codeclimate.com/github/dieb/gemstrap.png)](https://codeclimate.com/github/dieb/gemstrap)
5
+
6
+ [travis]: http://travis-ci.org/dieb/travis
7
+ [codeclimate]: https://codeclimate.com/github/dieb/gemstrap
8
+
9
+ Fastest way to bootstrap a new ruby gem.
10
+
11
+ ![Command-line mode](https://raw.githubusercontent.com/dieb/gemstrap/master/screenshot.png "Command line mode")
12
+
13
+ ## Installing
14
+
15
+ ```shell
16
+ $ gem install gemstrap
17
+ ```
18
+
19
+ Alternatively use our Docker image [dieb/gemstrap](https://registry.hub.docker.com/u/dieb/gemstrap/):
20
+
21
+ ```bash
22
+ $ docker pull dieb/gemstrap
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ $ gemstrap -h
29
+ Usage: gemstrap [options]
30
+ -h, --help Display this message
31
+ -V, --version Display version
32
+ -n, --name GEM_NAME Gem name
33
+ -d, --description GEM_DESC Gem description
34
+ -a, --authors AUTHORS CSV list of authors names (e.g. John Dorian, Christopher Turk)
35
+ -m, --emails AUTHORS_EMAILS CSV list of corresponding authors emails (e.g. jd@sacredheart.com, turk@sacredheart.com)
36
+ -s, --summary SUMMARY Gem summary. If not supplied takes description value.
37
+ -g, --github_user GITHUB_USER Github user. If not blank, homepage will be set to GITHUB_USER/GEM_NAME
38
+ -H, --homepage HOMEPAGE Homepage URL. Takes priority over the github_user parameter.
39
+ -i, --interactive Interactive mode. Prompt for user the parameters for gem generate.
40
+ ```
41
+
42
+ Or if you prefer through Docker:
43
+
44
+ ```bash
45
+ $ docker run --rm -ti -v $(pwd):/build dieb/gemstrap
46
+ gemstrap: starting interactive mode
47
+ gemstrap: please type in the required fields:
48
+ gem name: my_gem
49
+ ...
50
+ ```
51
+
52
+ Please note we bind the current folder to /build, which is where gemstrap spits out the new gem.
data/lib/gemstrap/cli.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'optparse'
2
2
  require 'gemstrap/version'
3
3
  require 'gemstrap/generator'
4
+ require 'term/ansicolor'
4
5
 
5
6
  module Gemstrap
6
7
  class CLI
8
+ extend Term::ANSIColor
9
+
7
10
  def self.read(arguments = ARGV)
8
11
  options = Hash.new
9
12
  optparse = OptionParser.new do |opts|
@@ -42,21 +45,40 @@ module Gemstrap
42
45
  end
43
46
  optparse.parse!(arguments)
44
47
  options = run_interactive_mode if options.empty?
45
- fail 'Gem name cannot be empty' unless options[:gem_name]
48
+ fail('error: gem name cannot be empty') if options[:gem_name].size == 0
49
+ options[:homepage] = "https://github.com/#{options[:github_user]}/#{options[:gem_name]}" if options[:homepage].size == 0
46
50
  options[:summary] ||= options[:description]
47
51
  options
48
52
  end
49
53
 
50
54
  def self.run_interactive_mode
51
55
  options = Hash.new
52
- gem_name = prompt('Gem name: ')
53
- options[:gem_name] = gem_name unless gem_name.empty?
54
- options[:description] = prompt('Gem description: ')
55
- options[:authors] = prompt('Authors: ').split(',')
56
- options[:authors_emails] = prompt('Authors emails: ').split(',')
57
- options[:summary] = prompt('Summary: ')
58
- options[:github_user] = prompt('Github user: ')
59
- options[:homepage] = prompt('Homepage: ')
56
+ puts "gemstrap: starting interactive mode"
57
+ puts 'gemstrap: please type in the required fields:'
58
+ options[:gem_name] = prompt(' gem name: ')
59
+
60
+ unless `which git`.empty?
61
+ git_name = `git config --global --get user.name`.strip
62
+ git_email = `git config --global --get user.email`.strip
63
+ git_author = "#{git_name} <#{git_email}>"
64
+ author = prompt(" author (press enter to autofill with #{git_author}): ")
65
+ if author.empty?
66
+ options[:authors] = [git_name]
67
+ options[:authors_emails] = [git_email]
68
+ else
69
+ options[:authors] = [author.split(' <').first]
70
+ options[:authors_emails] = [author.split(' <').last[0..-2]]
71
+ end
72
+ else
73
+ options[:authors] = [prompt(' author: ')]
74
+ options[:authors_emails] = [prompt(' author email: ')]
75
+ end
76
+
77
+ puts 'gemstrap: please type in the optional fields (hit ENTER to skip):'
78
+ options[:description] = prompt(' gem description: ')
79
+ options[:summary] = prompt(' gem summary: ')
80
+ options[:github_user] = prompt(' github user: ')
81
+ options[:homepage] = prompt(" homepage (press ENTER to autofill with https://github.com/#{options[:github_user]}/#{options[:gem_name]}): ")
60
82
  options
61
83
  end
62
84
 
@@ -1,17 +1,17 @@
1
1
  require 'pathname'
2
2
  require 'fileutils'
3
+ require 'term/ansicolor'
3
4
 
4
5
  require 'gemstrap/template'
5
- require 'gemstrap/colorize'
6
6
 
7
7
  module Gemstrap
8
8
  class Generator
9
9
  include FileUtils
10
- include Colorize
10
+ include Term::ANSIColor
11
11
 
12
12
  def run(args)
13
13
  options.merge!(args)
14
- puts " creating gem #{color(gem_name, YELLOW)}"
14
+ puts "gemstrap: creating gem #{yellow(gem_name)}"
15
15
  say_args(args)
16
16
  generate!
17
17
  rescue => e
@@ -48,12 +48,12 @@ module Gemstrap
48
48
  end
49
49
 
50
50
  def generate!
51
- puts ' generate'
51
+ puts 'gemstrap: generating...'
52
52
  mkdir_p(path)
53
53
  generate_root_files
54
54
  generate_lib_files
55
55
  mkdir_p(spec_path)
56
- cp(templates.join('Rakefile'), path)
56
+ puts 'gemstrap: done!'
57
57
  end
58
58
 
59
59
  def generate_root_files
@@ -92,16 +92,13 @@ module Gemstrap
92
92
  end
93
93
 
94
94
  def say_args(args)
95
- puts ' gem data'
96
95
  args.each do |k, v|
97
- k = color(k, BOLD, true)
98
- puts " using #{k.ljust(28)} => #{v}"
96
+ puts " #{white(bold('using'))} #{k.to_s.ljust(16)} => #{v}"
99
97
  end
100
98
  end
101
99
 
102
100
  def say_created(item)
103
- created_color = color('create', GREEN, true)
104
- puts " #{created_color} #{item}"
101
+ puts " #{green(bold('create'))} #{item}"
105
102
  end
106
103
 
107
104
  def gem_name_to_module_name
@@ -10,12 +10,12 @@ Gem::Specification.new do |s|
10
10
  s.version = <%= gem_module %>::VERSION
11
11
  <% if authors %>s.authors = <%= authors %><% end %>
12
12
  <% if authors_emails %>s.email = <%= authors_emails %><% end %>
13
- s.homepage = <% if homepage.size > 0 %>'<%= homepage %>'<% elsif github_user %>'https://github.com/<%= github_user %>/<%= gem_name %>'<% end %>
13
+ s.homepage = <% if homepage.size > 0 %>'<%= homepage %>'<% end %>
14
14
  s.summary = <%= summary.dump %>
15
15
  s.description = <%= description.dump %>
16
16
  s.license = 'MIT'
17
17
 
18
- s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
18
+ s.files = Dir['{lib,bin}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
19
19
  s.test_files = Dir['spec/**/*']
20
20
 
21
21
  s.add_development_dependency 'rake'
@@ -1,3 +1,3 @@
1
1
  module Gemstrap
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Dieb Martins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-15 00:00:00.000000000 Z
11
+ date: 2015-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: term-ansicolor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
41
55
  description: Command-line tool for bootstraping a new ruby gem in seconds.
42
56
  email:
43
57
  - andre.dieb@gmail.com
@@ -46,11 +60,11 @@ executables:
46
60
  extensions: []
47
61
  extra_rdoc_files: []
48
62
  files:
63
+ - README.md
49
64
  - Rakefile
50
65
  - bin/gemstrap
51
66
  - lib/gemstrap.rb
52
67
  - lib/gemstrap/cli.rb
53
- - lib/gemstrap/colorize.rb
54
68
  - lib/gemstrap/generator.rb
55
69
  - lib/gemstrap/template.rb
56
70
  - lib/gemstrap/template/Gemfile
@@ -72,17 +86,17 @@ require_paths:
72
86
  - lib
73
87
  required_ruby_version: !ruby/object:Gem::Requirement
74
88
  requirements:
75
- - - ! '>='
89
+ - - ">="
76
90
  - !ruby/object:Gem::Version
77
91
  version: '0'
78
92
  required_rubygems_version: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ! '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  requirements: []
84
98
  rubyforge_project:
85
- rubygems_version: 2.2.2
99
+ rubygems_version: 2.4.3
86
100
  signing_key:
87
101
  specification_version: 4
88
102
  summary: Fastest way to bootstrap a new ruby gem.
@@ -1,19 +0,0 @@
1
- module Gemstrap
2
- module Colorize
3
- CLEAR = "\e[0m"
4
- BOLD = "\e[1m"
5
- BLACK = "\e[30m"
6
- RED = "\e[31m"
7
- GREEN = "\e[32m"
8
- YELLOW = "\e[33m"
9
- BLUE = "\e[34m"
10
- MAGENTA = "\e[35m"
11
- CYAN = "\e[36m"
12
- WHITE = "\e[37m"
13
-
14
- def color(text, color, bold = false)
15
- bold = bold ? BOLD : ''
16
- "#{bold}#{color}#{text}#{CLEAR}"
17
- end
18
- end
19
- end