tonic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-18mode # JRuby in 1.8 mode
7
+ - jruby-19mode # JRuby in 1.9 mode
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ # uncomment this line if your project needs to run something other than `rake`:
11
+ # script: bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in tonic.gemspec
4
+ gemspec
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tonic (0.0.1)
5
+ github
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ addressable (2.2.7)
11
+ github (0.7.2)
12
+ highline (~> 1.6)
13
+ json_pure (~> 1.5.1)
14
+ launchy (~> 2.0.2)
15
+ text-format (= 1.0.0)
16
+ text-hyphen (= 1.0.0)
17
+ highline (1.6.11)
18
+ json_pure (1.5.4)
19
+ spruz (~> 0.2.8)
20
+ launchy (2.0.5)
21
+ addressable (~> 2.2.6)
22
+ rake (0.9.2.2)
23
+ spruz (0.2.13)
24
+ text-format (1.0.0)
25
+ text-hyphen (~> 1.0.0)
26
+ text-hyphen (1.0.0)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ rake
33
+ tonic!
@@ -0,0 +1,54 @@
1
+ # Tonic gem — add some tonus for your github pages
2
+
3
+ ## This gem not ready yet! I'll tell you here with travis-ci, when you can try it.
4
+
5
+ ## I tell you - this is pre-beta. There are no tests!!! Watch it but don't use it yet ;)
6
+
7
+ ### Build Status ![http://travis-ci.org/gazay/gon](https://secure.travis-ci.org/gazay/tonic.png)
8
+
9
+ If you want to edit your github pages for your projects with Haml/Slim/Sass/Coffee - this gem for you
10
+
11
+ ## An example of typical use
12
+
13
+ At first, if you don't want have mess with editing your gh-pages,
14
+ or you already have them and don't want to change something -
15
+ this gem not for you. Tell friends about it and forget about it until you change your mind.
16
+
17
+ You need to create github page for your gem/app/script. You had till today two options:
18
+
19
+ 1. You can push 'Autogenerate github page' button in admin area of your repo
20
+ 2. You can manualy create branch gh-pages, fill it with html content and push to github
21
+
22
+ Both of them very easy and in first option you can choose one of many beautiful themes for your page.
23
+ But if you want to change something in styles or html or js - you should write and edit files as is -
24
+ html in html, css in css, js in js.
25
+
26
+ ## But we both know what we want!
27
+
28
+ We want to use all that sugar around this technologies. We want haml, we want sass and coffee.
29
+ And we don't want to create whole rake app manualy to make dreams true.
30
+
31
+ So I want to present you this gem. You should only install it:
32
+
33
+ ```bash
34
+ $ gem install tonic
35
+ ```
36
+
37
+ And then just two commands:
38
+
39
+ ```bash
40
+ $ cd path/to/your/github/repo
41
+ $ tonic
42
+ ```
43
+
44
+ This command will create for this git repo new branch gh-pages with tonic-template
45
+ and run `bundle install`.
46
+
47
+ Tonic-template contains inside directory assets, gemfile with required gems and rakefile.
48
+
49
+ ## Rakefile contains two tasks: :build and :watch.
50
+
51
+ If you want just build your ready page in haml/sass/coffee from assets directory - run :build.
52
+
53
+ If you in development mode - run :watch and look at your files in public directory,
54
+ how they change when you change templates.
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ desc 'Run all tests by default'
7
+ task :default do
8
+ system("rspec spec")
9
+ end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
4
+ $LOAD_PATH.unshift lib_dir if File.directory?(lib_dir)
5
+
6
+ require 'tonic'
7
+
8
+ if ARGV.empty?
9
+ Tonic.activate
10
+ else ARGV.first == 'push'
11
+ Tonic.push_pages
12
+ end
@@ -0,0 +1,65 @@
1
+ require 'github'
2
+
3
+ module Tonic
4
+ class << self
5
+
6
+ def activate
7
+ raise "I told you - it's not working yet. Bear a little patience"
8
+ if branch_exists?
9
+ raise 'You shall no pass. First you should delete gh-pages branch'
10
+ end
11
+
12
+ create_branch
13
+ remove_all_files
14
+ copy_template
15
+ commit_changes
16
+ end
17
+
18
+ def push_pages
19
+ raise "I told you - it's not working yet. Bear a little patience"
20
+ if in_gh_pages_branch?
21
+ sh 'git push -f origin gh-pages'
22
+ else
23
+ puts 'Forget about it bro'
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def in_gh_pages_branch?
30
+ branches = sh('git branch')
31
+ branches.lines.any? { |it| it =~ /\* gh-pages/ }
32
+ end
33
+
34
+ def branch_exists?
35
+ branches = sh('git branch')
36
+ branches.lines.any? { |it| it =~ /gh-pages/ }
37
+ end
38
+
39
+ # TODO: Later I will think about how to do it through github-gem properly
40
+ def create_branch
41
+ sh 'git branch gh-pages'
42
+ sh 'git checkout gh-pages'
43
+ end
44
+
45
+ def remove_all_files
46
+ sh 'rm -rf ./*'
47
+ end
48
+
49
+ def commit_changes
50
+ sh "git add ."
51
+ sh "git commit -am 'Init github pages'"
52
+ end
53
+
54
+ def copy_template
55
+ path = File.expand_path('../../template', __FILE__)
56
+ puts path
57
+ sh "cp -r #{path}/* ./"
58
+ end
59
+
60
+ def sh(*command)
61
+ Tonic::Shell.run(*command)
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,44 @@
1
+ # Implementation of sh from github-gem
2
+ # https://github.com/defunkt/github-gem
3
+
4
+ module Tonic
5
+ class Shell < String
6
+
7
+ attr_reader :error
8
+ attr_reader :out
9
+
10
+ def self.run(*command)
11
+ self.new(*command).run
12
+ end
13
+
14
+ def initialize(*command)
15
+ @command = command
16
+ end
17
+
18
+ def run
19
+ out = err = nil
20
+ Open3.popen3(*@command) do |_, pout, perr|
21
+ out = pout.read.strip
22
+ err = perr.read.strip
23
+ end
24
+
25
+ replace @error = err unless err.empty?
26
+ replace @out = out unless out.empty?
27
+
28
+ self
29
+ end
30
+
31
+ def command
32
+ @command.join(' ')
33
+ end
34
+
35
+ def error?
36
+ !!@error
37
+ end
38
+
39
+ def out?
40
+ !!@out
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module Tonic
2
+
3
+ VERSION = '0.0.1'
4
+
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'tonic'
2
+
3
+ describe Tonic, '#not_working' do
4
+ it 'really not working yet' do
5
+ Tonic::VERSION.should == '0.0.2'
6
+ end
7
+ end
File without changes
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gem 'fssm'
5
+
6
+ gem 'haml'
7
+ gem 'slim'
8
+ gem 'compass'
9
+ gem 'coffee-script'
10
+ gem 'therubyracer'
11
+ gem 'sprockets'
12
+ gem 'uglifier'
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gon.gemspec
4
+ gemspec
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ desc 'Run all tests by default'
7
+ task :default do
8
+ system("rspec spec")
9
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "tonic/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "tonic"
7
+ s.version = Tonic::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['gazay']
10
+ s.email = ['alex.gaziev@gmail.com']
11
+ s.homepage = "https://github.com/gazay/tonic"
12
+ s.summary = %q{Create github pages easy with Sass, Haml/Slim, Coffee.}
13
+ s.description = %q{You don't need to write your github pages in html and css anymore - now it's simple to use your favorite technologies with tonic!}
14
+
15
+ s.rubyforge_project = "tonic"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib", "bin"]
21
+ s.add_dependency "github"
22
+
23
+ s.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tonic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - gazay
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: github
16
+ requirement: &70289778259320 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70289778259320
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70289778258520 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70289778258520
36
+ description: You don't need to write your github pages in html and css anymore - now
37
+ it's simple to use your favorite technologies with tonic!
38
+ email:
39
+ - alex.gaziev@gmail.com
40
+ executables:
41
+ - tonic
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .travis.yml
46
+ - Gemfile
47
+ - Gemfile.lock
48
+ - README.md
49
+ - Rakefile
50
+ - bin/tonic
51
+ - lib/tonic.rb
52
+ - lib/tonic/shell.rb
53
+ - lib/tonic/version.rb
54
+ - spec/tonic/fail_spec.rb
55
+ - spec/tonic/tonic_spec.rb
56
+ - template/Gemfile
57
+ - template/Gemfile.lock
58
+ - template/Rakefile
59
+ - template/assets/coffee/application.coffee
60
+ - template/assets/sass/application.css.sass
61
+ - template/assets/templates/index.html.haml
62
+ - template/assets/templates/index.html.slim
63
+ - tonic.gemspec
64
+ homepage: https://github.com/gazay/tonic
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ - bin
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project: tonic
85
+ rubygems_version: 1.8.17
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Create github pages easy with Sass, Haml/Slim, Coffee.
89
+ test_files:
90
+ - spec/tonic/fail_spec.rb
91
+ - spec/tonic/tonic_spec.rb