hoppinger 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 51ce24a22c46ac87ab35795fb8de6d235be33c51
4
+ data.tar.gz: e05a463f34a09163b8fad8484798b3ad91a1bf88
5
+ SHA512:
6
+ metadata.gz: c33dace559192c0d5af0d28a5dcb474f2a7792609c2bda3a9936a287c9a453b6f751dbb9ff7815ce977c4fd6e0178914452c9edcb1fb01cf19c9217da2832df0
7
+ data.tar.gz: 9ae07631fb356155f14b22231ff6057751208e3de1179fd2b326170cc6b40af335b8dfd520c702d44ca7980de78e10df5f49758bf18847590119aff9f883757c
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hoppinger.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dunya Kirkali
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Hoppinger
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'hoppinger'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install hoppinger
18
+
19
+ ## Usage
20
+
21
+ First you have to set :stage in your cap stages:
22
+
23
+ set :stage, 'production'
24
+
25
+ Then you can run the following command in order to generate hoppinger's cap tasks
26
+
27
+ hoppinger cap
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it ( https://github.com/[my-github-username]/hoppinger/fork )
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/hoppinger ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hoppinger/cli'
3
+ Hoppinger::CLI.start
data/hoppinger.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hoppinger/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hoppinger"
8
+ spec.version = Hoppinger::VERSION
9
+ spec.authors = ["Dunya Kirkali"]
10
+ spec.email = ["dunyakirkali@gmail.com"]
11
+ spec.summary = %q{Cap tasks for Hoppinger servers}
12
+ spec.description = %q{Cap tasks for Hoppinger servers}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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_dependency 'thor', '~> 0.19.1'
22
+ spec.add_dependency 'aruba'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.6'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '~> 3.1.0'
27
+ spec.add_development_dependency 'simplecov', '~> 0.9.1'
28
+ spec.add_development_dependency 'factory_girl', '~> 4.5.0'
29
+ spec.add_development_dependency 'rubycritic'
30
+ spec.add_development_dependency 'generator_spec'
31
+ end
@@ -0,0 +1,11 @@
1
+ require 'thor/group'
2
+
3
+ class CapGenerator < Thor::Group
4
+ include Thor::Actions
5
+
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ def start
9
+ copy_file "cap.rb.erb", "config/recipes/hoppinger.rb"
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ namespace :db do
2
+ desc 'Backups the db to ~'
3
+ task :backup do
4
+ on roles(:app) do
5
+ deployer_home = "/home/#{fetch(:user)}"
6
+ db_username, db_password, db_name, host = remote_database_config(fetch(:stage))
7
+ backup_name = "#{Time.now.localtime.strftime("%d-%m-%Y")}-#{db_name}-#{fetch(:stage)}.sql"
8
+ execute :mysqldump, "-u #{db_username} -p'#{db_password}' #{db_name} > ~/#{backup_name}"
9
+ download! "/home/deployer/#{backup_name}", "#{backup_name}"
10
+ execute :rm, "#{deployer_home}/#{backup_name}"
11
+ end
12
+ end
13
+ end
14
+
15
+ def remote_database_config(db)
16
+ remote_config = capture("cat #{shared_path}/config/database.yml")
17
+ database = YAML::load(remote_config)
18
+ return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
19
+ end
data/lib/hoppinger.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'hoppinger/version'
2
+ require 'generators/hoppinger/cap_generator'
3
+
4
+ module Hoppinger
5
+ # Your code goes here...
6
+ end
7
+
@@ -0,0 +1,11 @@
1
+ require 'thor'
2
+ require 'hoppinger'
3
+
4
+ module Hoppinger
5
+ class CLI < Thor
6
+ desc "cap", "Generates cap tasks for Hoppinger servers"
7
+ def cap
8
+ CapGenerator.start
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ module Hoppinger
2
+ VERSION = "1.0.1"
3
+ end
4
+
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe CapGenerator, type: :generator do
4
+ destination File.expand_path("../../tmp", __FILE__)
5
+ let!(:file) { File.join(destination_root, 'config', 'recipes', 'hoppinger.rb') }
6
+
7
+ before do
8
+ prepare_destination
9
+ run_generator
10
+ end
11
+
12
+ it 'shuould generate a file called hoppinger.rb' do
13
+ expect(File.exist?(file)).to be(true)
14
+ end
15
+
16
+ it 'hoppinger.rb should containt TODO' do
17
+ expect(File.read(file).gsub(/^\s+/, '')).to eq <<-EOT.gsub(/^\s+/, '')
18
+ namespace :db do
19
+ desc 'Backups the db to ~'
20
+ task :backup do
21
+ on roles(:app) do
22
+ deployer_home = "/home/\#{fetch(:user)}"
23
+ db_username, db_password, db_name, host = remote_database_config(fetch(:stage))
24
+ backup_name = "\#{Time.now.localtime.strftime("%d-%m-%Y")}-\#{db_name}-\#{fetch(:stage)}.sql"
25
+ execute :mysqldump, "-u \#{db_username} -p'\#{db_password}' \#{db_name} > ~/\#{backup_name}"
26
+ download! "/home/deployer/\#{backup_name}", "\#{backup_name}"
27
+ execute :rm, "\#{deployer_home}/\#{backup_name}"
28
+ end
29
+ end
30
+ end
31
+
32
+ def remote_database_config(db)
33
+ remote_config = capture("cat \#{shared_path}/config/database.yml")
34
+ database = YAML::load(remote_config)
35
+ return database["\#{db}"]['username'], database["\#{db}"]['password'], database["\#{db}"]['database'], database["\#{db}"]['host']
36
+ end
37
+ EOT
38
+ end
39
+ end
@@ -0,0 +1,22 @@
1
+ require 'aruba'
2
+ require 'aruba/api'
3
+ require 'generator_spec'
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ end
8
+
9
+ require 'hoppinger'
10
+
11
+ RSpec.configure do |config|
12
+
13
+ config.include Aruba::Api
14
+
15
+ config.expect_with :rspec do |expectations|
16
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
17
+ end
18
+
19
+ config.mock_with :rspec do |mocks|
20
+ mocks.verify_partial_doubles = true
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hoppinger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dunya Kirkali
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: aruba
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
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
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.1.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_girl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 4.5.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 4.5.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubycritic
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: generator_spec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Cap tasks for Hoppinger servers
140
+ email:
141
+ - dunyakirkali@gmail.com
142
+ executables:
143
+ - hoppinger
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - Gemfile
150
+ - LICENSE.txt
151
+ - README.md
152
+ - Rakefile
153
+ - bin/hoppinger
154
+ - hoppinger.gemspec
155
+ - lib/generators/hoppinger/cap_generator.rb
156
+ - lib/generators/hoppinger/templates/cap.rb.erb
157
+ - lib/hoppinger.rb
158
+ - lib/hoppinger/cli.rb
159
+ - lib/hoppinger/version.rb
160
+ - spec/lib/generators/cap_generator_spec.rb
161
+ - spec/spec_helper.rb
162
+ homepage: ''
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.2.2
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Cap tasks for Hoppinger servers
186
+ test_files:
187
+ - spec/lib/generators/cap_generator_spec.rb
188
+ - spec/spec_helper.rb