1.环境及配置
在开发环境安装完成后,就配置了git。其实在刚创建应用程序的时候应该使用git了。
git前期要做的配置,基本上就是之前我们设置的姓名和邮箱地址。另外在根目录下还会有一个.gitconfig文件,大概为:
[user] name = .... email = ....
不过我是没有找到 - -!。可以用git repo-config --get-regexp user.*验证配置的信息
Rails提供了一个名为.gitignore的文件,配置git哪些文件不需要加入版本控制,/.gitignore:
# See http://help.github.com/ignore-files/ for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile ~/.gitignore_global # Ignore bundler config /.bundle # Ignore the default SQLite database. /db/*.sqlite3 # Ignore all logfiles and tempfiles. /log/*.log /tmp
2.使用
首先需要初始化一个储存库,然后添加所有文件,然后再提交,提交的时候可以也应该把相应文件的说明信息作为参数下起提交;
E:\works\ruby\depot>git status fatal: Not a git repository (or any of the parent directories): .git E:\works\ruby\depot>git repo-config --get-regexp user.* WARNING: git repo-config is deprecated in favor of git config. user.name Jarry Li user.email jarry-li@163.com E:\works\ruby\depot>git init Initialized empty Git repository in E:/works/ruby/depot/.git/ E:\works\ruby\depot>git add . E:\works\ruby\depot>git commit -m "Depot Scaffold" [master (root-commit) 79de108] Depot Scaffold 59 files changed, 1855 insertions(+), 0 deletions(-) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/cs.jpg create mode 100644 app/assets/images/logo.png create mode 100644 app/assets/images/rails.png create mode 100644 app/assets/images/rtp.jpg create mode 100644 app/assets/images/ruby.jpg create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/products.js.coffee create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/depot.css create mode 100644 app/assets/stylesheets/products.css.scss create mode 100644 app/assets/stylesheets/scaffolds.css.scss create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/products_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/products_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/models/product.rb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/products/_form.html.erb create mode 100644 app/views/products/edit.html.erb create mode 100644 app/views/products/index.html.erb create mode 100644 app/views/products/new.html.erb create mode 100644 app/views/products/show.html.erb create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 db/migrate/20130314064527_create_products.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 doc/README_FOR_APP create mode 100644 lib/assets/.gitkeep create mode 100644 lib/tasks/.gitkeep create mode 100644 log/.gitkeep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/robots.txt create mode 100644 script/rails create mode 100644 test/fixtures/.gitkeep create mode 100644 test/fixtures/products.yml create mode 100644 test/functional/.gitkeep create mode 100644 test/functional/products_controller_test.rb create mode 100644 test/integration/.gitkeep create mode 100644 test/performance/browsing_test.rb create mode 100644 test/test_helper.rb create mode 100644 test/unit/.gitkeep create mode 100644 test/unit/helpers/products_helper_test.rb create mode 100644 test/unit/product_test.rb create mode 100644 vendor/assets/javascripts/.gitkeep create mode 100644 vendor/assets/stylesheets/.gitkeep create mode 100644 vendor/plugins/.gitkeep
如果要回到原来的状态用命令:git checkout
在有更新之后,要提交之前,可以先通过git status来查看修改了哪些文件:
E:\works\ruby\depot>git status # On branch master nothing to commit (working directory clean)
到现在为止我已经把验证和单元测试都做完了才用git,所以没有修改集体地方;如果在创建完脚手架之后就提交应用程序,到现在执行git status的话我们就应该可以看到:
# On branch master # Change but not updated: # (use "git add <file>..." to update what will be committed) # # modified: app/models/product.rb # modified: test/fixtures/products.yml # modified: test/functional/products_controller_test.rb # modified: test/unit/product_test.rb ... # no changes added to commit (use "git add" add/or "git commit -a")
如果只修改了一些现有的文件并没有增加任何新的文件,可以结合git add和git commit命令,然后只要运行带-a参数的git commit命令如你现在有更新的话,可以:
git commit -a -m 'Validation!'
------update - 201307-12-------
git将本地仓库上传到远程仓库
在已有的git库中搭建新库,并且将本地的git仓库,上传到远程服务器的git库中,从而开始一个新的项目
首先,在本地新建文件夹abc(使用git用户),进入到abc里面,然后git init。这样就在本地初始化了一个git项目abc。
然后,登录到远程的git服务器上,到gitrepo目录下面,mkdir abc.git。然后进入abc.git目录。git --bare init。这样就在服务器端建立了一个空的git项目。
之后,在本地,进入到abc目录里面,增加远程仓库。git remote -v 显示项目目前的远程仓库,因为是新建项目,所以结果为空。git remote add origin git://127.0.0.1/abc.git这样就增加了远程仓库abc。
最后,commit提交本地代码,git push origin master这样就把本地的git库上传到了远程git服务器的git库中了
参见:
http://blog.chinaunix.net/uid-17260303-id-3000999.html
http://progit.org/book/zh/ch2-5.html
http://progit.org/book/zh/ch4-4.html
相关推荐
也曾使用 Ruby on Rails 开发过一个名为 Insoshi 的社交网络平台,这个平台曾经很流行,现在已经过气了。因为他对 Ruby 社区的贡献,于 2011 年被授予了 Ruby Hero 奖。他毕业于哈佛学院,并获得了加州理工学院的...
rails-样板用于快速创建 Rails 应用程序的 Ruby on Rails (RoR) 样板。安装步骤第 1 步 - 安装 Core Essentials sudo apt-get -y updatesudo apt-get -y upgradesudo apt-get -y install build-essential git第 2 步...
这个应用程序是一个示例,说明了如何使用带有Conekta API 1.0.0的Ruby on Rails创建SPEI付款并配置端点以接收Webhook通知。 要运行,您需要: git clone git@github....
Ruby on Rails 教程:示例应用程序 这是的示例应用程序。 如果您最终在本教程中遇到代码问题,您可以使用此参考实现来帮助跟踪错误。 特别是,作为第一次调试检查,我建议让测试套件在您的本地机器上传递: cd /...
Ruby on Rails教程:示例应用程序 该存储库不是最新的也不是维护的。 有关示例应用程序的当前版本,请参见 。 这是的示例应用程序 。 如果您最终在教程中遇到代码问题,则可以使用此参考实现来帮助跟踪错误。 特别...
该应用程序是用Ruby on Rails编写的,并已部署在Heroku上。 设置 您将需要一个Ruby环境来运行Rails。 首先要做的是: $ rvm use . $ bundle install 然后,您需要创建数据库结构: $ rake db:migrate 或者,您...
第一次,或者在git pull ,别忘了做: $ bundle install 赛车消费者 要回应特定主题: $ KAFKA_TOPIC=your-topic-name-goes-here bundle exec racecar EchoConsumer 要回显默认的some-topic主题,请执行以下操作:...
uclalib_role_blacklight_capdeploy Ansible角色,使用Capistrano执行初始代码部署到UCLA Library Blacklight系统要求该角色负责将Blacklight项目代码从git存储库到Rails应用程序服务器的第一次部署。 请注意以下...
每个情节都有一个git标签,以引用最终的代码结果,以便您可以签出并使用代码。 设置应用 克隆此存储库 签出此分支: git checkout sitepoint 安装Neo4j: rake neo4j:install[community-latest] 开始Neo4j: rake...
Panóplia平台使用Ruby on Rails 该自述文件通常会记录启动和运行应用程序所需的所有步骤。 部署说明确保在您的系统上安装了Ruby。 发射命令提示符并运行命令: # Make sure Rails is installedruby -v# If you see ...
Ruby on Rails教程 “你好,世界!” 这是的的第一个应用程序。 你好,世界!
该应用程序非常适合查看以下所有概念如何在单个 Web 应用程序中结合在一起: MVC软件架构Ruby on Rails 开发与 Foundation 5 前端框架集成与第三方 API 的集成(mailchimp、google drive、segmente.io、google ...
在您的终端中: git clone "paste-github-repo-code"转到包含所有存储库文件夹的第一级目录,然后运行以下命令: bundle install #this will install any necessary gems捆绑软件安装完成后,您将要启动Rails服务器...
Europeana 1914-1918使用基于runcoco的ruby on rails应用程序,该应用程序最初由richard doe( 最初由cococo开发,用于牛津大学的巨大战争资料库( 。牛津大学)。 。 在2012年1月,europarina开始对该应用程序...
该实现是通过Ruby on Rails第6版( )进行的 要求 Ruby版本> = 2.5.0 捆 纱 版本> = 3的sqlite 安装 只有QEDDB的源代码文件在GIT存储库中。 相关的依赖关系未包含在GIT存储库中。 这些可以在克隆后使用 bundle ...
Ruby on Rails 教程:示例应用程序 这是的示例应用程序。 如果您最终在本教程中遇到代码问题,您可以使用此参考实现来帮助跟踪错误。 特别是,作为第一次调试检查,我建议让测试套件在您的本地机器上传递: cd /...
Git被越来越多的知名公司和开源项目所使用:Ruby On Rails,jQuery,Perl,Debian,Linux内核,还有很多。大型的社区通常自身就是一个优点,因为一个生态圈会围绕着该系统演进。大量的学习指南,工具,还有服务,会...
使用RSpec的样例应用程序进行日常Rails测试(2017版) 请参阅博客,以获取有关此版图书的新闻。 您可以在GitHub的找到早期版本的示例源。 谢谢! 进行示例Rails 5.1应用程序: Aaron Sumner进行测试驱动开发的实用...
我们认为,很高兴与Netguru一起开始学习Ruby on Rails 。 参加研讨会也是与我们开始实习并成为Netguru成员之一的绝佳机会。 由于您刚刚开始使用RoR进行编程,因此我们向您挑战以完成以下任务。 准备好了,稳定……...
Ruby on Rails教程:示例应用程序 这是的示例应用程序 。 如果您最终在教程中遇到代码问题,则可以使用此参考实现来帮助跟踪错误。 特别是,作为第一次调试检查,我建议让测试套件通过您的本地计算机: cd /tmp ...