middlesite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2Y2NTExYWNhYmY4MjdlMzFlZDNiODYwNzBmYjBhYTViMDdlNTdjZg==
5
+ data.tar.gz: !binary |-
6
+ ZDc1ZDU3ZjQxZWFjZmZhNjM3ZjY0MTcwNDgyMTVhMGJjNDE5NWQyOA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NzgwMTlmZDRhMWY5MjI1NjE1OWU0NmQyYTczNjFmNTliNzk4NjU4Zjk0NTcw
10
+ NmE0MzYxZWFkMGI1N2Q0OTdjMDM3Y2E0YWNlY2FhMmYxMWY0ZjIzNTdhOWYw
11
+ OGE5ODNiY2E4MTU2Y2E4ZTZmNTg0OGYxOGJjYTFmYjg0NmIwNzk=
12
+ data.tar.gz: !binary |-
13
+ NWY2YjY1NzFhZDZhZjRiYjI1OTU3ODIwYmM3ZjhkMjJhMDU0YzVmN2VjOTNh
14
+ MzUyMzYxNjYxNzM1NDhkMTY0NjlhZmIwMzRkOTI5NTc4MWViNzgyNWZiNjUz
15
+ YTZiODJmODNhOTRlN2Y1MTFhYTE3NmM2ZjhlYmJjMDYyNmY4MmY=
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ .*
2
+ *~
3
+ *.gem
4
+ Gemfile.lock
5
+ InstalledFiles
6
+ _yardoc
7
+ coverage
8
+ doc/
9
+ lib/bundler/man
10
+ pkg
11
+ rdoc
12
+ spec/reports
13
+ test/tmp
14
+ test/version_tmp
15
+ tmp
16
+ !.git*
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ ruby "1.9.3"
2
+ source "https://rubygems.org"
3
+
4
+ # Specify your gem's dependencies in middlesite.gemspec
5
+ gemspec
data/LICENSE-MIT ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 franklin
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # middlesite
2
+
3
+ > Gem containing tasks to build, release and deploy your Middleman site.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ $ gem install middlesite
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ The following tasks are available trough the command line.
14
+
15
+ ```
16
+ Commands:
17
+ ```
18
+
19
+ ## Development
20
+
21
+ When developing you can use the given `rake` tasks:
22
+
23
+ ```
24
+ $ rake -T
25
+ rake build # Build middlesite-0.1.1.gem into the pkg directory.
26
+ rake install # Build and install middlesite-0.1.1.gem into system gems.
27
+ rake release # Create tag v0.1.1 and build and push middlesite-0.1.1.gem to Rubygems```
28
+ ```
29
+
30
+ ## Contributing
31
+ In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
38
+
39
+ ## License
40
+ Copyright (c) 2013 franklin under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/middlesite ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'middlesite'
5
+ Middlesite::Cli.start
@@ -0,0 +1,112 @@
1
+ require "git"
2
+ require "thor"
3
+ require "yaml"
4
+
5
+ module Middlesite
6
+ class Cli < Thor
7
+
8
+ desc "init", "Initialize the workspace."
9
+ def init
10
+ puts "Installing gems..."
11
+ system "bundle install"
12
+ puts ""
13
+ puts "Installing bower packages..."
14
+ system "bower install"
15
+ end
16
+
17
+ desc "build", "Generate build from sources"
18
+ method_option :verbose, :aliases => "-v", :type => :boolean, :default => false
19
+ def build
20
+ if options[:verbose]
21
+ system "bundle exec middleman build --verbose"
22
+ else
23
+ system "bundle exec middleman build"
24
+ end
25
+ end
26
+
27
+ desc "server", "Build and start server"
28
+ def server
29
+ system "bundle exec middleman server"
30
+ end
31
+
32
+ desc "deploy", "Build and deploy to server"
33
+ def deploy
34
+ system "bundle exec middleman deploy"
35
+ end
36
+
37
+ desc "bump [TYPE]", "Bump version (patch|minor|major), commit, tag, and push."
38
+ def bump(type="patch")
39
+ # Get latest git tag
40
+ raise Thor::Error, "Not a git repository!" unless Dir.exists?(".git")
41
+ g = ::Git.open(".")
42
+ raise Thor::Error, "Uncommitted git changes!" unless g.status.changed.empty?
43
+ tags = g.tags
44
+ raise Thor::Error, "No tag found!" if tags.empty?
45
+ tag = tags.pop().name
46
+
47
+ # Bump version
48
+ case type
49
+ when "major"
50
+ version = bump_major(tag)
51
+ when "minor"
52
+ version = bump_minor(tag)
53
+ when "patch"
54
+ version = bump_patch(tag)
55
+ end
56
+ puts "Bumping version to: #{version}"
57
+
58
+ # update config
59
+ puts "Updating site config..."
60
+ config = get_config()
61
+ config["version"] = version
62
+ set_config(config)
63
+
64
+ # commit & add tag
65
+ g.commit_all("release v#{version}")
66
+ puts "Adding tag..."
67
+ g.add_tag("v#{version}")
68
+ g.repack
69
+
70
+ # push
71
+ puts "Pushing files..."
72
+ g.push("origin", "master", true)
73
+ end
74
+
75
+ no_tasks do
76
+ def get_config
77
+ YAML::load(File.open("./data/site.yml"))
78
+ end
79
+
80
+ def set_config (config)
81
+ File.open("./data/site.yml", "w") do |f|
82
+ f.write(config.to_yaml)
83
+ end
84
+ end
85
+
86
+ def bump_patch(version)
87
+ version = version.split(".")
88
+ version[0] = version[0].to_i
89
+ version[1] = version[1].to_i
90
+ version[2] = version[2].to_i + 1
91
+ version.join(".")
92
+ end
93
+
94
+ def bump_minor(version)
95
+ version = version.split(".")
96
+ version[0] = version[0].to_i
97
+ version[1] = version[1].to_i + 1
98
+ version[2] = 0
99
+ version.join(".")
100
+ end
101
+
102
+ def bump_major(version)
103
+ version = version.split(".")
104
+ version[0] = version[0].to_i + 1
105
+ version[1] = 0
106
+ version[2] = 0
107
+ version.join(".")
108
+ end
109
+ end
110
+
111
+ end
112
+ end
@@ -0,0 +1,3 @@
1
+ module Middlesite
2
+ VERSION = "0.1.0"
3
+ end
data/lib/middlesite.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "middlesite/cli"
2
+ require "middlesite/version"
3
+
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middlesite/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "middlesite"
8
+ spec.version = Middlesite::VERSION
9
+ spec.authors = ["franklin"]
10
+ spec.email = ["franklin@weareinteractive.com"]
11
+ spec.description = %q{Gem containing tasks to build, release and deploy your Middleman site.}
12
+ spec.summary = %q{Tasks to manage Middleman sites.}
13
+ spec.homepage = "https://github.com/weareinteractive/gem-middlesite"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "git"
22
+ spec.add_runtime_dependency "thor"
23
+
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "bundler"
26
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middlesite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - franklin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Gem containing tasks to build, release and deploy your Middleman site.
70
+ email:
71
+ - franklin@weareinteractive.com
72
+ executables:
73
+ - middlesite
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE-MIT
80
+ - README.md
81
+ - Rakefile
82
+ - bin/middlesite
83
+ - lib/middlesite.rb
84
+ - lib/middlesite/cli.rb
85
+ - lib/middlesite/version.rb
86
+ - middlesite.gemspec
87
+ homepage: https://github.com/weareinteractive/gem-middlesite
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.1.11
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Tasks to manage Middleman sites.
111
+ test_files: []