octopush 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gictocat.rb +2 -2
  3. data/lib/octopush.rb +16 -13
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4dda158a0983deb8a132eb47a962062d3752934
4
- data.tar.gz: cded430ac329f0c3c7ef8298ef7e965686714090
3
+ metadata.gz: b49caddf4e326d14fb74e6197cab8772cca9b2d1
4
+ data.tar.gz: ca7a907d3e95664da25a5a4d73eb65f9f1a5221d
5
5
  SHA512:
6
- metadata.gz: 142a63650d5abb430a0e1ea93ab887233e432d84d2a3d22c8ae0009b6e55bbf18e5c370e9ab4c7a57f1097884added5cef8f2edf76b3a3afe26ed46b70c155a0
7
- data.tar.gz: 7a6f128310f5f87b92e81ae3edf665818d1f52870d0693a1934b949ec4ab7aa05b081e04f5ad349c68dc609983267486745a46e0669f68ad881fc8e6423ec15f
6
+ metadata.gz: c739131f90ed570300383fd2b858b2b1bb92a02f3aefa4428bf51d913e55142aa5874ac860e8a4570f21613a5f1c9dc2ca67133a1ef18250c1df150961158127
7
+ data.tar.gz: 1c8839803aa6ed517d3a8508f33a36382e532785d915cb030986bc8cc7e22630fc9a9e0718ad45997b21530c974848678ae90891a113ab99de62565f2ce10c43
data/lib/gictocat.rb CHANGED
@@ -2,7 +2,7 @@ require 'colorize'
2
2
  require 'github_api'
3
3
 
4
4
  # mix in model for very simple github repo manipulation
5
- # requires class to respond to repository name
5
+ # requires class to respond to repository_name, username, password
6
6
  module Gictocat
7
7
 
8
8
  def initialize_repo(repository_name = repository_name)
@@ -32,7 +32,7 @@ module Gictocat
32
32
 
33
33
  def add_github_remote(remote_name = 'origin')
34
34
  puts "#{cyan_arrow} Adding GitHub as a remote"
35
- `git remote add #{remote_name} https://github.com/#{configuration['username']}/#{repository_name}.git`
35
+ `git remote add #{remote_name} https://github.com/#{username}/#{repository_name}.git`
36
36
  end
37
37
 
38
38
  def push_repo
data/lib/octopush.rb CHANGED
@@ -16,44 +16,47 @@ class Octopush < Thor
16
16
  Dir.chdir("./#{repository_name}")
17
17
  add_and_commit_readme
18
18
  push_to_github
19
+ puts "#{cyan_arrow} done."
19
20
  end
20
21
 
21
- desc "create_config", "Creates an empty octopush configuration in ~/.octopushrc"
22
- def create_config
23
- create_empty_configuration
24
- end
25
22
 
26
23
  private
27
24
 
28
25
  def repository_name
29
26
  @repository_name
30
- end
31
27
 
28
+ end
32
29
  def username
33
- return configuration['username'] if configuration['username']
34
- ask "Github Username:"
30
+ return @username if @username
31
+ if configuration['username'] && configuration['username'] != '<your_username>'
32
+ @username = configuration['username']
33
+ else
34
+ @username = ask "GitHub Username:"
35
+ end
35
36
  end
36
37
 
37
38
  def password
38
- return configuration['password'] if configuration['password']
39
- ask("GitHub Password:", :echo => false)
39
+ return @password if @password
40
+ if configuration['password'] && configuration['password'] != '<your_password>'
41
+ @password = configuration['password']
42
+ else
43
+ @password = ask "GitHub Password:", echo: false
44
+ end
40
45
  end
41
46
 
42
47
  def configuration
43
48
  begin
44
49
  @configuration ||= YAML.load(File.read(CONFIGURATION_FILE))
45
50
  rescue
46
- puts "#{red_arrow} Run octopush create_config for storing credentials"
51
+ create_empty_configuration
47
52
  return @configuration = {} # an empty configuration..
48
53
  end
49
54
  end
50
55
 
51
56
  def create_empty_configuration
57
+ puts "#{red_arrow} Configuration not found. Edit your ~/.octopushrc for storing credentials"
52
58
  configuration ="username: <your_username>\npassword: <your_password>"
53
59
  File.open(CONFIGURATION_FILE, 'wb') { |f| f.write(configuration) }
54
-
55
- puts "#{red_arrow} No configuration found!"
56
- puts "Initialized configuration file in ~/.octopushrc"
57
60
  end
58
61
 
59
62
  def red_arrow
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martino Visintin