ncss-cookbooks 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ #gem "bundler", "~> 1.0.0"
12
+ gem "jeweler", "~> 1.8.4"
13
+ #gem "rcov", ">= 0"
14
+ end
15
+
16
+ gem 'thor'
17
+ gem 'highline'
18
+ gem 'aws-sdk'
19
+ gem 'archive-tar-minitar'
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ archive-tar-minitar (0.5.2)
5
+ aws-sdk (1.10.0)
6
+ json (~> 1.4)
7
+ nokogiri (>= 1.4.4)
8
+ uuidtools (~> 2.1)
9
+ diff-lcs (1.1.3)
10
+ git (1.2.5)
11
+ highline (1.6.19)
12
+ jeweler (1.8.4)
13
+ bundler (~> 1.0)
14
+ git (>= 1.2.5)
15
+ rake
16
+ rdoc
17
+ json (1.8.0)
18
+ nokogiri (1.5.9)
19
+ rake (10.0.4)
20
+ rdoc (3.12.2)
21
+ json (~> 1.4)
22
+ rspec (2.8.0)
23
+ rspec-core (~> 2.8.0)
24
+ rspec-expectations (~> 2.8.0)
25
+ rspec-mocks (~> 2.8.0)
26
+ rspec-core (2.8.0)
27
+ rspec-expectations (2.8.0)
28
+ diff-lcs (~> 1.1.2)
29
+ rspec-mocks (2.8.0)
30
+ thor (0.18.1)
31
+ uuidtools (2.1.4)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ archive-tar-minitar
38
+ aws-sdk
39
+ highline
40
+ jeweler (~> 1.8.4)
41
+ rdoc (~> 3.12)
42
+ rspec (~> 2.8.0)
43
+ thor
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 tily
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # ncss-cookbooks コマンド
2
+
3
+ ## 概要
4
+
5
+ Chef の Cookbooks を一発で NIFTYCloud クラウドストレージにアップロードするコマンドです。
6
+
7
+ ## 使い方
8
+
9
+ $ ncss-cookbooks create my-bucket
10
+ $ ncss-cookbooks upload my-bucket
11
+
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = ncss-cookbooks
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to ncss-cookbooks
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 tily. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "ncss-cookbooks"
18
+ gem.homepage = "http://github.com/tily/ncss-cookbooks"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Chef の Cookbooks を一発で NIFTYCloud クラウドストレージにアップロードするコマンド}
21
+ gem.description = %Q{Chef の Cookbooks を一発で NIFTYCloud クラウドストレージにアップロードするコマンド}
22
+ gem.email = "tily05@gmail.com"
23
+ gem.authors = ["tily"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "ncss-cookbooks #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
+ require 'ncss-cookbooks'
4
+ NcssCookbooks.start
@@ -0,0 +1,58 @@
1
+ require 'zlib'
2
+ require 'fileutils'
3
+ require 'tmpdir'
4
+ require 'rubygems'
5
+ require 'thor'
6
+ require 'highline'
7
+ require 'aws-sdk'
8
+ require 'archive/tar/minitar'
9
+
10
+ class NcssCookbooks < Thor
11
+ class_option :access_key_id, :alias => '-a'
12
+ class_option :secret_access_key, :alias => '-s'
13
+
14
+ desc 'create <bucket>', 'create ncss bucket'
15
+ def create(bucket_name)
16
+ ncss.buckets.create(bucket_name)
17
+ end
18
+
19
+ desc 'upload <bucket>', 'upload . to ncss bucket'
20
+ def upload(bucket_name)
21
+ pwd = Dir.pwd
22
+ unless File.exists?("#{pwd}/VERSION") || File.readble?("#{pwd}/VERSION")
23
+ abort "Error: VERSION file does not exists."
24
+ end
25
+ version = File.read("#{pwd}/VERSION").chomp
26
+
27
+ bucket = ncss.buckets[bucket_name]
28
+ unless bucket.exists?
29
+ abort "Error: Bucket #{bucket_name} does not exist."
30
+ end
31
+ object = bucket.objects["#{version}/cookbooks.tgz"]
32
+
33
+ Dir.mktmpdir('ncss-cookbooks') do |dir|
34
+ FileUtils.mkdir_p("#{dir}/cookbooks/")
35
+ FileUtils.cp_r(Dir["#{pwd}/*"], "#{dir}/cookbooks/")
36
+
37
+ FileUtils.cd(dir)
38
+ cookbooks_tgz = Zlib::GzipWriter.new(File.open("cookbooks.tgz", "wb"))
39
+ Archive::Tar::Minitar.pack('cookbooks', cookbooks_tgz)
40
+
41
+ object.write(:file => "cookbooks.tgz")
42
+ object.acl = :public_read
43
+ end
44
+
45
+ puts object.url_for(:read).to_s.gsub(/\?(.+)$/, '')
46
+ end
47
+
48
+ private
49
+
50
+ def ncss
51
+ # TODO: option for west-1 endpoint
52
+ @ncss ||= AWS::S3.new(
53
+ :access_key_id => options[:access_key_id] || ENV['ACCESS_KEY_ID'] || HighLine.new.ask('Access Key Id: '),
54
+ :secret_access_key => options[:secret_access_key] || ENV['SECRET_ACCESS_KEY'] || HighLine.new.ask('Secret Access Key: '),
55
+ :s3_endpoint => 'ncss.nifty.com'
56
+ )
57
+ end
58
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "NcssCookbooks" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'ncss-cookbooks'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ncss-cookbooks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - tily
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-18 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &160602060 !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: *160602060
25
+ - !ruby/object:Gem::Dependency
26
+ name: highline
27
+ requirement: &160579040 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *160579040
36
+ - !ruby/object:Gem::Dependency
37
+ name: aws-sdk
38
+ requirement: &160577700 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *160577700
47
+ - !ruby/object:Gem::Dependency
48
+ name: archive-tar-minitar
49
+ requirement: &160576760 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *160576760
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec
60
+ requirement: &160575620 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 2.8.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *160575620
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &160574580 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '3.12'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *160574580
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &160572900 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.8.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *160572900
91
+ description: Chef の Cookbooks を一発で NIFTYCloud クラウドストレージにアップロードするコマンド
92
+ email: tily05@gmail.com
93
+ executables:
94
+ - ncss-cookbooks
95
+ extensions: []
96
+ extra_rdoc_files:
97
+ - LICENSE.txt
98
+ - README.md
99
+ - README.rdoc
100
+ files:
101
+ - .document
102
+ - .rspec
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.md
107
+ - README.rdoc
108
+ - Rakefile
109
+ - VERSION
110
+ - bin/ncss-cookbooks
111
+ - lib/ncss-cookbooks.rb
112
+ - spec/ncss-cookbooks_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: http://github.com/tily/ncss-cookbooks
115
+ licenses:
116
+ - MIT
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ segments:
128
+ - 0
129
+ hash: 3173881512082075132
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 1.8.13
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Chef の Cookbooks を一発で NIFTYCloud クラウドストレージにアップロードするコマンド
142
+ test_files: []