Class: QiitaOrg::CLI
- Inherits:
-
Thor
- Object
- Thor
- QiitaOrg::CLI
- Defined in:
- lib/qiita_org.rb
Instance Method Summary collapse
- #all(*argv) ⇒ Object
- #config(*argv) ⇒ Object
- #get(*argv) ⇒ Object
- #list(*argv) ⇒ Object
- #post(*argv) ⇒ Object
- #say_hello(*name) ⇒ Object
- #template(*argv) ⇒ Object
Instance Method Details
#all(*argv) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/qiita_org.rb', line 67 def all(*argv) Dir.glob("*.org").each do |org| puts org.blue if File.read(org).match(/#\+qiita_(.+)/) system ("qiita post #{org} open") if File.read(org).match(/#\+(.+)_public/) system ("qiita post #{org} teams") if File.read(org).match(/#\+(.+)_teams/) system ("qiita post #{org} private") if File.read(org).match(/#\+(.+)_private/) else system ("qiita post #{org}") end end end |
#config(*argv) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/qiita_org.rb', line 42 def config(*argv) status = argv[0] || "local" option = argv[1] || nil input = [argv[2], argv[3], argv[4]] config = QiitaConfig.new(status, option, input) config.run end |
#get(*argv) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/qiita_org.rb', line 52 def get(*argv) p mode = argv[0] || "qiita" p id = argv[1] || nil get = QiitaGet.new(mode, id) get.run end |
#list(*argv) ⇒ Object
82 83 84 85 |
# File 'lib/qiita_org.rb', line 82 def list(*argv) p mode = argv[0] || "qiita" QiitaList.new(mode) end |
#post(*argv) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/qiita_org.rb', line 26 def post(*argv) p ["in qiita_org.rb", argv] p file = argv[0] || "README.org" p mode = argv[1] || "private" qiita = QiitaPost.new(file, mode) begin qiita.select_option(mode) rescue RuntimeError => e puts $! else qiita.run end end |
#say_hello(*name) ⇒ Object
19 20 21 22 |
# File 'lib/qiita_org.rb', line 19 def say_hello(*name) name = name[0] || "world" puts "Hello #{name}." end |
#template(*argv) ⇒ Object
61 62 63 |
# File 'lib/qiita_org.rb', line 61 def template(*argv) template = QiitaGetTemplate.new() end |