creategem 0.2.2 → 0.2.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: f08c6a1049f05bc5f9f8319be3137c0417e2b946
4
- data.tar.gz: 83928a3a7980452a0faeedc949362ea051fe7aba
3
+ metadata.gz: 48373e9f1ea3ccb88b0efdd6abe44e948116e418
4
+ data.tar.gz: b8aa17c763cd0aa8cba950401c5ef89a2d65a3b9
5
5
  SHA512:
6
- metadata.gz: 4afd5d1d641b567f4b6c70a94b4577fb7dbca3d2f89d97bfdd2ab8df939c124d3aec71456c2f3504e58786b90f3b87f239d6f9ea3928775276fc3c9b71d9324b
7
- data.tar.gz: 6d4e8f7b8171797ad625fdfd546a113f77245367fc90be56823f1061b426a3e75dc06ab945fdcc9fc754ed05b5713508202c5a2e4b38ca8999c5efd3a91c81c3
6
+ metadata.gz: b687390d6c0b5ad350dfee038b1121f24afe91f854727b8ac894b7395b73d97ca972218666e833fd69cbc44b5415a0766927ea503299be8f450e3b0626ea0ba9
7
+ data.tar.gz: 67a12314556d2e842a776e0cd6430f3d05d651ce085fb7673f6ba50b36046838f618bdcbe081217e416efc01ccfd5b7b6438ba60d76032b96ceae9e2ce14ce25
data/README.md CHANGED
@@ -12,14 +12,14 @@
12
12
  [codeclimate]: https://codeclimate.com/github/igorj/creategem
13
13
  [coveralls]: https://coveralls.io/r/igorj/creategem
14
14
 
15
- Creategem creates a scaffold project for a new gem together with remote repository (Github or Bitbucket) and is ready to be released in a private or public gem server.
15
+ Creategem creates a scaffold project for a new gem together with remote repository (Github or Bitbucket) and is ready to be released in a public or private gem server.
16
16
 
17
17
  This project is inspired by the [Bundler](http://bundler.io)'s `bundle gem GEM command and by the great article [Deveoping a RubyGem using Bundler](https://github.com/radar/guides/blob/master/gem-development.md).
18
18
 
19
19
  Similar to what Bundler's bundle gem command does, this gem generates a scaffold with all files you need to start, but it also has some additional features.
20
20
 
21
21
  Features:
22
- - automatically creates local and remote git repository (bitbucket or github) for your gem
22
+ - automatically creates local and remote git repository (github or bitbucket) for your gem
23
23
  - automatically release patches, minor and major versions without having to manually increase versions (thanks to [gem-release](https://github.com/svenfuchs/gem-release))
24
24
  - executable based on [Thor](http://whatisthor.com) (can be omited with --no-executable)
25
25
  - test infrastructure based on minitest
@@ -33,15 +33,15 @@ Features:
33
33
 
34
34
  ## Usage
35
35
 
36
- $ creategem gem GEM_NAME [--public] [--no-executable]
36
+ $ creategem gem GEM_NAME [--private] [--no-executable]
37
37
 
38
- When called without any options it is assumed that you want a gem with an executable and hosted in a private bitbucket git repository, and released on a private Geminabox server.
38
+ When called without any options it is assumed that you want a gem with an executable and hosted in a public github git repository, and released to rubygems.org.
39
39
 
40
- During the creation you will be asked for your bitbucket user name and the url of your geminabox gem server (only the first time, as the user name and the gem server url are saved in your git global config). You will also be asked to enter your bitbucket password when the remote repository is created for you with the bitbucket rest api.
40
+ During the creation you will be asked for your github user name (only the first time, as the user name is saved in your git global config). You will also be asked to enter your github password when the remote repository is created for you with the github rest api.
41
41
 
42
- When you use the `--public` option a github repository is created for the gem and on release the gem is pushed to rubygems.org.
42
+ When you use the `--private` option a bitbucket repository is created for the gem and on release the gem is pushed to a private Geminabox server.
43
43
 
44
- During the creation you will be asked for your github user name (only the first time, as the user name is saved in your git global config). You will also be asked to enter your github password when the remote repository is created for you with the github rest api.
44
+ During the creation you will be asked for your bitbucket user name and the url of your geminabox gem server (only the first time, as the user name and the gem server url are saved in your git global config). You will also be asked to enter your bitbucket password when the remote repository is created for you with the bitbucket rest api.
45
45
 
46
46
  Per default a gem is created with an executable based on Thor, but you can omit the executable with the option `--no-executable`.
47
47
 
data/lib/creategem/cli.rb CHANGED
@@ -16,15 +16,15 @@ module Creategem
16
16
  File.expand_path('../../../templates', __FILE__)
17
17
  end
18
18
 
19
- desc "gem NAME", "Creates a new gem with a given NAME with Bitbucket git repository and private geminabox gem repository; Options: --public (Github/Rubygems), --no-executable"
20
- option :public, type: :boolean, default: false, desc: "When true, Github and Rubygems are used, otherwise Bitbucket and Geminabox are used (default)"
19
+ desc "gem NAME", "Creates a new gem with a given NAME with Github git repository; Options: --private (Bitbucket/Geminabox), --no-executable"
20
+ option :private, type: :boolean, default: false, desc: "When true, Bitbucket and Geminabox are used, otherwise Github and Rubygems are used (default)"
21
21
  option :executable, type: :boolean, default: true, desc: "When true, gem with executable is created"
22
22
  def gem(gem_name)
23
23
  say "Create a gem scaffold for gem named: #{gem_name}", :green
24
24
  @gem_name = gem_name
25
25
  @class_name = Thor::Util.camel_case(gem_name)
26
26
  @executable = options[:executable]
27
- vendor = options[:public] ? :github : :bitbucket
27
+ vendor = options[:private] ? :bitbucket : :github
28
28
  @repository = Creategem::Repository.new(vendor: vendor,
29
29
  user: git_repository_user_name(vendor),
30
30
  name: gem_name,
@@ -39,36 +39,10 @@ module Creategem
39
39
  Dir.chdir gem_name do
40
40
  create_local_git_repository
41
41
  run "bundle install"
42
- create_remote_git_repository(@repository)
42
+ create_remote_git_repository(@repository) if yes?("Do you want me to create #{vendor} repository named #{gem_name}? (y/n)")
43
43
  end
44
44
  say "The gem #{gem_name} was successfully created.", :green
45
45
  say "Please complete the information in #{gem_name}.gemspec and README.md (look for TODOs).", :blue
46
46
  end
47
-
48
- private
49
-
50
- def git_repository_user_name(vendor)
51
- git_config_key = "creategem.#{vendor}user"
52
- user = ::Git.global_config(git_config_key)
53
- if user.nil? || user.empty?
54
- user = ask("What is your #{vendor} user name?")
55
- ::Git.global_config(git_config_key, user)
56
- end
57
- user
58
- end
59
-
60
- def gem_server_url(vendor)
61
- if vendor == :github
62
- "https://rubygems.org"
63
- else
64
- git_config_key = "creategem.gemserver"
65
- url = ::Git.global_config(git_config_key)
66
- if url.nil? || url.empty?
67
- url = ask("What is the url of your geminabox server?")
68
- ::Git.global_config(git_config_key, url)
69
- end
70
- url
71
- end
72
- end
73
47
  end
74
48
  end
data/lib/creategem/git.rb CHANGED
@@ -22,5 +22,29 @@ module Creategem
22
22
  say "Push initial commit to remote #{repository.vendor} repository", :green
23
23
  run "git push -u origin master"
24
24
  end
25
+
26
+ def git_repository_user_name(vendor)
27
+ git_config_key = "creategem.#{vendor}user"
28
+ user = ::Git.global_config(git_config_key)
29
+ if user.nil? || user.empty?
30
+ user = ask("What is your #{vendor} user name?")
31
+ ::Git.global_config(git_config_key, user)
32
+ end
33
+ user
34
+ end
35
+
36
+ def gem_server_url(vendor)
37
+ if vendor == :github
38
+ "https://rubygems.org"
39
+ else
40
+ git_config_key = "creategem.gemserver"
41
+ url = ::Git.global_config(git_config_key)
42
+ if url.nil? || url.empty?
43
+ url = ask("What is the url of your geminabox server?")
44
+ ::Git.global_config(git_config_key, url)
45
+ end
46
+ url
47
+ end
48
+ end
25
49
  end
26
50
  end
@@ -1,3 +1,3 @@
1
1
  module Creategem
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creategem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev