项目骨架

时间:2014-10-19 16:25:36

标签: ruby project

我无法制作项目骨架。 TEST_NAME.rb:

    require "./lib/NAME.rb"
    require "test/unit"

    class TestNAME < Test::Unit::TestCase

      def test_sample
        assert_equal(4, 2+2)
      end

    end

gemspec文件名NAME.gemspec将描述我们的项目:

    # coding: utf-8
    lib = File.expand_path('../lib', __FILE__)
    $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

    Gem::Specification.new do |spec|
      spec.name          = "NAME"
      spec.version       = '1.0'
      spec.authors       = ["Yanzhe"]
      spec.email         = ["awesomeyanzhe@gmail.com"]
      spec.summary       = %q{About me}
      spec.description   = %q{This page is mainly about me.}
      spec.homepage      = "http://yanzhefeng.com/"
      spec.license       = "MIT"

      spec.files         = ['lib/NAME.rb']
      spec.executables   = ['bin/NAME']
      spec.test_files    = ['tests/test_NAME.rb']
      spec.require_paths = ["lib"]
    end

当你完成所有这些设置后,你的目录应该像我的一样:

    skeleton/
        NAME.gemspec
        Rakefile
        data
        ext/
        tests/
        bin/
            NAME
        doc/
        lib/
            NAME
            NAME.rb
        lib/NAME
        tests/
            test_NAME.rb

任何答案都没问题

1 个答案:

答案 0 :(得分:2)

请确保文件目录正确无误。