Sha256: c5126b469f309349da05dc80162637a4832c669b242b870d6ed4a8dcc8951c8b

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

module StrongPermitter
  class Cli
    def self.start(*args)
      if args.length != 1
        puts "Unknown command format. Please use 'strong_permitter -h' for more information."
        return
      end

      case args.first
        when '--help', '-h'
          puts 'Commands format: strong_permitter <command>'
          puts 'Available commands:'
          puts "\tinstall\t- Create initializer for Rails application"
        when 'install'
          print 'Creating config/initializers/strong_permitter.rb'
          if File.exist?('config/initializers/strong_permitter.rb')
            puts "\t(already exist - skipped)"
          else
            FileUtils.cp(File.expand_path('../templates/initializer.rb', __FILE__), 'config/initializers/strong_permitter.rb')
            puts "\t(ok)"
          end

          print 'Making directory app/controllers/permissions'
          if Dir.exist?('app/controllers/permissions')
            puts "\t\t(already exist - skipped)"
          else
            FileUtils.mkpath 'app/controllers/permissions'
            puts "\t\t(ok)"
          end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strong-permitter-0.0.3 lib/strong_permitter/cli.rb
strong-permitter-0.0.2 lib/strong_permitter/cli.rb
strong-permitter-0.0.1 lib/strong_permitter/cli.rb