s3_website_monadic 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d1bf0182affb02d1e6689932b45e9f88b5d6717
4
- data.tar.gz: bb55d7e9e7b0b07b5fe338c5660fa934d3cbc191
3
+ metadata.gz: fcf86252fbd39bc03674724a1aedd72d89bbfb4e
4
+ data.tar.gz: ca24980dea8f15f37674cae980bb54b0b59d5b7d
5
5
  SHA512:
6
- metadata.gz: 491474ada809e5bb847e7f8187a59518fff226bcce5846fb403dd0d69ea9b8150ffc320c1b2f362aa3a5cf4cf8188e284377e837ed81571a84851e02084d1af5
7
- data.tar.gz: c23f6b17dbd7fdeedc76f26e13d0fdebaf0d803fa9fdc478cd28ccbf717af023ab62b2497b1de2eb2e1edb4fb6530f9a61446c726adb0efc7e96d289807cf0ab
6
+ metadata.gz: 884dc1fcebfb5f191cd49c9b8630d6ae70d75b3be7ffae133bf4a138c33b728932dc6ede08e38ef30a6bada348a93b7fd30699d861cf642e1a02776915d254ad
7
+ data.tar.gz: db92954fb81fcebb03e52d35900cb897c7624a5e8fe4d4697bb7bf94991b78c3d9e10cb988d17568d9f20eebd63bdf0f2fbb469d553a1dcc3520e8f91cfd73a5
data/Rakefile CHANGED
@@ -1,24 +1,2 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
-
4
- desc "Build the project"
5
- task :default => 'test'
6
-
7
- desc "Run tests"
8
- task :test do
9
- ENV['disable_parallel_processing'] = 'true'
10
- sh "bundle exec rspec"
11
- sh "bundle exec cucumber --tags ~@skip-on-travis"
12
- end
13
-
14
- desc 'Run work-in-progress features'
15
- task "cucumber:wip" do
16
- ENV['disable_parallel_processing'] = 'true'
17
- sh "bundle exec cucumber --tags @wip"
18
- end
19
-
20
- desc 'Run fast tests'
21
- task "cucumber:fast" do
22
- ENV['disable_parallel_processing'] = 'true'
23
- sh "bundle exec cucumber --tags ~@network-io --tags ~@starts-new-os-process"
24
- end
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__)+ '/../lib/s3_website')
4
+ require 'colored'
4
5
 
5
6
  class Cfg < Thor
6
7
  desc 'create', 'Create a config file with placeholder values'
@@ -59,23 +60,11 @@ class Cli < Thor
59
60
  LONGDESC
60
61
  def push
61
62
  call_dir = Dir.pwd
62
- Dir.chdir(File.dirname(__FILE__)+ '/..') {
63
- # Compile Scala if needed
64
- jar_file = File.dirname(__FILE__) + '/../target/scala-2.11/s3_website.jar'
65
- unless File.exists? jar_file
66
- puts "Compiling the s3_website.jar. This happens only once. Please wait up to a few minutes..."
67
- assembly_succeeded = system "./sbt assembly"
68
- unless assembly_succeeded
69
- puts "Failed to create the s3_website.jar. Please file a bug report."
70
- exit 1
71
- end
72
- end
73
-
63
+ project_root = File.expand_path(File.dirname(__FILE__)+ '/..')
64
+ Dir.chdir(project_root) {
65
+ jar_file = resolve_jar project_root
74
66
  # Then run it
75
- site_path = File.expand_path(S3Website::Paths.infer_site_path options[:site], call_dir)
76
- config_dir = File.expand_path options[:config_dir]
77
- args = "--site=#{site_path} --config-dir=#{config_dir}"
78
- exit system("java -cp #{jar_file} s3.website.Push #{args}")
67
+ run_s3_website_jar(jar_file, call_dir)
79
68
  }
80
69
  end
81
70
 
@@ -83,4 +72,60 @@ class Cli < Thor
83
72
  subcommand 'cfg', Cfg
84
73
  end
85
74
 
75
+ def run_s3_website_jar(jar_file, call_dir)
76
+ site_path = File.expand_path(S3Website::Paths.infer_site_path options[:site], call_dir)
77
+ config_dir = File.expand_path options[:config_dir]
78
+ args = "--site=#{site_path} --config-dir=#{config_dir}"
79
+ puts "[debg] Using #{jar_file}"
80
+ if system("java -cp #{jar_file} s3.website.Push #{args}")
81
+ exit 0
82
+ else
83
+ exit 1
84
+ end
85
+ end
86
+
87
+ def resolve_jar(project_root)
88
+ development_jar_path =
89
+ project_root + '/target/scala-2.11/s3_website.jar'
90
+ released_jar_lookup_paths = [
91
+ project_root + "/../s3_website-#{S3Website::VERSION}.jar",
92
+ ENV['TMPDIR'] + "/s3_website-#{S3Website::VERSION}.jar"
93
+ ]
94
+ found_jar = ([development_jar_path] + released_jar_lookup_paths)
95
+ .select { |jar_path|
96
+ File.exists? jar_path
97
+ }
98
+ .first
99
+ jar_file =
100
+ if found_jar
101
+ found_jar
102
+ else
103
+ is_development = File.exists?(project_root + '/.git')
104
+ if is_development
105
+ system "./sbt assembly"
106
+ puts development_jar_path
107
+ development_jar_path
108
+ else
109
+ download_jar(tag_name, released_jar_lookup_paths)
110
+ end
111
+ end
112
+ end
113
+
114
+ def download_jar(tag_name, released_jar_lookup_paths)
115
+ downloaded_jar = released_jar_lookup_paths.select { |jar_path|
116
+ File.writable? jar_path
117
+ }.first
118
+ unless downloaded_jar
119
+ puts "[error] Neither #{released_jar_lookup_paths.join ' or '} is writable. Cannot download s3_website.jar."
120
+ puts "[error] Set either directory as writable to the current user and try again."
121
+ end
122
+ download_url = "https://github.com/laurilehmijoki/s3_website/releases/download/#{tag_name}/s3_website.jar"
123
+ puts "[info] Downloading #{download_url} into #{downloaded_jar}"
124
+ require 'open-uri'
125
+ open(downloaded_jar, 'wb') do |file|
126
+ file << open(download_url).read
127
+ end
128
+ downloaded_jar
129
+ end
130
+
86
131
  Cli.start(ARGV)
data/lib/s3_website.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'thor'
3
3
 
4
+ require File.dirname(__FILE__) + "/s3_website/version"
4
5
  require File.dirname(__FILE__) + "/s3_website/paths"
5
6
  require File.dirname(__FILE__) + "/s3_website/jekyll"
6
7
  require File.dirname(__FILE__) + "/s3_website/nanoc"
@@ -32,7 +32,8 @@ module S3Website
32
32
  if site_path
33
33
  site_path
34
34
  else
35
- raise NoPredefinedWebsiteDirectoryFound
35
+ puts "Could not find a website directory. Specify one with the --site parameter."
36
+ exit
36
37
  end
37
38
  end
38
39
  end
@@ -0,0 +1,3 @@
1
+ module S3Website
2
+ VERSION = '0.0.20'
3
+ end
File without changes
data/release ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'octokit'
4
+ require_relative 'lib/s3_website/version'
5
+
6
+ version = S3Website::VERSION
7
+ unless ENV['S3_WEBSITE_RELEASE_KEY']
8
+ puts "Set the S3_WEBSITE_RELEASE_KEY environmental variable. It should be your personal GitHub access token."
9
+ end
10
+
11
+ def run(cmd)
12
+ unless system(cmd)
13
+ exit 1
14
+ end
15
+ end
16
+
17
+ puts "Building s3_website.jar..."
18
+ run "./sbt assembly"
19
+
20
+ tag_name = "v#{version}"
21
+ run "git tag #{tag_name} && git push origin #{tag_name}"
22
+
23
+ run "rake build"
24
+
25
+ client = Octokit::Client.new(:login => 'laurilehmijoki', :password => ENV['S3_WEBSITE_RELEASE_KEY'])
26
+ puts "Creating the release..."
27
+ release = client.create_release('laurilehmijoki/s3_website', tag_name)
28
+ puts "Uploading s3_website.jar..."
29
+ client.upload_asset(release[:url], 'target/scala-2.11/s3_website.jar')
30
+ puts "Pushing the gem into RubyGems.org"
31
+ run "gem push pkg/s3_website_monadic-#{version}.gem"
data/s3_website.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ require File.join([File.dirname(__FILE__),'lib','s3_website','version.rb'])
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "s3_website_monadic"
6
- s.version = "0.0.19"
6
+ s.version = S3Website::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'configure-s3-website', '= 1.5.5'
22
22
 
23
23
  s.add_development_dependency 'rake', '10.1.1'
24
+ s.add_development_dependency 'octokit', '3.1.0'
24
25
 
25
26
  s.files = `git ls-files`.split("\n")
26
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
+ s.test_files = `git ls-files -- src/test/*`.split("\n")
27
28
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
28
29
  s.require_paths = ["lib"]
29
30
  end
data/sbt CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
4
- java $SBT_OPTS -jar `dirname $0`/project/sbt-launch-0.13.2.jar "$@"
4
+ java $SBT_OPTS -jar `dirname $0`/project/sbt-launch.jar "$@"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website_monadic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 10.1.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: octokit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
55
69
  description: "\n Sync website files, set redirects, use HTTP performance optimisations,
56
70
  deliver via\n CloudFront.\n "
57
71
  email:
@@ -77,10 +91,12 @@ files:
77
91
  - lib/s3_website/jekyll.rb
78
92
  - lib/s3_website/nanoc.rb
79
93
  - lib/s3_website/paths.rb
94
+ - lib/s3_website/version.rb
80
95
  - project/assembly.sbt
81
96
  - project/build.properties
82
97
  - project/plugins.sbt
83
- - project/sbt-launch-0.13.2.jar
98
+ - project/sbt-launch.jar
99
+ - release
84
100
  - resources/configuration_file_template.yml
85
101
  - s3_website.gemspec
86
102
  - sbt
@@ -122,4 +138,5 @@ rubygems_version: 2.2.2
122
138
  signing_key:
123
139
  specification_version: 4
124
140
  summary: Manage your S3 website
125
- test_files: []
141
+ test_files:
142
+ - src/test/scala/s3/website/S3WebsiteSpec.scala