LoginSignup
1
2

More than 3 years have passed since last update.

GitHubにプルリクを送ってみる

Posted at

まず、前回の「RubyからCocoaを使ってみる」を参照する。
https://qiita.com/KoichiroEto/items/3e408e1420171f97fe61

修正する内容

実行する際に、warningが出る。

% ruby test1.rb
/usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Bignum is deprecated

以下のようにFixnum, BignumをIntegerに変更すると、warningは出なくなる。

% cd /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc
% cp method_def.rb method_def.rb.org
% vi method_def.rb
% diff method_def.rb.org method_def.rb
154c154
<         when Fixnum, Bignum
---
>         when Integer

参考:
- https://teratail.com/questions/153236
- https://github.com/rails/sprockets/pull/392

プルリクエストの作成

せっかくなので、プルリクしてみよう。

1. Forkする

2. cloneする

% cd ~/dev
% git clone https://github.com/eto/cocoa.git
% cd cocoa
% git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

3. branchを切る

% git checkout -b develop
Switched to a new branch 'develop'

4. 修正する

% cd lib/cocoa/objc
% vi method_def.rb

修正を確認する。

% git diff
diff --git a/lib/cocoa/objc/method_def.rb b/lib/cocoa/objc/method_def.rb
index c588790..21779ba 100644
--- a/lib/cocoa/objc/method_def.rb
+++ b/lib/cocoa/objc/method_def.rb
@@ -177,7 +177,7 @@ module ObjC
case value
when TrueClass, FalseClass
[:bool,value]
- when Fixnum, Bignum
+ when Integer
[TYPES[types[i]],value]
when Float
[:double,value]

5. pushする

% git add method_def.rb
% git commit -m "Fix 'warning: constant ::Fixnum, Bignum is deprecated'."
[master fdfaa0e] Fix 'warning: constant ::Fixnum, Bignum is deprecated'.
1 file changed, 1 insertion(+), 1 deletion(-)

% git push origin develop
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 526 bytes | 526.00 KiB/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote:
remote: Create a pull request for 'develop' on GitHub by visiting:
remote: https://github.com/eto/cocoa/pull/new/develop
remote:
To https://github.com/eto/cocoa.git
* [new branch] develop -> develop

6. PullRequestを作る

This pull request fixes the following warnings.
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Bignum is deprecated

done!

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2