learn_create 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/README.md +9 -3
  4. data/lib/learn_create.rb +10 -3
  5. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5a397ec4099b22f865a2e96de78304c280016072ee317ae6ce96f6c24572e31
4
- data.tar.gz: b12771873be24cfdacc0fdd7dac21889d94ffbe27c2649c4e1def3ac815b7438
3
+ metadata.gz: 96ddd5051568d3b75d8e35190e08e2edf2489b68a25f6f65c29bda39bcf806b6
4
+ data.tar.gz: e60cbe8a82c80d8df71d287a5181b0b40e07dab2a16ddc282490c8ba4c2029e1
5
5
  SHA512:
6
- metadata.gz: 5b88452442387e3bf66e7d7c4af2bfae8ddd579a35efc835fd1c2506d6871f9def23bcf6d990ed1a6f66bd3f06a1ab99532f5e0265ecc5f67c0cfc5feefd320f
7
- data.tar.gz: 4a34c211543744f0393621d68c96349515f2e54b219911b630cdc00df0fee1d62c4623a6af1d88ef84d90c19d11c1901dfb0ea3442b6a4cafb0a26fd731ab538
6
+ metadata.gz: f1660d3fdc0947302ce50880b14c8387a74c09b0358c1505436b0abeab197059621b1462997bde6f656be83ee09b22082bce924f602a434f3a98d6bfe4e26ef7
7
+ data.tar.gz: 4e9c629adcb4759409e560850dd1fa2279dba6a04a4a6480cc9151a588b8bd742774c59b00f0d8b49349fc4246b254ae3edea6621c916c2e23dde660f974bb0b
data/Gemfile CHANGED
@@ -11,5 +11,4 @@ gem 'awesome_print'
11
11
  gem 'faraday'
12
12
  gem 'uri'
13
13
 
14
- # Specify your gem's dependencies in readability_score.gemspec
15
- gemspec
14
+ # Specify your gem's dependencies in learn_create.gemspec
data/README.md CHANGED
@@ -14,11 +14,17 @@ Once `hub` is installed, you'll need to get it configured before running
14
14
  `learn_create`. The best way to do this is to use `hub` once to create a
15
15
  repository on learn-co-curriculum. In the shell:
16
16
 
17
- - Create a new, empty folder and navigate into it
17
+ - Create a new, empty folder and `cd` into it
18
+ - `git init` to create an initial git repo
18
19
  - Run `hub create learn-co-curriculum/<whatever name you've chosen>`
19
20
  - You should be prompted to sign into GitHub
20
- - If everything works as expected you should now have an empty
21
- learn-co-curriculum repo on GitHub
21
+ - **Note:** If you have set up two-factor identification on GitHub, when
22
+ prompted for your password, you have two options:
23
+ - If Github SMS' you a one-time password, use it!
24
+ - Otherwise, instead of using your normal password, you
25
+ need to enter a personal access token. You can create a token in your
26
+ GitHub settings page.
27
+ - If everything works as expected you should now have an empty `learn-co-curriculum` repo.
22
28
  - Delete the repo. Everything should be set up now.
23
29
 
24
30
  Install the `learn_create` gem:
@@ -1,6 +1,6 @@
1
- require 'require_all'
2
1
  require 'faraday'
3
2
  require 'uri'
3
+ require 'open3'
4
4
 
5
5
  class LearnCreate
6
6
  def initialize
@@ -8,6 +8,7 @@ class LearnCreate
8
8
 
9
9
  # Checks to see if chosen name already exists as a repository
10
10
  @repo_name = ''
11
+ @ssh_configured = check_ssh_config
11
12
 
12
13
  loop do
13
14
  puts 'What is the name of the repository you would like to create?'
@@ -15,7 +16,7 @@ class LearnCreate
15
16
  url = 'https://api.github.com/repos/learn-co-curriculum/' + @repo_name
16
17
  encoded_url = URI.encode(url).slice(0, url.length)
17
18
 
18
- # Will hit rate limint on github is used too much
19
+ # Will hit rate limit on github is used too much
19
20
  check_existing = Faraday.get URI.parse(encoded_url)
20
21
 
21
22
  break if check_existing.body.include? '"Not Found"'
@@ -161,7 +162,8 @@ jspm_packages
161
162
  end
162
163
 
163
164
  def git_set_remote
164
- cmd = cd_into_and("git remote set-url origin https://github.com/learn-co-curriculum/#{@repo_name}")
165
+ remote = @ssh_configured ? "git@github.com:learn-co-curriculum/#{@repo_name}.git" : "https://github.com/learn-co-curriculum/#{@repo_name}"
166
+ cmd = cd_into_and("git remote set-url origin ")
165
167
  `#{cmd}`
166
168
  end
167
169
 
@@ -191,4 +193,9 @@ jspm_packages
191
193
  puts 'Pushing to remote'
192
194
  git_push
193
195
  end
196
+
197
+ def check_ssh_config
198
+ result = Open3.capture2e('ssh -T git@github.com').first
199
+ result.include?("You've successfully authenticated")
200
+ end
194
201
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn_create
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - flatironschool
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-11-20 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.15'
13
27
  description:
14
28
  email: maxwell@flatironschool.com
15
29
  executables:
@@ -77,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
91
  version: '0'
78
92
  requirements: []
79
93
  rubyforge_project:
80
- rubygems_version: 2.7.7
94
+ rubygems_version: 2.7.6
81
95
  signing_key:
82
96
  specification_version: 4
83
97
  summary: learn_create is a tool for creating learn.co lessons on github