• 提问要有方法 at 2012年01月10日

    #24 楼 问问题也有个度,大家自己把握。对于 ruby 新手来说,有的人不可避免的在 ruby 还没真正掌握的时候就来搭建 ruby-china 并调试,这也是一种学习方式。这时遇到问题后 google 出来的结果往往只有 1 条甚至 0 条答案,而且答案来源还是 ruby-china.org 上的。所以就来这里咨询。新手有自知之明就好,事先说不说自己已经 google 过了再来问的,这个都看新手自己。当然也请老手随意,对于那些讨厌的问题,可以根据第一印象就 X 掉不回答。

    一个技术类新站的成长其实也离不开各种鸟的,毕竟这也是一个过程。ruby 在国内还是很小众?如果是小众那么会有很多的新手,他们提的水“提”绝大多数是垃圾,但也存在代表性的概率。如果那些有用的水“提”没有整理总结或者没有在网上留下任何痕迹,那新手还是要再走一遍老手走过的弯路。

    喜欢有水平的问题那是人之常情。要看 ruby-china.org 的管理者对网站的定位怎么样了。

    以下 3 个情况导致了新手面对问题会感觉稍微麻烦一点点: 1、ruby 翻译的中文书籍时间差很大--不实用(建议新手直接看网上的最新英文电子版) 2、ruby 的版本间兼容性也不够,ruby 成型程序涉及到的周边软件多、需要特定版本支持; 3、社区没有国外成熟。

  • #11 楼 @huacnlee 是不是可以在 https://github.com/huacnlee/ruby-china/blob/master/README.markdown 文件里把涉及到软件的版本都标上。这样大家有个参考。 1、这样以后部署时因为版本带来的提问就可以少一些.(maybe:)
    2、-O 选项如果是关键性的,那用错了版本后只能去掉-O 选项,可能对运行引入新问题 (maybe or not。。。 :)

  • #1 楼 @cqpx 意思是我要在 github 申请加入 github ruby-china 项目后?能解决上面的哪个问题? config.yml 里的 github_token 和 github_secret 值我都没有改过的。修改的有: domain 改成本地地址 : "127.0.0.1:3000" admin_emails: 改成本人 email upload_url: "http://127.0.0.1:3000/uploads"改成本地地址 该配置文件内其他未动

  • #5 楼 @camel

    ~/oss/ruby_china$ ruby --version
    ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] ```
    其他输出省略5000字 。。。
    
    
    ```~/oss/ruby_china$ thin start -O -C config/thin.yml
    /usr/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: -O (OptionParser::InvalidOption)
        from /usr/lib/ruby/1.8/optparse.rb:1448:in `catch'
        from /usr/lib/ruby/1.8/optparse.rb:1448:in `complete'
        from /usr/lib/ruby/1.8/optparse.rb:1287:in `parse_in_order'
        from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch'
        from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
        from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!'
        from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'
        from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!'
        from /usr/lib/ruby/1.8/thin/runner.rb:131:in `parse!'
        from /usr/lib/ruby/1.8/thin/runner.rb:47:in `initialize'
        from /usr/bin/thin:6:in `new'
        from /usr/bin/thin:6
    
    ~/oss/ruby_china$ thin --v
    thin 1.2.4 codename Flaming Astroboy
    
    ~/oss/ruby_china$ thin --h
    Usage: thin [options] start|stop|restart|config|install
    Server options:
        -a, --address HOST               bind to HOST address (default: 0.0.0.0)
        -p, --port PORT                  use PORT (default: 3000)
        -S, --socket FILE                bind to unix domain socket
        -y, --swiftiply [KEY]            Run using swiftiply
        -A, --adapter NAME               Rack adapter to use (default: autodetect)
                                         (rails, ramaze, halcyon, merb, mack, mack, file)
        -R, --rackup FILE                Load a Rack config file instead of Rack adapter
        -c, --chdir DIR                  Change to dir before starting
            --stats PATH                 Mount the Stats adapter under PATH
    
    Adapter options:
        -e, --environment ENV            Framework environment (default: development)
            --prefix PATH                Mount the app under PATH (start with /)
    
    Daemon options:
        -d, --daemonize                  Run daemonized in the background
        -l, --log FILE                   File to redirect output (default: log/thin.log)
        -P, --pid FILE                   File to store PID (default: tmp/pids/thin.pid)
        -u, --user NAME                  User to run daemon as (use with -g)
        -g, --group NAME                 Group to run daemon as (use with -u)
            --tag NAME                   Additional text to display in process listing
    
    Cluster options:
        -s, --servers NUM                Number of servers to start
        -o, --only NUM                   Send command to only one server of the cluster
        -C, --config FILE                Load options from config file
            --all [DIR]                  Send command to each config files in DIR
    
    Tuning options:
        -b, --backend CLASS              Backend to use, full classname
        -t, --timeout SEC                Request or command timeout in sec (default: 30)
        -f, --force                      Force the execution of the command
            --max-conns NUM              Maximum number of connections (default: 1024)
                                         Might require sudo to set higher then 1024
            --max-persistent-conns NUM   Maximum number of persistent connections
                                         (default: 512)
            --threaded                   Call the Rack application in threads [experimental]
            --no-epoll                   Disable the use of epoll
    
    Common options:
        -r, --require FILE               require the library
        -D, --debug                      Set debbuging on
        -V, --trace                      Set tracing on (log raw request/response)
        -h, --help                       Show this message
        -v, --version                    Show version
    

    1、这里显示的选项没有“-O”只有 -o,怎么回事? 2、上面“-O”是什么目的?

  • #29 楼 @southwolf 是这样的输出,说明 redis 是安装好了 ~$ redis-server [6880] 08 Jan 19:17:58 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf' [6880] 08 Jan 19:17:58 * Server started, Redis version 2.4.5 [6880] 08 Jan 19:17:58 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. [6880] 08 Jan 19:17:58 * The server is now ready to accept connections on port 6379 [6880] 08 Jan 19:17:59 - 0 clients connected (0 slaves), 547464 bytes in use [6880] 08 Jan 19:18:04 - 0 clients connected (0 slaves), 547464 bytes in use

  • #7 楼 @bindiry 这个 refused 的问题,有解么? `MONGODB ruby_china['system.namespaces'].find({}) MONGODB ruby_china['site_configs'].find({:key=>"index_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"wiki_index_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"footer_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"after_topic_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"before_topic_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"topic_index_sidebar_html"}).limit(-1).sort([[:_id, :asc]]) MONGODB ruby_china['site_configs'].find({:key=>"site_index_html"}).limit(-1).sort([[:_id, :asc]]) rake aborted! Connection refused - Unable to connect to Redis on 127.0.0.1:6379

    Tasks: TOP => environment (See full trace by running task with --trace) rake aborted! Command failed with status (1): [~/.rvm/rubies/ruby-1.9.2-p290/bin/...]

    Tasks: TOP => assets:precompile (See full trace by running task with --trace)`