fontana_client_support 0.0.1

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
+ MTAxZDE3MzhkM2VjMDQ2YWY1MzdjNzVlNzc5ZjYwNjZhMGUxOGQzNw==
5
+ data.tar.gz: !binary |-
6
+ MzczYTQ4MTlhOWQ1YjA0Mjg2NjlmOTE2MmZmMTdjOWFlMmQxYWRhZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OWY2YzdlZWM0NjQzMTc3OTg0M2RjYjYxMWY1NTcwNjllNjg4YjFhZWJlMzg2
10
+ MzM5YTIwZTIyODYyNzRlNjQ0OTJiNDY1YjE4ODNjOTBjMjVjMDc0OWU4Yjkw
11
+ OTQzZGQyNmY1MDM5OTUwNWU5Zjc0ZGUxZDZiYTZkNTEwNmNkOTc=
12
+ data.tar.gz: !binary |-
13
+ MjlmMTcyNGQxZTVkOTM1NzZhZWM1NDU3MDIzMzdiNGI2Y2ZlNGI1Mjg4YzU4
14
+ NTJkMGQyOGI2NzdjZjc4MGUyM2JkY2JhNTMyNjNjNDVjOTQxY2U5MTdiYmQw
15
+ NDI1YzRjNTg4NmU0NTJiYjNkZmFjNmU0NTA1ZTdhY2NhNjU4NTQ=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fontana_client_support.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 akima
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,29 @@
1
+ # FontanaClientSupport
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fontana_client_support'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fontana_client_support
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fontana_client_support/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fontana_client_support"
8
+ spec.version = FontanaClientSupport::VERSION
9
+ spec.authors = ["akima"]
10
+ spec.email = ["t-akima@groovenauts.jp"]
11
+ spec.description = %q{gem to support development and testing with GSS/fontana}
12
+ spec.summary = %q{gem to support development and testing with GSS/fontana}
13
+ spec.homepage = ""
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,21 @@
1
+ module Fontana
2
+ module CommandUtils
3
+
4
+ module_function
5
+
6
+ def system!(cmd)
7
+ puts "now executing: #{cmd}"
8
+
9
+ IO.popen("#{cmd} 2>&1") do |io|
10
+ while line = io.gets
11
+ puts line
12
+ end
13
+ end
14
+
15
+ if $?.exitstatus != 0
16
+ exit(1)
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,46 @@
1
+ module Fontana
2
+ module ServerRake
3
+
4
+ include Fontana::CommandUtils
5
+
6
+ module_function
7
+
8
+ def task_options
9
+ @task_options ||= {}
10
+ end
11
+
12
+ def call_fontana_task(name)
13
+ options = task_options[name]
14
+ options[:before].call if options[:before]
15
+
16
+ cmd = "BUNDLE_GEMFILE=#{Fontana.gemfile} bundle exec rake #{name}"
17
+ if Rake.application.options.trace
18
+ cmd << " --trace -v"
19
+ end
20
+ Dir.chdir(Fontana.home) do
21
+ system!(cmd)
22
+ end
23
+
24
+ options[:after].call if options[:after]
25
+ end
26
+
27
+ def fontana_task(name, options = {})
28
+ full_name = (@namespaces + [name]).join(':')
29
+ task_options[full_name] = options
30
+ task name do
31
+ call_fontana_task(full_name)
32
+ end
33
+ end
34
+
35
+ def namespace_with_fontana(name, target = nil, &block)
36
+ @namespaces ||= []
37
+ @namespaces.push(target || name)
38
+ begin
39
+ namespace(name, &block)
40
+ ensure
41
+ @namespaces.pop
42
+ end
43
+ end
44
+
45
+ end
46
+ end
data/lib/fontana.rb ADDED
@@ -0,0 +1,22 @@
1
+
2
+ module Fontana
3
+ autoload :CommandUtils, 'fontana/command_utils'
4
+ autoload :ServerRake , 'fontana/server_rake'
5
+
6
+ class << self
7
+ # attr_accessor :home
8
+ attr_accessor :gemfile
9
+
10
+ attr_accessor :repo_url
11
+ attr_accessor :branch
12
+
13
+ def home
14
+ @home ||= ENV['FONTANA_HOME'] || (Dir.exist?(FontanaClientSupport.vendor_fontana) or Fontana.repo_url) ? FontanaClientSupport.vendor_fontana : nil
15
+ end
16
+
17
+ def home=(value)
18
+ @home = value
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+
4
+ namespace_with_fontana :deploy, :"app:deploy" do
5
+
6
+ set_url_and_branch = ->{
7
+ ENV['URL'] ||= `git remote -v`.scan(/origin\s+(.+?)\s/).flatten.uniq.first
8
+ ENV['BRANCH'] ||= `git status`.scan(/^.+\sbranch\s(.+)\s*$/).flatten.first
9
+ }
10
+
11
+ desc "deploy:setup deploy:update"
12
+ fontana_task :reset, before: set_url_and_branch
13
+
14
+ desc "drop DB, initialize, clear workspaces, clone, checkout branch. $URL required."
15
+ fontana_task :setup, before: set_url_and_branch
16
+
17
+ desc "fetch, checkout, build app_seed and migrate."
18
+ fontana_task :update
19
+ end
@@ -0,0 +1,27 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+
4
+ namespace_with_fontana :fixtures, :"app:fixtures" do
5
+
6
+ desc "load collection fixture"
7
+ fontana_task :load, before: ->{
8
+ raise "$FIXTURE is required" unless ENV['FIXTURE']
9
+ ENV['FIXTURE'] = File.expand_path(ENV['FIXTURE'], '.')
10
+ }
11
+
12
+ desc "dump collection fixture to path"
13
+ fontana_task :dump, before: ->{
14
+ raise "$COLLECTION is required" unless ENV['COLLECTION'] || ENV['COL']
15
+ raise "$FIXTURES_DIR is required" unless ENV['FIXTURES_DIR']
16
+ ENV['FIXTURES_DIR'] = File.expand_path(ENV['FIXTURES_DIR'], '.')
17
+ }
18
+
19
+ namespace_with_fontana :dump do
20
+ desc "dump all collections"
21
+ fontana_task :all, before: ->{
22
+ raise "$FIXTURES_DIR is required" unless ENV['FIXTURES_DIR']
23
+ ENV['FIXTURES_DIR'] = File.expand_path(ENV['FIXTURES_DIR'], '.')
24
+ }
25
+ end
26
+
27
+ end
@@ -0,0 +1,28 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+
4
+ namespace_with_fontana :server, :libgss_test do
5
+ desc "luanch HTTP server"
6
+ fontana_task :launch_http_server
7
+
8
+ desc "luanch HTTP server daemon"
9
+ fontana_task :launch_http_server_daemon
10
+
11
+ desc "luanch HTTPS server"
12
+ fontana_task :launch_https_server
13
+
14
+ desc "luanch HTTPS server daemon"
15
+ fontana_task :launch_https_server_daemon
16
+
17
+ desc "luanch server"
18
+ fontana_task :launch_server
19
+
20
+ desc "luanch server daemons"
21
+ fontana_task :launch_server_daemons
22
+
23
+ desc "shutdown server daemons"
24
+ fontana_task :shutdown_server_daemons
25
+
26
+ desc "check daemon alive"
27
+ fontana_task :check_daemon_alive
28
+ end
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'fontana_client_support'
3
+ include Fontana::ServerRake
4
+
5
+ desc "run spec with server_daemons"
6
+ task :spec_with_server_daemons => [:"vendor:fontana:prepare"] do
7
+ Rake::Task["server:launch_server_daemons"].execute
8
+ begin
9
+ sleep( (ENV["FONTANA_LAUNCH_SLEEP"] || 5).to_i ) # 実際にポートをLINSTENするまで待つ
10
+ Rake::Task["spec"].execute
11
+ ensure
12
+ Rake::Task["server:shutdown_server_daemons"].execute
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+
4
+ namespace_with_fontana :sync, :"runtime:update" do
5
+ desc "sync app/scripts directly"
6
+ fontana_task :app_scripts, before: ->{ ENV["APP_SCRIPTS_PATH"] = File.expand_path("../app/scripts", __FILE__) }
7
+
8
+ desc "sync spec/fixtures directly"
9
+ fontana_task :spec_fixtures, before: ->{ ENV["SPEC_FIXTURES_PATH"] = File.expand_path("../spec/fixtures", __FILE__) }
10
+
11
+ desc "sync app/scripts and spec/fixtures directly"
12
+ fontana_task :client, before: ->{
13
+ ENV["APP_SCRIPTS_PATH"] = File.expand_path("../app/scripts", __FILE__)
14
+ ENV["SPEC_FIXTURES_PATH"] = File.expand_path("../spec/fixtures", __FILE__)
15
+ }
16
+ end
@@ -0,0 +1,51 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+
4
+ namespace :vendor do
5
+ namespace :fontana do
6
+
7
+ desc "clear"
8
+ task :clear do
9
+ FileUtils.rm_rf(FontanaClientSupport.vendor_fontana)
10
+ end
11
+
12
+ desc "clone"
13
+ task :clone => :"vendor:fontana:clear" do
14
+ raise "$FONTANA_REPO_URL is required" unless Fontana.repo_url
15
+ FileUtils.mkdir_p(FontanaClientSupport.vendor_dir)
16
+ Dir.chdir(FontanaClientSupport.vendor_dir) do
17
+ system!("git clone #{Fontana.repo_url}")
18
+ end
19
+ Dir.chdir(FontanaClientSupport.vendor_fontana) do
20
+ system!("git checkout #{Fontana.branch}")
21
+ FileUtils.cp(File.join(FontanaClientSupport.root_dir, "spec/server_config/mongoid.yml"), "config/mongoid.yml")
22
+ FileUtils.cp("config/project.yml.erb.example", "config/project.yml.erb")
23
+ system!("BUNDLE_GEMFILE=#{Fontana.gemfile} bundle install")
24
+ end
25
+ Rake::Task["deploy:reset"].execute
26
+ end
27
+
28
+ desc "update"
29
+ task :update do
30
+ Dir.chdir(FontanaClientSupport.vendor_fontana) do
31
+ system!("git fetch origin")
32
+ system!("git checkout origin/#{Fontana.branch}")
33
+ system!("BUNDLE_GEMFILE=#{Fontana.gemfile} bundle install")
34
+ system!("BUNDLE_GEMFILE=#{Fontana.gemfile} bundle exec rake db:drop")
35
+ end
36
+ Rake::Task["deploy:update"].execute
37
+ end
38
+
39
+ desc "prepare"
40
+ task :prepare do
41
+ if Dir.exist?(FontanaClientSupport.vendor_fontana)
42
+ Rake::Task["vendor:fontana:update"].execute
43
+ else
44
+ Rake::Task["vendor:fontana:clone"].execute
45
+ end
46
+ end
47
+ end
48
+
49
+ desc "prepare vendor/fontana "
50
+ task :fontana => :"vendor:fontana:prepare"
51
+ end
@@ -0,0 +1,3 @@
1
+ require 'fontana_client_support'
2
+
3
+ Dir[File.expand_path("../tasks/**/*.rake", __FILE__)].each{|f| load(f)}
@@ -0,0 +1,3 @@
1
+ module FontanaClientSupport
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ require "fontana_client_support/version"
2
+
3
+ module FontanaClientSupport
4
+
5
+ class << self
6
+ attr_accessor :root_dir
7
+
8
+ def vendor_dir
9
+ @vendor_dir ||= File.join(root_dir, "vendor")
10
+ end
11
+
12
+ def vendor_fontana
13
+ @vendor_fontana ||= File.join(vendor_dir, "fontana")
14
+ end
15
+ end
16
+ end
17
+
18
+ require 'fontana'
19
+
20
+ Fontana.repo_url = ENV['FONTANA_REPO_URL']
21
+ Fontana.branch = ENV['FONTANA_BRANCH' ] || 'master'
22
+ Fontana.gemfile = ENV['FONTANA_GEMFILE' ] || "Gemfile-LibgssTest"
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fontana_client_support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - akima
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: gem to support development and testing with GSS/fontana
42
+ email:
43
+ - t-akima@groovenauts.jp
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - fontana_client_support.gemspec
54
+ - lib/fontana.rb
55
+ - lib/fontana/command_utils.rb
56
+ - lib/fontana/server_rake.rb
57
+ - lib/fontana_client_support.rb
58
+ - lib/fontana_client_support/tasks.rb
59
+ - lib/fontana_client_support/tasks/deploy.rake
60
+ - lib/fontana_client_support/tasks/fixtures.rake
61
+ - lib/fontana_client_support/tasks/server.rake
62
+ - lib/fontana_client_support/tasks/spec.rake
63
+ - lib/fontana_client_support/tasks/sync.rake
64
+ - lib/fontana_client_support/tasks/vendor_fontana.rake
65
+ - lib/fontana_client_support/version.rb
66
+ homepage: ''
67
+ licenses:
68
+ - MIT
69
+ metadata: {}
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 2.0.3
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: gem to support development and testing with GSS/fontana
90
+ test_files: []
91
+ has_rdoc: