Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Commit

Permalink
add generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy B committed Aug 7, 2017
1 parent 7a7b533 commit d6204dc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6 deletions.
1 change: 1 addition & 0 deletions exe/rubotnik
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env ruby
require 'rubotnik/cli'
require 'rubotnik/generator'
Rubotnik::CLI.start
3 changes: 2 additions & 1 deletion lib/rubotnik.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'rubotnik/user_store'
require 'rubotnik/user'
require 'rubotnik/cli'
require 'rubotnik/generator'
require 'rubotnik/autoloader'
require 'ui/fb_button_template'
require 'ui/fb_carousel'
Expand All @@ -12,7 +13,7 @@
require 'sinatra'
require 'facebook/messenger'
include Facebook::Messenger

# TODO: Nest UI inside Rubotnik

module Rubotnik
def self.subscribe(token)
Expand Down
9 changes: 9 additions & 0 deletions lib/rubotnik/cli.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
require 'thor'
require 'rubotnik'
require 'rubotnik/generator'

module Rubotnik
class CLI < Thor
desc "test WORD", "Echos argument to console"
def test(*word)
puts word.join(' ')
end

desc "generate", "Generate file structure"
def generate
generator = Rubotnik::Generator.new
generator.destination_root = '~/tmp/test'
generator.invoke_all
end
end
end
2 changes: 1 addition & 1 deletion lib/rubotnik/commands.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Commands
# The contents of this module will be overridden by Commands in host
# The contents of this module will be overridden by Commands inside host app
end;
26 changes: 26 additions & 0 deletions lib/rubotnik/generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'thor'
require 'thor/group'
require 'rubotnik'

class Rubotnik::Generator < Thor::Group
include Thor::Actions
desc 'Generate a new filesystem structure'

def self.source_root
File.dirname(__FILE__) + '/../../templates'
end

# def create_config_file
# copy_file 'config.yml', 'config/mygem.yml'
# end

def create_git_files
copy_file 'gitignore', '.gitignore'
create_file 'images/.gitkeep'
create_file 'text/.gitkeep'
end

def create_output_directory
empty_directory 'output'
end
end
5 changes: 1 addition & 4 deletions lib/rubotnik/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

# TODO: Update README on say(quick_replies: []) simplified API

# Place for methods that make your life easier.
# They can be called from anywhere inside the common namespace.
module Rubotnik
module Helpers
# State 'module_function' before any method definitions so
# commands are mixed into Dispatch classes as private methods.
# Mixed-in methods become private
module_function

GRAPH_URL = 'https://graph.facebook.com/v2.8/'.freeze
Expand Down

0 comments on commit d6204dc

Please sign in to comment.