ã¤ãããã®gemã®ã¤ãããã
ãªãããã¸ã§ç°¡åã«ãªã£ããæè¿ã©ã¤ãã©ãªä½ãã¾ãã£ã¦ãã®ã§ãã®å
¨ä½çãªæé ãã¡ã¢ã
Ruby1.9ã®åæã§æ¸ãã¾ããã1.8ã§ãåºæ¥ãããã§ãããRubygemsã®èªè¨¼å¨ãã«ã¤ãã¦ã¯è¨è¼ãã¦ã¾ããããç»é¢ã«è¡¨ç¤ºãããè±æèªãã§ãã楽ã·ã§ã¼ã§åºæ¥ãæãã¾ã
gemã®ã²ãªå½¢ãä½ã
ã¾ããã¼ã«ã«ã«ãªãã¸ããªãä½ãã¾ããããã¯bundle gemã³ãã³ãã使ãã¾ã
$ bundle gem your_project create your_project/Gemfile create your_project/Rakefile create your_project/LICENSE create your_project/README.md create your_project/.gitignore create your_project/your_project.gemspec create your_project/lib/your_project.rb create your_project/lib/your_project/version.rb Initializating git repo in /home/kimoto/projects/your_project
å¿ è¦ãªãã¡ã¤ã«ãçæããã¾ããã
gemã®ã¡ã¿æ å ±ãç·¨éãã
次ã¯your_project.gemspecãç·¨éããgemã®summaryã¨ãdescriptionãã¡ããã¨æ¸ãã¾ãã
ãªãã¦ã¼ã¶ã¼å´ã§require 'your_project'ããã¨ãã¯ã./lib/your_project.rb ãèªã¿è¾¼ã¾ããã®ã§ãããæ³å®ãã¦ãã®ã³ã¼ããæ¸ãæãã§ã
ã³ããããã
å®ã¯your_projectãã£ã¬ã¯ããªã¯gitã®ãªãã¸ããªã«ãªã£ã¦ã¾ãããªã®ã§gitã³ãã³ãã§å¤æ´ãã³ãããããããã¡ã¤ã«ã追å ãããåºæ¥ã¾ãã
å¾è¿°ããgemããã«ãããä»çµã¿ã¯ãã®ã³ãããæ¸ã¿ãªgitã§ç®¡çããããã¡ã¤ã«ãªã¹ãããã¨ã«ããã±ã¼ã¸åãã¦ãããã®ã§ãã¡ããã¨ããã§å¤æ´ãã³ããããã¦ãããªãã¨é§ç®ã§ãã
gemããã«ããã
ã«ã¬ã³ããã£ã¬ã¯ããªã«Rakefileãããã®ã§ããã使ãã¾ãã使ããã³ãã³ããªã¹ãã¯rake -Tã§ãããã¾ãããã£ã¦ã¿ã¾ããã
$ rake -T rake build # Build retry-handler-0.2.gem into the pkg directory rake install # Build and install retry-handler-0.2.gem into system gems rake release # Create tag v0.2 and build and push retry-handler-0.2.gem to...
3ã¤ããã¾ããã
- rake buildãgemã®buildãããpkg/your_project.version.gem ãçæãã¾ã
- rake installãçæããããpkg/your_project.version.gem ããã¼ã«ã«ã«ã¤ã³ã¹ãã¼ã«ãã¾ã
- rake releaseã¯pkg/your_project.version.gemãrubygemsã«pushãã¤ã¤ããã®gitãªãã¸ããªãç¾å¨ã®versionã§ã¿ã°ä»ããã¤ã¤pushãã¦ããã¾ãããããã¤ãã便å©ã(便å©ãã«ã¤ãã¦ã¯å¾è¿°)
ã½ã¼ã¹ã³ã¼ãã®pushå ã追å ãã
ã©ãã§ãããã§ããã¨ããããgithubã«ãã£ã¦æ°è¦ãªãã¸ããªãä½æãã¦ãã¦ãã ããã
ããã§ãã£ã¦ããã®ä½æãããªãã¸ããªã®ã[email protected]:kimoto/your_project.git âãããªæãã®URIã調ã¹ã¦ãã¦ãã ãã
gitã§pushå ã追å ããã«ã¯git remoteã³ãã³ãã使ãã¾ã
$ git remote add origin [email protected]:kimoto/your_project.git
ç°¡åã§ãããã¡ããã¨è¿½å ããã¦ããã©ãã㯠git remote -vã§ç¢ºèªã§ãã¾ã
$ git remote -v origin [email protected]:kimoto/your_project.git (fetch) origin [email protected]:kimoto/your_project.git (push)
gemãpushãã
å®éã«pushãã¾ããgitã®push ã¯git pushã§è¯ãã®ã§ããããããããå é¨çã«è¡ã£ã¦ãããrake releaseã¨ããã®ããã¾ããrake releaseããã¦ããããã¨ã¯
- ãã®ããã¸ã§ã¯ãã®ã½ã¼ã¹ã³ã¼ãããããã¸ã§ã¯ãã®ãã¼ã¸ã§ã³ã§ã¿ã°ä»ã (git tags)
- ãã®ããã¸ã§ã¯ãã®ã½ã¼ã¹ã³ã¼ãã®push
- gemã®pushã§ã
ãããä¸ã¤ã®ã¢ãããã¯ãªæä½ã¨ãã¦è¡ããã®ã便å©ã§ããã½ã¼ã¹ã³ã¼ãã§ã®ã¿ã°ã¨rubygemsä¸ã§ã®gemã®ãã¼ã¸ã§ã³ãç°¡åã«ä¸è´ããããã¨ãã§ãã¾ããã
ããããã ãã¶æ¥½ã§jewelerã使ã£ã¦ããé ãæãããã