Skip to content

Loading…

New formula for Telegram messenger CLI #27098

Closed
wants to merge 1 commit into from

5 participants

@JosephKu

Command-line interface for Telegram
https://github.com/vysheng/tg

@mistydemeo

We'll require an officially tagged release to accept this.

@adamv adamv added the new formula label
@adamv adamv commented on an outdated diff
Library/Formula/tg.rb
((1 lines not shown))
+require 'formula'
+
+class Tg < Formula
+ homepage 'https://github.com/vysheng/tg'
+ version '0.01-beta'
+ url 'https://github.com/vysheng/tg/archive/75194f4552406098ff09c761a8434849b38d8236.zip'
+ sha1 '57da7dfc9c8596f49f0a07799eef4d067cf87378'
+
+ head 'https://github.com/vysheng/tg.git', :branch => 'master'
+
+ depends_on 'libconfig'
+ depends_on 'readline'
+ depends_on 'lua'
+
+ def install
+ configure_args = [ "--prefix=#{prefix}" ]
@adamv
adamv added a note

By convention this variable should be called args, but since there are no conditional args, just inline the single arg to the configure call.

Got it. I'll revise it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@JosephKu

@mistydemeo Tagged for version?

@adamv

We don't want to pull from an arbitrary git commit; when a git tag is created for a GitHub project, it creates tarballs with the version name in it.

@JosephKu

@adamv Understood. I'll discuss with the creator. Thanks!

@mikemcquaid mikemcquaid commented on the diff
Library/Formula/tg.rb
((5 lines not shown))
+ version '0.01-beta'
+ url 'https://github.com/vysheng/tg/archive/75194f4552406098ff09c761a8434849b38d8236.zip'
+ sha1 '57da7dfc9c8596f49f0a07799eef4d067cf87378'
+
+ head 'https://github.com/vysheng/tg.git', :branch => 'master'
+
+ depends_on 'libconfig'
+ depends_on 'readline'
+ depends_on 'lua'
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make"
+
+ prefix.install "tg.pub"
+ bin.install "telegram"
@mikemcquaid Homebrew member

No make install?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mikemcquaid mikemcquaid commented on the diff
Library/Formula/tg.rb
((13 lines not shown))
+ depends_on 'lua'
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make"
+
+ prefix.install "tg.pub"
+ bin.install "telegram"
+ end
+
+ def caveats
+ <<-EOS.undent
+ You need a public server key to launch Telegram messenger CLI.
+ By default the public key could be stored in the same folder named tg.pub or in /etc/telegram named server.pub:
+
+ sudo mkdir /etc/telegram
@mikemcquaid Homebrew member

Should be #{etc}/telegram and not require sudo.

It should be. However, it uses fixed path, and the path is not configurable.

@mikemcquaid Homebrew member

We need to try and patch this (or ask upstream to do so) in this case. I'm not happy including this if it needs users to mess around with /etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mikemcquaid mikemcquaid commented on the diff
Library/Formula/tg.rb
((4 lines not shown))
+ homepage 'https://github.com/vysheng/tg'
+ version '0.01-beta'
+ url 'https://github.com/vysheng/tg/archive/75194f4552406098ff09c761a8434849b38d8236.zip'
+ sha1 '57da7dfc9c8596f49f0a07799eef4d067cf87378'
+
+ head 'https://github.com/vysheng/tg.git', :branch => 'master'
+
+ depends_on 'libconfig'
+ depends_on 'readline'
+ depends_on 'lua'
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make"
+
+ prefix.install "tg.pub"
@mikemcquaid Homebrew member

Looks like this should be using etc.install instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mikemcquaid mikemcquaid commented on the diff
Library/Formula/tg.rb
((20 lines not shown))
+ bin.install "telegram"
+ end
+
+ def caveats
+ <<-EOS.undent
+ You need a public server key to launch Telegram messenger CLI.
+ By default the public key could be stored in the same folder named tg.pub or in /etc/telegram named server.pub:
+
+ sudo mkdir /etc/telegram
+ sudo ln -sf #{prefix}/tg.pub /etc/telegram/server.pub
+
+ Furthermore, you could specify where to find it:
+
+ telegram -k <public-server-key>
+
+ EOS
@mikemcquaid Homebrew member

Let's just set this up so it knows where to look by default rather than needing this caveat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mistydemeo

Request for tag was filed upstream at vysheng/tg#130, for reference

@adamv

Passing on this for now, but will review again when a stable version is released.

@adamv adamv closed this
@luckydonald

@mistydemeo, @adamv
stable version 1.0.0, yay!

@mistydemeo

We'd review a new pull request if one's submitted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2014
  1. @JosephKu
Showing with 37 additions and 0 deletions.
  1. +37 −0 Library/Formula/tg.rb
View
37 Library/Formula/tg.rb
@@ -0,0 +1,37 @@
+require 'formula'
+
+class Tg < Formula
+ homepage 'https://github.com/vysheng/tg'
+ version '0.01-beta'
+ url 'https://github.com/vysheng/tg/archive/75194f4552406098ff09c761a8434849b38d8236.zip'
+ sha1 '57da7dfc9c8596f49f0a07799eef4d067cf87378'
+
+ head 'https://github.com/vysheng/tg.git', :branch => 'master'
+
+ depends_on 'libconfig'
+ depends_on 'readline'
+ depends_on 'lua'
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make"
+
+ prefix.install "tg.pub"
@mikemcquaid Homebrew member

Looks like this should be using etc.install instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ bin.install "telegram"
@mikemcquaid Homebrew member

No make install?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+
+ def caveats
+ <<-EOS.undent
+ You need a public server key to launch Telegram messenger CLI.
+ By default the public key could be stored in the same folder named tg.pub or in /etc/telegram named server.pub:
+
+ sudo mkdir /etc/telegram
@mikemcquaid Homebrew member

Should be #{etc}/telegram and not require sudo.

It should be. However, it uses fixed path, and the path is not configurable.

@mikemcquaid Homebrew member

We need to try and patch this (or ask upstream to do so) in this case. I'm not happy including this if it needs users to mess around with /etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ sudo ln -sf #{prefix}/tg.pub /etc/telegram/server.pub
+
+ Furthermore, you could specify where to find it:
+
+ telegram -k <public-server-key>
+
+ EOS
@mikemcquaid Homebrew member

Let's just set this up so it knows where to look by default rather than needing this caveat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+end
Something went wrong with that request. Please try again.